summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/chat/chat.h
blob: 60b1a4598bac3023e19bc208c9a2851c18c4328e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*
 * astyle --force-indent=tab=4 --brackets=linux --indent-switches
 *		  --pad=oper --one-line=keep-blocks  --unpad=paren
 *
 * Miranda NG: the free IM client for Microsoft* Windows*
 *
 * Copyright (c) 2000-09 Miranda ICQ/IM project,
 * all portions of this codebase are copyrighted to the people
 * listed in contributors.txt.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * you should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * part of tabSRMM messaging plugin for Miranda.
 *
 * This code is based on and still contains large parts of the the
 * original chat module for Miranda NG, written and copyrighted
 * by Joergen Persson in 2005.
 *
 * (C) 2005-2009 by silvercircle _at_ gmail _dot_ com and contributors
 *
 */

#ifndef _CHAT_H_
#define _CHAT_H_

//defines

enum TChatStatusEx
{
	CHAT_STATUS_NORMAL,
	CHAT_STATUS_AWAY,
	CHAT_STATUS_OFFLINE,
	CHAT_STATUS_MAX
};

// special service for tweaking performance
#define MS_GC_GETEVENTPTR  "GChat/GetNewEventPtr"
typedef INT_PTR (*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
typedef struct  {
	GETEVENTFUNC pfnAddEvent;
}GCPTRS;

class CMUCHighlight;

//structs

struct MODULEINFO : public GCModuleInfoBase
{
	DWORD          idleTimeStamp;
	DWORD          lastIdleCheck;
	TCHAR          tszIdleMsg[60];
	CMUCHighlight* Highlight;
	MODULEINFO *   next;
};

struct SESSION_INFO : public GCSessionInfoBase
{
	TCHAR           pszLogFileName[MAX_PATH + 50];

	int             iLogTrayFlags, iLogPopupFlags;

	int             iSearchItem;
	TCHAR           szSearch[255];
	CMUCHighlight  *Highlight;

	TContainerData *pContainer;
	TWindowData    *dat;
	SESSION_INFO   *next;
};

struct LOGSTREAMDATA : public GCLogStreamDataBase
{
	int           crCount;
	TWindowData  *dat;
};

struct TMUCSettings : public GlobalLogSettingsBase
{
	HICON       hIconOverlay;
	DWORD       dwIconFlags;
	LONG        iNickListFontHeight;
	int         iEventLimitThreshold;

	HFONT       UserListFonts[CHAT_STATUS_MAX];
	COLORREF    UserListColors[CHAT_STATUS_MAX];

	COLORREF    nickColors[8];
	HBRUSH      SelectionBGBrush;
	bool        bOpenInDefault, bFlashWindowHightlight, bBBCodeInPopups;
	bool        bDoubleClick4Privat, bShowContactStatus, bContactStatusFirst;

	bool        bLogClassicIndicators, bAlternativeSorting, bAnnoyingHighlight, bCreateWindowOnHighlight;
	bool        bLogSymbols, bClassicIndicators, bClickableNicks, bColorizeNicks, bColorizeNicksInLog;
	bool        bScaleIcons, bUseDividers, bDividersUsePopupConfig;

	HANDLE      hGroup;
	CMUCHighlight* Highlight;
};

struct FLASH_PARAMS
{
	HANDLE hContact;
	const char* sound;
	int   iEvent;
	HICON hNotifyIcon;
	bool  bActiveTab, bHighlight, bInactive, bMustFlash, bMustAutoswitch;
	HWND  hWnd;
};

extern TMUCSettings g_Settings;

struct COLORCHOOSER
{
	MODULEINFO *pModule;
	int   xPosition, yPosition;
	HWND  hWndTarget;
	bool  bForeground;
	SESSION_INFO *si;
};

#pragma comment(lib,"comctl32.lib")

//////////////////////////////////////////////////////////////////////////////////

// colorchooser.c
INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);

// log.c
void   Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw, bool bPhaseTwo);
TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime);
void   Log_SetStyles();

// window.c
INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
int GetTextPixelSize(TCHAR* pszText, HFONT hFont, bool bWidth);

// options.c
enum { FONTSECTION_AUTO, FONTSECTION_IM, FONTSECTION_IP };
int   OptionsInit(void);
void  LoadMsgDlgFont(int section, int i, LOGFONT * lf, COLORREF * colour, char* szMod);
void  AddIcons(void);
HICON LoadIconEx(int iIndex, char * pszIcoLibName, int iX, int iY);

// services.c
void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground);

HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateTab, BOOL bPopupContainer, BOOL bWantPopup);

// manager.c
SESSION_INFO* SM_FindSessionByHWND(HWND h);
SESSION_INFO* SM_FindSessionByHCONTACT(HANDLE h);
SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent);

void SM_RemoveContainer(TContainerData *pContainer);
BOOL SM_ReconfigureFilters();
BOOL SM_InvalidateLogDirectories();

//clist.c

//tools.c
BOOL          DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
int           Chat_GetColorIndex(const char* pszModule, COLORREF cr);
TCHAR*        my_strstri(const TCHAR* s1, const TCHAR* s2);
int           GetRichTextLength(HWND hwnd);
BOOL          IsHighlighted(SESSION_INFO *si, const TCHAR* pszText);
UINT          CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText);
void          DestroyGCMenu(HMENU *hMenu, int iIndex);
BOOL          DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char* pszModule, int iType, TCHAR* pszUID, TCHAR* pszText, DWORD dwItem);
void          Chat_SetFilters(SESSION_INFO *si);
void TSAPI    DoFlashAndSoundWorker(FLASH_PARAMS* p);
// message.c
char*         Chat_Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si);
TCHAR*        Chat_DoRtfToTags(char* pszRtfText, SESSION_INFO *si);

#include "chat_resource.h"

extern char *szChatIconString;

#define DEFLOGFILENAME _T("%miranda_logpath%\\%proto%\\%userid%.log")

#endif