summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-16 08:37:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-16 08:37:51 +0000
commit38ab4dde6b080defc5e7d7b286110d580cabdaa0 (patch)
tree4890eaba00645f597e91a888277d461ba3d923c0 /src
parent2f30799b091475f1086b756bba4b43ebacd3aefc (diff)
kernel chat engine, part 2 - scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@7676 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/miranda.h2
-rw-r--r--src/core/stdchat/src/window.cpp152
-rw-r--r--src/core/stdplug.h4
-rw-r--r--src/modules/chat/chat.h4
-rw-r--r--src/modules/chat/chat_opts.cpp21
-rw-r--r--src/modules/chat/chat_svc.cpp95
-rw-r--r--src/modules/chat/clist.cpp68
-rw-r--r--src/modules/chat/log.cpp5
-rw-r--r--src/modules/chat/manager.cpp146
-rw-r--r--src/modules/clist/clistmenus.cpp2
-rw-r--r--src/modules/clist/clisttray.cpp2
-rw-r--r--src/modules/clist/contact.cpp2
-rw-r--r--src/modules/clist/genmenu.cpp2
-rw-r--r--src/modules/protocols/protoaccs.cpp2
-rw-r--r--src/modules/protocols/protocols.cpp6
-rw-r--r--src/modules/skin/skinicons.cpp6
-rw-r--r--src/modules/utils/timezones.cpp2
17 files changed, 254 insertions, 267 deletions
diff --git a/src/core/miranda.h b/src/core/miranda.h
index fffbbbf689..68e7e9f363 100644
--- a/src/core/miranda.h
+++ b/src/core/miranda.h
@@ -114,7 +114,7 @@ int ImageList_AddIcon_NotShared(HIMAGELIST hIml, LPCTSTR szResource);
int ImageList_ReplaceIcon_NotShared(HIMAGELIST hIml, int iIndex, HINSTANCE hInstance, LPCTSTR szResource);
int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId);
-int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char* szProto, int iconId);
+int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char *szProto, int iconId);
int ImageList_ReplaceIcon_IconLibLoaded(HIMAGELIST hIml, int nIndex, HICON hIcon);
#define Safe_DestroyIcon(hIcon) if (hIcon) DestroyIcon(hIcon)
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp
index cfa7f713b2..b19a5040f6 100644
--- a/src/core/stdchat/src/window.cpp
+++ b/src/core/stdchat/src/window.cpp
@@ -24,13 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static HKL hkl = NULL;
-typedef struct
+struct MESSAGESUBDATA
{
time_t lastEnterTime;
TCHAR szTabSave[20];
-} MESSAGESUBDATA;
+};
-static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
+static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
RECT rc;
@@ -88,23 +88,23 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
SendDlgItemMessage( hwndDlg, IDC_FILTER, BUTTONSETASFLATBTN, TRUE, 0 );
SendDlgItemMessage( hwndDlg, IDC_CLOSE, BUTTONSETASFLATBTN, TRUE, 0 );
- SendMessage(GetDlgItem(hwndDlg,IDC_SMILEY), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Insert a smiley"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_BOLD), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text bold (CTRL+B)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_ITALICS), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text italicized (CTRL+I)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_UNDERLINE), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text underlined (CTRL+U)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_BKGCOLOR), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a background color for the text (CTRL+L)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_COLOR), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a foreground color for the text (CTRL+K)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_HISTORY), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show the history (CTRL+H)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_SHOWNICKLIST), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show/hide the nicklist (CTRL+N)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_CHANMGR), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Control this room (CTRL+O)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_FILTER), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Enable/disable the event filter (CTRL+F)"), 0);
- SendMessage(GetDlgItem(hwndDlg,IDC_CLOSE), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Close current tab (CTRL+F4)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_SMILEY), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Insert a smiley"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_BOLD), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text bold (CTRL+B)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_ITALICS), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text italicized (CTRL+I)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_UNDERLINE), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Make the text underlined (CTRL+U)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_BKGCOLOR), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a background color for the text (CTRL+L)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_COLOR), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Select a foreground color for the text (CTRL+K)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_HISTORY), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show the history (CTRL+H)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_SHOWNICKLIST), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Show/hide the nicklist (CTRL+N)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CHANMGR), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Control this room (CTRL+O)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_FILTER), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Enable/disable the event filter (CTRL+F)"), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CLOSE), BUTTONADDTOOLTIP, (WPARAM)LPGEN("Close current tab (CTRL+F4)"), 0);
SendDlgItemMessage(hwndDlg, IDC_BOLD, BUTTONSETASPUSHBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_ITALICS, BUTTONSETASPUSHBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_UNDERLINE, BUTTONSETASPUSHBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_COLOR, BUTTONSETASPUSHBTN, TRUE, 0);
SendDlgItemMessage(hwndDlg, IDC_BKGCOLOR, BUTTONSETASPUSHBTN, TRUE, 0);
-
+
MODULEINFO *pInfo = pci->MM_FindModule(si->pszModule);
if (pInfo) {
EnableWindow(GetDlgItem(hwndDlg, IDC_BOLD), pInfo->bBold);
@@ -114,9 +114,10 @@ static void InitButtons(HWND hwndDlg, SESSION_INFO *si)
EnableWindow(GetDlgItem(hwndDlg, IDC_BKGCOLOR), pInfo->bBkgColor);
if (si->iType == GCW_CHATROOM)
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANMGR), pInfo->bChanMgr);
-} }
+ }
+}
-static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
+static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
{
SESSION_INFO *si = (SESSION_INFO*)lParam;
@@ -148,7 +149,7 @@ static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
ShowWindow(GetDlgItem(hwndDlg, IDC_CLOSE), g_Settings.TabsEnable ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_TAB), g_Settings.TabsEnable ? SW_SHOW : SW_HIDE);
if (si->iType != GCW_SERVER)
- ShowWindow(GetDlgItem(hwndDlg, IDC_LIST), si->bNicklistEnabled?SW_SHOW:SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_LIST), si->bNicklistEnabled ? SW_SHOW : SW_HIDE);
else
ShowWindow(GetDlgItem(hwndDlg, IDC_LIST), SW_HIDE);
@@ -164,7 +165,7 @@ static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
EnableWindow(GetDlgItem(hwndDlg, IDC_CHANMGR), pci->MM_FindModule(si->pszModule)->bChanMgr);
}
- switch(urc->wId) {
+ switch (urc->wId) {
case IDOK:
GetWindowRect(si->hwndStatus, &rc);
urc->rcItem.left = bSend ? 315 : urc->dlgNewSize.cx;
@@ -175,14 +176,14 @@ static int RoomWndResize(HWND hwndDlg,LPARAM lParam,UTILRESIZECONTROL *urc)
case IDC_TAB:
urc->rcItem.top = 1;
urc->rcItem.left = 0;
- urc->rcItem.right = urc->dlgNewSize.cx- 24;
+ urc->rcItem.right = urc->dlgNewSize.cx - 24;
urc->rcItem.bottom = urc->dlgNewSize.cy - si->iSplitterY;
if (!bToolbar)
urc->rcItem.bottom += 20;
return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
case IDC_LOG:
- urc->rcItem.top = bTabs?(bTabBottom?0:rcTabs.top-1):0;
+ urc->rcItem.top = bTabs ? (bTabBottom ? 0 : rcTabs.top - 1) : 0;
urc->rcItem.left = 0;
urc->rcItem.right = bNick ? urc->dlgNewSize.cx - si->iSplitterX : urc->dlgNewSize.cx;
LBL_CalcBottom:
@@ -192,8 +193,8 @@ LBL_CalcBottom:
return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
case IDC_LIST:
- urc->rcItem.top = bTabs?(bTabBottom?0:rcTabs.top-1):0;
- urc->rcItem.right = urc->dlgNewSize.cx ;
+ urc->rcItem.top = bTabs ? (bTabBottom ? 0 : rcTabs.top - 1) : 0;
+ urc->rcItem.right = urc->dlgNewSize.cx;
urc->rcItem.left = urc->dlgNewSize.cx - si->iSplitterX + 2;
goto LBL_CalcBottom;
@@ -223,7 +224,7 @@ LBL_CalcBottom:
case IDC_UNDERLINE:
case IDC_COLOR:
case IDC_BKGCOLOR:
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY+3;
+ urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 3;
urc->rcItem.bottom = urc->rcItem.top + 16;
return RD_ANCHORX_LEFT | RD_ANCHORY_CUSTOM;
@@ -231,7 +232,7 @@ LBL_CalcBottom:
case IDC_CHANMGR:
case IDC_SHOWNICKLIST:
case IDC_FILTER:
- urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY+3;
+ urc->rcItem.top = urc->dlgNewSize.cy - si->iSplitterY + 3;
urc->rcItem.bottom = urc->rcItem.top + 16;
return RD_ANCHORX_RIGHT | RD_ANCHORY_CUSTOM;
@@ -248,13 +249,13 @@ LBL_CalcBottom:
static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
SESSION_INFO *Parentsi = (SESSION_INFO*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA);
- MESSAGESUBDATA *dat = (MESSAGESUBDATA *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ MESSAGESUBDATA *dat = (MESSAGESUBDATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (msg) {
case EM_SUBCLASSED:
- dat = (MESSAGESUBDATA *) mir_alloc(sizeof(MESSAGESUBDATA));
+ dat = (MESSAGESUBDATA*)mir_alloc(sizeof(MESSAGESUBDATA));
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) dat);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)dat);
dat->szTabSave[0] = '\0';
dat->lastEnterTime = 0;
return 0;
@@ -287,29 +288,30 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (wParam == VK_SPACE && isCtrl && !isAlt) // ctrl-space (paste clean text)
return TRUE;
- if (wParam == '\n' || wParam == '\r') {
- if ((isCtrl != 0) ^ (0 != db_get_b(NULL, "Chat", "SendOnEnter", 1))) {
- PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
- return 0;
- }
- if (db_get_b(NULL, "Chat", "SendOnDblEnter", 0)) {
- if (dat->lastEnterTime + 2 < time(NULL))
- dat->lastEnterTime = time(NULL);
- else {
+ if (wParam == '\n' || wParam == '\r') {
+ if ((isCtrl != 0) ^ (0 != db_get_b(NULL, "Chat", "SendOnEnter", 1))) {
+ PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
+ return 0;
+ }
+ if (db_get_b(NULL, "Chat", "SendOnDblEnter", 0)) {
+ if (dat->lastEnterTime + 2 < time(NULL))
+ dat->lastEnterTime = time(NULL);
+ else {
SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
- }
- }
- }
- else
- dat->lastEnterTime = 0;
+ }
+ }
+ }
+ else
+ dat->lastEnterTime = 0;
if (wParam == 1 && isCtrl && !isAlt) { //ctrl-a
SendMessage(hwnd, EM_SETSEL, 0, -1);
return 0;
- } }
+ }
+ }
break;
case WM_KEYDOWN:
@@ -351,10 +353,9 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return TRUE;
}
- if (wParam <= '9' && wParam >= '1' && isCtrl && !isAlt) { // CTRL + 1 -> 9 (switch tab)
+ if (wParam <= '9' && wParam >= '1' && isCtrl && !isAlt) // CTRL + 1 -> 9 (switch tab)
if (g_Settings.TabsEnable)
SendMessage(GetParent(hwnd), GC_SWITCHTAB, 0, (LPARAM)((int)wParam - (int)'1'));
- }
if (wParam <= VK_NUMPAD9 && wParam >= VK_NUMPAD1 && isCtrl && !isAlt) // CTRL + 1 -> 9 (switch tab)
if (g_Settings.TabsEnable)
@@ -515,47 +516,46 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (wParam == VK_UP && isCtrl && !isAlt) {
- int iLen;
- GETTEXTLENGTHEX gtl = {0};
- SETTEXTEX ste;
- LOGFONT lf;
char* lpPrevCmd = pci->SM_GetPrevCommand(Parentsi->ptszID, Parentsi->pszModule);
SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+ LOGFONT lf;
pci->LoadMsgDlgFont(17, &lf, NULL);
- ste.flags = ST_DEFAULT;
- ste.codepage = CP_ACP;
- if (lpPrevCmd)
+
+ if (lpPrevCmd) {
+ SETTEXTEX ste;
+ ste.flags = ST_DEFAULT;
+ ste.codepage = CP_ACP;
SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
- else
- SetWindowText(hwnd, _T(""));
+ }
+ else SetWindowText(hwnd, _T(""));
+ GETTEXTLENGTHEX gtl = { 0 };
gtl.flags = GTL_PRECISE;
gtl.codepage = CP_ACP;
- iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
+ int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
SendMessage(hwnd, EM_SCROLLCARET, 0,0);
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
- SendMessage(hwnd, EM_SETSEL,iLen,iLen);
+ SendMessage(hwnd, EM_SETSEL, iLen, iLen);
dat->lastEnterTime = 0;
return TRUE;
}
if (wParam == VK_DOWN && isCtrl && !isAlt) {
- GETTEXTLENGTHEX gtl = {0};
- SETTEXTEX ste;
-
char* lpPrevCmd = pci->SM_GetNextCommand(Parentsi->ptszID, Parentsi->pszModule);
SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
- ste.flags = ST_DEFAULT;
- ste.codepage = CP_ACP;
- if (lpPrevCmd)
- SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM) lpPrevCmd);
- else
- SetWindowText(hwnd, _T(""));
+ if (lpPrevCmd) {
+ SETTEXTEX ste;
+ ste.flags = ST_DEFAULT;
+ ste.codepage = CP_ACP;
+ SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
+ }
+ else SetWindowText(hwnd, _T(""));
+ GETTEXTLENGTHEX gtl = { 0 };
gtl.flags = GTL_PRECISE;
gtl.codepage = CP_ACP;
int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
@@ -639,10 +639,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_RBUTTONUP:
case WM_MBUTTONUP:
{
- UINT u = 0;
- UINT u2 = 0;
COLORREF cr;
-
pci->LoadMsgDlgFont(17, NULL, &cr);
CHARFORMAT2 cf;
@@ -652,7 +649,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bColor) {
int index = GetColorIndex(Parentsi->pszModule, cf.crTextColor);
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR);
+ UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR);
if (index >= 0) {
Parentsi->bFGSet = TRUE;
@@ -668,7 +665,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bBkgColor) {
int index = GetColorIndex(Parentsi->pszModule, cf.crBackColor);
COLORREF crB = (COLORREF)db_get_dw(NULL, "Chat", "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR);
+ UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_BKGCOLOR);
if (index >= 0) {
Parentsi->bBGSet = TRUE;
@@ -681,8 +678,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bBold) {
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_BOLD);
- u2 = cf.dwEffects;
+ UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_BOLD);
+ UINT u2 = cf.dwEffects;
u2 &= CFE_BOLD;
if (u == BST_UNCHECKED && u2)
CheckDlgButton(GetParent(hwnd), IDC_BOLD, BST_CHECKED);
@@ -691,8 +688,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bItalics) {
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_ITALICS);
- u2 = cf.dwEffects;
+ UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_ITALICS);
+ UINT u2 = cf.dwEffects;
u2 &= CFE_ITALIC;
if (u == BST_UNCHECKED && u2)
CheckDlgButton(GetParent(hwnd), IDC_ITALICS, BST_CHECKED);
@@ -701,14 +698,15 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
if (pci->MM_FindModule(Parentsi->pszModule) && pci->MM_FindModule(Parentsi->pszModule)->bUnderline) {
- u = IsDlgButtonChecked(GetParent(hwnd), IDC_UNDERLINE);
- u2 = cf.dwEffects;
+ UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_UNDERLINE);
+ UINT u2 = cf.dwEffects;
u2 &= CFE_UNDERLINE;
if (u == BST_UNCHECKED && u2)
CheckDlgButton(GetParent(hwnd), IDC_UNDERLINE, BST_CHECKED);
else if (u == BST_CHECKED && u2 == 0)
CheckDlgButton(GetParent(hwnd), IDC_UNDERLINE, BST_UNCHECKED);
- } }
+ }
+ }
break;
case EM_UNSUBCLASSED:
diff --git a/src/core/stdplug.h b/src/core/stdplug.h
index f7a6e49522..ef65298258 100644
--- a/src/core/stdplug.h
+++ b/src/core/stdplug.h
@@ -5,7 +5,7 @@
#define MIRANDA_EXE_FUNC(T) extern "C" T __declspec(dllimport)
#endif
-MIRANDA_EXE_FUNC(HICON) LoadSkinProtoIcon(const char* szProto, int status, bool big = false);
+MIRANDA_EXE_FUNC(HICON) LoadSkinProtoIcon(const char *szProto, int status, bool big = false);
MIRANDA_EXE_FUNC(HICON) LoadSkinIcon(int idx, bool big = false);
MIRANDA_EXE_FUNC(HANDLE) GetSkinIconHandle(int idx);
@@ -19,7 +19,7 @@ MIRANDA_EXE_FUNC(void) Button_SetIcon_IcoLib(HWND hDlg, int itemId, int iconId
MIRANDA_EXE_FUNC(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId);
MIRANDA_EXE_FUNC(void) Window_SetIcon_IcoLib(HWND hWnd, int iconId);
-MIRANDA_EXE_FUNC(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char* szProto, int iconId);
+MIRANDA_EXE_FUNC(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId);
MIRANDA_EXE_FUNC(void) Window_FreeIcon_IcoLib(HWND hWnd);
MIRANDA_EXE_FUNC(int) GetPluginLangByInstance(HINSTANCE hInstance);
diff --git a/src/modules/chat/chat.h b/src/modules/chat/chat.h
index b543d2f424..8392f7b8f8 100644
--- a/src/modules/chat/chat.h
+++ b/src/modules/chat/chat.h
@@ -47,8 +47,8 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData);
// clist.c
BOOL AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt, ...);
-HANDLE AddRoom(const char *pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType);
-HANDLE FindRoom(const char *pszModule, const TCHAR* pszRoom);
+HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType);
+HANDLE FindRoom(const char *pszModule, const TCHAR *pszRoom);
BOOL SetAllOffline(BOOL bHide, const char *pszModule);
BOOL SetOffline(HANDLE hContact, BOOL bHide);
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp
index 341d56db21..832ac721ed 100644
--- a/src/modules/chat/chat_opts.cpp
+++ b/src/modules/chat/chat_opts.cpp
@@ -291,6 +291,19 @@ static void FreeGlobalSettings(void)
DeleteObject(ci.pSettings->UserListHeadingsFont);
}
+void SetIndentSize()
+{
+ if (ci.pSettings->ShowTime) {
+ LOGFONT lf;
+ LoadMsgDlgFont(0, &lf, NULL);
+ HFONT hFont = CreateFontIndirect(&lf);
+ int iText = GetTextPixelSize(MakeTimeStamp(ci.pSettings->pszTimeStamp, time(NULL)), hFont, TRUE);
+ DeleteObject(hFont);
+ ci.pSettings->LogTextIndent = iText * 12 / 10;
+ }
+ else ci.pSettings->LogTextIndent = 0;
+}
+
int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth)
{
if (!pszText || !hFont)
@@ -349,13 +362,7 @@ int OptionsInit(void)
if (ci.pSettings->LoggingEnabled)
CreateDirectoryTreeT(ci.pSettings->pszLogDir);
- LOGFONT lf2;
- LoadMsgDlgFont(0, &lf2, NULL);
- HFONT hFont = CreateFontIndirect(&lf2);
- int iText = GetTextPixelSize(MakeTimeStamp(ci.pSettings->pszTimeStamp, time(NULL)), hFont, TRUE);
- DeleteObject(hFont);
- ci.pSettings->LogTextIndent = iText;
- ci.pSettings->LogTextIndent = ci.pSettings->LogTextIndent * 12 / 10;
+ SetIndentSize();
return 0;
}
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp
index d7cf19655d..46586ea2c3 100644
--- a/src/modules/chat/chat_svc.cpp
+++ b/src/modules/chat/chat_svc.cpp
@@ -105,30 +105,27 @@ static INT_PTR Service_GetCount(WPARAM wParam, LPARAM lParam)
static INT_PTR Service_GetInfo(WPARAM wParam, LPARAM lParam)
{
GC_INFO *gci = (GC_INFO *)lParam;
- SESSION_INFO *si = NULL;
-
if (!gci || !gci->pszModule)
return 1;
mir_cslock lck(cs);
- if (gci->Flags&BYINDEX)
+ SESSION_INFO *si;
+ if (gci->Flags & BYINDEX)
si = ci.SM_FindSessionByIndex(gci->pszModule, gci->iItem);
else
si = ci.SM_FindSession(gci->pszID, gci->pszModule);
+ if (si == NULL)
+ return 1;
- if (si) {
- if (gci->Flags & DATA) gci->dwItemData = si->dwItemData;
- if (gci->Flags & HCONTACT) gci->hContact = si->hContact;
- if (gci->Flags & TYPE) gci->iType = si->iType;
- if (gci->Flags & COUNT) gci->iCount = si->nUsersInNicklist;
- if (gci->Flags & USERS) gci->pszUsers = ci.SM_GetUsers(si);
- if (gci->Flags & ID) gci->pszID = si->ptszID;
- if (gci->Flags & NAME) gci->pszName = si->ptszName;
- return 0;
- }
-
- return 1;
+ if (gci->Flags & DATA) gci->dwItemData = si->dwItemData;
+ if (gci->Flags & HCONTACT) gci->hContact = si->hContact;
+ if (gci->Flags & TYPE) gci->iType = si->iType;
+ if (gci->Flags & COUNT) gci->iCount = si->nUsersInNicklist;
+ if (gci->Flags & USERS) gci->pszUsers = ci.SM_GetUsers(si);
+ if (gci->Flags & ID) gci->pszID = si->ptszID;
+ if (gci->Flags & NAME) gci->pszName = si->ptszName;
+ return 0;
}
static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam)
@@ -146,13 +143,15 @@ static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam)
return GC_REGISTER_ERROR;
mi->ptszModDispName = mir_tstrdup(gcr->ptszDispName);
- mi->bBold = gcr->dwFlags & GC_BOLD;
- mi->bUnderline = gcr->dwFlags & GC_UNDERLINE;
- mi->bItalics = gcr->dwFlags & GC_ITALICS;
- mi->bColor = gcr->dwFlags & GC_COLOR;
- mi->bBkgColor = gcr->dwFlags & GC_BKGCOLOR;
- mi->bAckMsg = gcr->dwFlags & GC_ACKMSG;
- mi->bChanMgr = gcr->dwFlags & GC_CHANMGR;
+ mi->bBold = (gcr->dwFlags & GC_BOLD) != 0;
+ mi->bUnderline = (gcr->dwFlags & GC_UNDERLINE) != 0;
+ mi->bItalics = (gcr->dwFlags & GC_ITALICS) != 0;
+ mi->bColor = (gcr->dwFlags & GC_COLOR) != 0;
+ mi->bBkgColor = (gcr->dwFlags & GC_BKGCOLOR) != 0;
+ mi->bAckMsg = (gcr->dwFlags & GC_ACKMSG) != 0;
+ mi->bChanMgr = (gcr->dwFlags & GC_CHANMGR) != 0;
+ mi->bSingleFormat = (gcr->dwFlags & GC_SINGLEFORMAT) != 0;
+ mi->bFontSize = (gcr->dwFlags & GC_FONTSIZE) != 0;
mi->iMaxText = gcr->iMaxText;
mi->nColorCount = gcr->nColors;
if (gcr->nColors > 0) {
@@ -189,13 +188,12 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
return GC_NEWSESSION_WRONGVER;
mir_cslock lck(cs);
- MODULEINFO* mi = ci.MM_FindModule(gcw->pszModule);
+ MODULEINFO *mi = ci.MM_FindModule(gcw->pszModule);
if (mi == NULL)
return GC_NEWSESSION_ERROR;
- SESSION_INFO *si = ci.SM_AddSession(gcw->ptszID, gcw->pszModule);
-
// create a new session and set the defaults
+ SESSION_INFO *si = ci.SM_AddSession(gcw->ptszID, gcw->pszModule);
if (si != NULL) {
si->dwItemData = gcw->dwItemData;
if (gcw->iType != GCW_SERVER)
@@ -223,7 +221,7 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
if (si->iType == GCW_SERVER)
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("Server: %s"), si->ptszName);
else
- mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s"), si->ptszName);
+ _tcsncpy_s(szTemp, SIZEOF(szTemp), si->ptszName, _TRUNCATE);
si->hContact = ci.AddRoom(gcw->pszModule, gcw->ptszID, szTemp, si->iType);
db_set_s(si->hContact, si->pszModule, "Topic", "");
db_unset(si->hContact, "CList", "StatusMsg");
@@ -232,18 +230,15 @@ static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam)
else
db_set_s(si->hContact, si->pszModule, "StatusBar", "");
}
- else {
- SESSION_INFO *si2 = ci.SM_FindSession(gcw->ptszID, gcw->pszModule);
- if (si2) {
- ci.UM_RemoveAll(&si2->pUsers);
- ci.TM_RemoveAll(&si2->pStatuses);
+ else if (si = ci.SM_FindSession(gcw->ptszID, gcw->pszModule)) {
+ ci.UM_RemoveAll(&si->pUsers);
+ ci.TM_RemoveAll(&si->pStatuses);
- si2->iStatusCount = 0;
- si2->nUsersInNicklist = 0;
+ si->iStatusCount = 0;
+ si->nUsersInNicklist = 0;
- if (ci.OnSessionReplace)
- ci.OnSessionReplace(si2);
- }
+ if (ci.OnSessionReplace)
+ ci.OnSessionReplace(si);
}
return 0;
@@ -361,10 +356,8 @@ static void AddUser(GCEVENT *gce)
if (ui == NULL) return;
ui->pszNick = mir_tstrdup(gce->ptszNick);
-
if (gce->bIsMe)
si->pMe = ui;
-
ui->Status = status;
ui->Status |= si->pStatuses->Status;
@@ -392,6 +385,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
if (!IsEventSupported(gcd->iType))
return GC_EVENT_ERROR;
+ SESSION_INFO *si;
mir_cslock lck(cs);
// Do different things according to type of event
@@ -419,17 +413,14 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
return ci.SM_SetContactStatus(gce->pDest->ptszID, gce->pDest->pszModule, gce->ptszUID, (WORD)gce->dwItemData);
case GC_EVENT_TOPIC:
- {
- SESSION_INFO *si = ci.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si) {
- if (gce->ptszText) {
- replaceStrT(si->ptszTopic, gce->ptszText);
- db_set_ts(si->hContact, si->pszModule, "Topic", RemoveFormatting(si->ptszTopic));
- if (ci.OnSetTopic)
- ci.OnSetTopic(si);
- if (db_get_b(NULL, "Chat", "TopicOnClist", 0))
- db_set_ts(si->hContact, "CList", "StatusMsg", RemoveFormatting(si->ptszTopic));
- }
+ if (si = ci.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule)) {
+ if (gce->ptszText) {
+ replaceStrT(si->ptszTopic, gce->ptszText);
+ db_set_ts(si->hContact, si->pszModule, "Topic", RemoveFormatting(si->ptszTopic));
+ if (ci.OnSetTopic)
+ ci.OnSetTopic(si);
+ if (db_get_b(NULL, "Chat", "TopicOnClist", 0))
+ db_set_ts(si->hContact, "CList", "StatusMsg", RemoveFormatting(si->ptszTopic));
}
}
break;
@@ -445,7 +436,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
case GC_EVENT_MESSAGE:
case GC_EVENT_ACTION:
if (!gce->bIsMe && gce->pDest->ptszID && gce->ptszText) {
- SESSION_INFO *si = ci.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
+ si = ci.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
if (si && IsHighlighted(si, gce->ptszText))
bIsHighlighted = TRUE;
}
@@ -474,7 +465,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
pMod = gcd->pszModule;
}
else if (gcd->iType == GC_EVENT_NOTICE || gcd->iType == GC_EVENT_INFORMATION) {
- SESSION_INFO *si = ci.GetActiveSession();
+ si = ci.GetActiveSession();
if (si && !lstrcmpA(si->pszModule, gcd->pszModule)) {
pWnd = si->ptszID;
pMod = si->pszModule;
@@ -490,7 +481,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam)
// add to log
if (pWnd) {
- SESSION_INFO *si = ci.SM_FindSession(pWnd, pMod);
+ si = ci.SM_FindSession(pWnd, pMod);
// fix for IRC's old stuyle mode notifications. Should not affect any other protocol
if ((gce->pDest->iType == GC_EVENT_ADDSTATUS || gce->pDest->iType == GC_EVENT_REMOVESTATUS) && !(gce->dwFlags & GCEF_ADDTOLOG))
diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp
index fec51f63ed..f8b30bcc68 100644
--- a/src/modules/chat/clist.cpp
+++ b/src/modules/chat/clist.cpp
@@ -22,57 +22,56 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "chat.h"
-HANDLE AddRoom(const char *pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType)
+HANDLE AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType)
{
HANDLE hContact = ci.FindRoom(pszModule, pszRoom);
DBVARIANT dbv;
TCHAR pszGroup[50];
*pszGroup = '\0';
- if ( !db_get_ts( NULL, "Chat", "AddToGroup", &dbv )) {
- if ( lstrlen( dbv.ptszVal ) > 0 )
- lstrcpyn( pszGroup, dbv.ptszVal, 50);
+ if (!db_get_ts(NULL, "Chat", "AddToGroup", &dbv)) {
+ if (lstrlen(dbv.ptszVal) > 0)
+ lstrcpyn(pszGroup, dbv.ptszVal, 50);
db_free(&dbv);
}
- else lstrcpyn( pszGroup, _T("Chat rooms"), 50);
+ else lstrcpyn(pszGroup, _T("Chat rooms"), 50);
- if ( pszGroup[0] )
+ if (pszGroup[0])
Clist_CreateGroup(0, pszGroup);
- if ( hContact ) { //contact exist, make sure it is in the right group
+ if (hContact) { //contact exist, make sure it is in the right group
if (pszGroup[0]) {
- ptrT grpName( db_get_tsa(hContact, "CList", "Group"));
- if ( !lstrcmp(pszGroup, grpName))
+ ptrT grpName(db_get_tsa(hContact, "CList", "Group"));
+ if (!lstrcmp(pszGroup, grpName))
db_set_ts(hContact, "CList", "Group", pszGroup);
}
- db_set_w( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
- db_set_ts(hContact, pszModule, "Nick", pszDisplayName );
+ db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
+ db_set_ts(hContact, pszModule, "Nick", pszDisplayName);
return hContact;
}
// here we create a new one since no one is to be found
- if (( hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL )
+ if ((hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL)
return NULL;
- CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) pszModule );
- if ( pszGroup && lstrlen( pszGroup ) > 0 )
- db_set_ts(hContact, "CList", "Group", pszGroup );
+ CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)pszModule);
+ if (pszGroup && lstrlen(pszGroup) > 0)
+ db_set_ts(hContact, "CList", "Group", pszGroup);
else
- db_unset( hContact, "CList", "Group" );
- db_set_ts( hContact, pszModule, "Nick", pszDisplayName );
- db_set_ts( hContact, pszModule, "ChatRoomID", pszRoom );
- db_set_b( hContact, pszModule, "ChatRoom", (BYTE)iType );
- db_set_w( hContact, pszModule, "Status", ID_STATUS_OFFLINE );
+ db_unset(hContact, "CList", "Group");
+ db_set_ts(hContact, pszModule, "Nick", pszDisplayName);
+ db_set_ts(hContact, pszModule, "ChatRoomID", pszRoom);
+ db_set_b(hContact, pszModule, "ChatRoom", (BYTE)iType);
+ db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
return hContact;
}
BOOL SetOffline(HANDLE hContact, BOOL bHide)
{
- if ( hContact ) {
- char* szProto = GetContactProto(hContact);
- int i = db_get_b(hContact, szProto, "ChatRoom", 0);
- db_set_w(hContact, szProto,"ApparentMode",(LPARAM) 0);
+ if (hContact) {
+ char *szProto = GetContactProto(hContact);
+ db_set_w(hContact, szProto, "ApparentMode", (LPARAM)0);
db_set_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
return TRUE;
}
@@ -98,12 +97,10 @@ BOOL SetAllOffline(BOOL bHide, const char *pszModule)
return TRUE;
}
-int RoomDoubleclicked( WPARAM wParam, LPARAM lParam )
+int RoomDoubleclicked(WPARAM wParam, LPARAM lParam)
{
- BOOL bRedrawFlag = FALSE;
-
HANDLE hContact = (HANDLE)wParam;
- if ( !hContact )
+ if (!hContact)
return 0;
char *szProto = GetContactProto(hContact);
@@ -120,8 +117,7 @@ int RoomDoubleclicked( WPARAM wParam, LPARAM lParam )
if (si->hWnd != NULL
&& db_get_b(NULL, "Chat", "ToggleVisibility", 0) == 1
&& !CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)
- && IsWindowVisible(si->hWnd)
- && !IsIconic(si->hWnd))
+ && IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd))
{
if (ci.OnSessionDblClick)
ci.OnSessionDblClick(si);
@@ -146,7 +142,7 @@ INT_PTR JoinChat(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
if (hContact) {
- char* szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto) {
if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE)
CallProtoService(szProto, PS_JOINCHAT, wParam, lParam);
@@ -162,7 +158,7 @@ INT_PTR LeaveChat(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE)wParam;
if (hContact) {
- char* szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto)
CallProtoService(szProto, PS_LEAVECHAT, wParam, lParam);
}
@@ -236,15 +232,15 @@ BOOL AddEvent(HANDLE hContact, HICON hIcon, HANDLE hEvent, int type, TCHAR* fmt,
return TRUE;
}
-HANDLE FindRoom (const char *pszModule, const TCHAR* pszRoom)
+HANDLE FindRoom(const char *pszModule, const TCHAR *pszRoom)
{
for (HANDLE hContact = db_find_first(pszModule); hContact; hContact = db_find_next(hContact, pszModule)) {
- if ( !db_get_b(hContact, pszModule, "ChatRoom", 0))
+ if (!db_get_b(hContact, pszModule, "ChatRoom", 0))
continue;
DBVARIANT dbv;
- if ( !db_get_ts( hContact, pszModule, "ChatRoomID", &dbv )) {
- if ( !lstrcmpi(dbv.ptszVal, pszRoom)) {
+ if (!db_get_ts(hContact, pszModule, "ChatRoomID", &dbv)) {
+ if (!lstrcmpi(dbv.ptszVal, pszRoom)) {
db_free(&dbv);
return hContact;
}
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp
index 9f82a32b66..fc8788561e 100644
--- a/src/modules/chat/log.cpp
+++ b/src/modules/chat/log.cpp
@@ -97,7 +97,7 @@ static void Log_Append(char **buffer, int *cbBufferEnd, int *cbBufferAlloced, co
if (charsDone >= 0)
break;
*cbBufferAlloced += 4096;
- *buffer = (char *) mir_realloc(*buffer, *cbBufferAlloced);
+ *buffer = (char *)mir_realloc(*buffer, *cbBufferAlloced);
}
va_end(va);
*cbBufferEnd += charsDone;
@@ -111,7 +111,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff
char* d;
va_start(va, fmt);
- lineLen = mir_vsntprintf( line, 8000, fmt, va);
+ lineLen = mir_vsntprintf(line, 8000, fmt, va);
if (lineLen < 0) lineLen = 8000;
line[lineLen] = 0;
va_end(va);
@@ -335,7 +335,6 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
// ### RTF HEADER
header = mi->pszHeader;
-
if (header)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, header);
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp
index cacb05eb50..b59420f8dd 100644
--- a/src/modules/chat/manager.cpp
+++ b/src/modules/chat/manager.cpp
@@ -25,10 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "chat.h"
#define WINDOWS_COMMANDS_MAX 30
-#define STATUSICONCOUNT 6
-SESSION_INFO *m_WndList = 0;
-MODULEINFO *m_ModList = 0;
+MODULEINFO *m_ModList = 0;
static void SetActiveSessionEx(SESSION_INFO *si)
{
@@ -51,7 +49,7 @@ static SESSION_INFO* GetActiveSession(void)
if (si)
return si;
- return m_WndList;
+ return ci.wndList;
}
//---------------------------------------------------
@@ -65,22 +63,22 @@ static SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char *pszModule)
if (!pszID || !pszModule)
return NULL;
- if (!ci.SM_FindSession(pszID, pszModule)) {
- SESSION_INFO *node = (SESSION_INFO*)mir_calloc(sizeof(SESSION_INFO));
- node->ptszID = mir_tstrdup(pszID);
- node->pszModule = mir_strdup(pszModule);
+ if (ci.SM_FindSession(pszID, pszModule))
+ return NULL;
- if (m_WndList == NULL) { // list is empty
- m_WndList = node;
- node->next = NULL;
- }
- else {
- node->next = m_WndList;
- m_WndList = node;
- }
- return node;
+ SESSION_INFO *node = (SESSION_INFO*)mir_calloc(ci.cbSession);
+ node->ptszID = mir_tstrdup(pszID);
+ node->pszModule = mir_strdup(pszModule);
+
+ if (ci.wndList == NULL) { // list is empty
+ ci.wndList = node;
+ node->next = NULL;
}
- return NULL;
+ else {
+ node->next = ci.wndList;
+ ci.wndList = node;
+ }
+ return node;
}
static void SM_FreeSession(SESSION_INFO *si)
@@ -122,7 +120,7 @@ static int SM_RemoveSession(const TCHAR *pszID, const char *pszModule, BOOL remo
if (!pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
+ SESSION_INFO *pTemp = ci.wndList, *pLast = NULL;
while (pTemp != NULL) {
// match
if ((!pszID && pTemp->iType != GCW_SERVER || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
@@ -133,7 +131,7 @@ static int SM_RemoveSession(const TCHAR *pszID, const char *pszModule, BOOL remo
DoEventHook(pTemp->ptszID, pTemp->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)pTemp->dwItemData);
if (pLast == NULL)
- m_WndList = pTemp->next;
+ ci.wndList = pTemp->next;
else
pLast->next = pTemp->next;
@@ -149,7 +147,7 @@ static int SM_RemoveSession(const TCHAR *pszID, const char *pszModule, BOOL remo
if (pLast)
pTemp = pLast->next;
else
- pTemp = m_WndList;
+ pTemp = ci.wndList;
}
else {
pLast = pTemp;
@@ -164,7 +162,7 @@ static SESSION_INFO* SM_FindSession(const TCHAR *pszID, const char *pszModule)
if (!pszID || !pszModule)
return NULL;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule))
return pTemp;
@@ -179,7 +177,7 @@ static BOOL SM_SetOffline(const TCHAR *pszID, const char *pszModule)
if (!pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if ((!pszID || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
ci.UM_RemoveAll(&pTemp->pUsers);
@@ -198,7 +196,7 @@ static BOOL SM_SetOffline(const TCHAR *pszID, const char *pszModule)
static BOOL SM_SetStatusEx(const TCHAR *pszID, const char *pszModule, const TCHAR* pszText, int flags)
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
if (!pszModule)
return FALSE;
@@ -247,7 +245,7 @@ static BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce)
{
int bManyFix = 0;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpiA(pTemp->pszModule, gce->pDest->pszModule)) {
if (ci.UM_FindUser(pTemp->pUsers, gce->ptszUID)) {
@@ -276,7 +274,7 @@ static BOOL SM_AddEvent(const TCHAR *pszID, const char *pszModule, GCEVENT *gce,
if (!pszID || !pszModule)
return TRUE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
LOGINFO *li = ci.LM_AddEvent(&pTemp->pLog, &pTemp->pLogEnd);
@@ -309,7 +307,7 @@ static USERINFO* SM_AddUser(const TCHAR *pszID, const char *pszModule, const TCH
if (!pszID || !pszModule)
return NULL;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
USERINFO *p = ci.UM_AddUser(pTemp->pStatuses, &pTemp->pUsers, pszUID, pszNick, wStatus);
@@ -329,7 +327,7 @@ static BOOL SM_MoveUser(const TCHAR *pszID, const char *pszModule, const TCHAR *
if (!pszID || !pszModule || !pszUID)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
ci.UM_SortUser(&pTemp->pUsers, pszUID);
@@ -346,7 +344,7 @@ static BOOL SM_RemoveUser(const TCHAR *pszID, const char *pszModule, const TCHAR
if (!pszModule || !pszUID)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if ((!pszID || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
DWORD dw;
@@ -377,7 +375,7 @@ static USERINFO* SM_GetUserFromIndex(const TCHAR *pszID, const char *pszModule,
if (!pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule))
return ci.UM_FindUserFromIndex(pTemp->pUsers, index);
@@ -393,7 +391,7 @@ STATUSINFO* SM_AddStatus(const TCHAR *pszID, const char *pszModule, const TCHAR
if (!pszID || !pszModule)
return NULL;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
STATUSINFO *ti = ci.TM_AddStatus(&pTemp->pStatuses, pszStatus, &pTemp->iStatusCount);
@@ -414,7 +412,7 @@ static BOOL SM_GiveStatus(const TCHAR *pszID, const char *pszModule, const TCHAR
if (!pszID || !pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
USERINFO *ui = ci.UM_GiveStatus(pTemp->pUsers, pszUID, ci.TM_StringToWord(pTemp->pStatuses, pszStatus));
@@ -436,7 +434,7 @@ static BOOL SM_SetContactStatus(const TCHAR *pszID, const char *pszModule, const
if (!pszID || !pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
USERINFO *ui = ci.UM_SetContactStatus(pTemp->pUsers, pszUID, wStatus);
@@ -458,7 +456,7 @@ static BOOL SM_TakeStatus(const TCHAR *pszID, const char *pszModule, const TCHAR
if (!pszID || !pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
USERINFO* ui = ci.UM_TakeStatus(pTemp->pUsers, pszUID, ci.TM_StringToWord(pTemp->pStatuses, pszStatus));
@@ -477,7 +475,7 @@ static BOOL SM_TakeStatus(const TCHAR *pszID, const char *pszModule, const TCHAR
static LRESULT SM_SendMessage(const TCHAR *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp && pszModule) {
if ((!pszID || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
@@ -499,7 +497,7 @@ static BOOL SM_PostMessage(const TCHAR *pszID, const char *pszModule, UINT msg,
if (!pszID || !pszModule)
return 0;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!lstrcmpi(pTemp->ptszID, pszID) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
if (pTemp->hWnd)
@@ -514,7 +512,7 @@ static BOOL SM_PostMessage(const TCHAR *pszID, const char *pszModule, UINT msg,
static BOOL SM_BroadcastMessage(const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam, BOOL bAsync)
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (!pszModule || !lstrcmpiA(pTemp->pszModule, pszModule)) {
if (pTemp->hWnd) {
@@ -534,7 +532,7 @@ static BOOL SM_SetStatus(const TCHAR *pszID, const char *pszModule, int wStatus)
if (!pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if ((!pszID || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
pTemp->wStatus = wStatus;
@@ -561,7 +559,7 @@ static BOOL SM_SendUserMessage(const TCHAR *pszID, const char *pszModule, const
if (!pszModule || !pszText)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if ((!pszID || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
if (pTemp->iType == GCW_CHATROOM)
@@ -580,7 +578,7 @@ static SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si)
return NULL;
BOOL bFound = FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (si == pTemp) {
if (bFound)
@@ -592,7 +590,7 @@ static SESSION_INFO* SM_GetPrevWindow(SESSION_INFO *si)
return pTemp;
pTemp = pTemp->next;
if (pTemp == NULL && bFound)
- pTemp = m_WndList;
+ pTemp = ci.wndList;
}
return NULL;
}
@@ -602,7 +600,7 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si)
if (!si)
return NULL;
- SESSION_INFO *pTemp = m_WndList, *pLast = NULL;
+ SESSION_INFO *pTemp = ci.wndList, *pLast = NULL;
while (pTemp != NULL) {
if (si == pTemp) {
if (pLast) {
@@ -616,7 +614,7 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si)
pLast = pTemp;
pTemp = pTemp->next;
if (pTemp == NULL)
- pTemp = m_WndList;
+ pTemp = ci.wndList;
}
return NULL;
}
@@ -626,7 +624,7 @@ static BOOL SM_ChangeUID(const TCHAR *pszID, const char *pszModule, const TCHAR
if (!pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if ((!pszID || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
USERINFO* ui = ci.UM_FindUser(pTemp->pUsers, pszUID);
@@ -641,26 +639,12 @@ static BOOL SM_ChangeUID(const TCHAR *pszID, const char *pszModule, const TCHAR
return TRUE;
}
-
-static BOOL SM_SetTabbedWindowHwnd(SESSION_INFO *si, HWND hwnd)
-{
- SESSION_INFO *pTemp = m_WndList;
- while (pTemp != NULL) {
- if (si && si == pTemp)
- pTemp->hWnd = hwnd;
- else
- pTemp->hWnd = NULL;
- pTemp = pTemp->next;
- }
- return TRUE;
-}
-
static BOOL SM_ChangeNick(const TCHAR *pszID, const char *pszModule, GCEVENT *gce)
{
if (!pszModule)
return FALSE;
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if ((!pszID || !lstrcmpi(pTemp->ptszID, pszID)) && !lstrcmpiA(pTemp->pszModule, pszModule)) {
USERINFO* ui = ci.UM_FindUser(pTemp->pUsers, gce->ptszUID);
@@ -679,25 +663,38 @@ static BOOL SM_ChangeNick(const TCHAR *pszID, const char *pszModule, GCEVENT *gc
return TRUE;
}
+static BOOL SM_SetTabbedWindowHwnd(SESSION_INFO *si, HWND hwnd)
+{
+ SESSION_INFO *pTemp = ci.wndList;
+ while (pTemp != NULL) {
+ if (si && si == pTemp)
+ pTemp->hWnd = hwnd;
+ else
+ pTemp->hWnd = NULL;
+ pTemp = pTemp->next;
+ }
+ return TRUE;
+}
+
static BOOL SM_RemoveAll(void)
{
- while (m_WndList) {
- SESSION_INFO *pLast = m_WndList->next;
+ while (ci.wndList) {
+ SESSION_INFO *pLast = ci.wndList->next;
- if (m_WndList->hWnd)
- SendMessage(m_WndList->hWnd, GC_EVENT_CONTROL + WM_USER + 500, SESSION_TERMINATE, 0);
- DoEventHook(m_WndList->ptszID, m_WndList->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)m_WndList->dwItemData);
+ if (ci.wndList->hWnd)
+ SendMessage(ci.wndList->hWnd, GC_EVENT_CONTROL + WM_USER + 500, SESSION_TERMINATE, 0);
+ DoEventHook(ci.wndList->ptszID, ci.wndList->pszModule, GC_SESSION_TERMINATE, NULL, NULL, (DWORD)ci.wndList->dwItemData);
- SM_FreeSession(m_WndList);
- m_WndList = pLast;
+ SM_FreeSession(ci.wndList);
+ ci.wndList = pLast;
}
- m_WndList = NULL;
+ ci.wndList = NULL;
return TRUE;
}
static void SM_AddCommand(const TCHAR *pszID, const char *pszModule, const char* lpNewCommand)
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (lstrcmpi(pTemp->ptszID, pszID) == 0 && lstrcmpiA(pTemp->pszModule, pszModule) == 0) { // match
COMMANDINFO *node = (COMMANDINFO *)mir_alloc(sizeof(COMMANDINFO));
@@ -734,7 +731,7 @@ static void SM_AddCommand(const TCHAR *pszID, const char *pszModule, const char*
static char* SM_GetPrevCommand(const TCHAR *pszID, const char *pszModule) // get previous command. returns NULL if previous command does not exist. current command remains as it was.
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (lstrcmpi(pTemp->ptszID, pszID) == 0 && lstrcmpiA(pTemp->pszModule, pszModule) == 0) { // match
COMMANDINFO *pPrevCmd = NULL;
@@ -756,7 +753,7 @@ static char* SM_GetPrevCommand(const TCHAR *pszID, const char *pszModule) // get
static char* SM_GetNextCommand(const TCHAR *pszID, const char *pszModule) // get next command. returns NULL if next command does not exist. current command becomes NULL (a prev command after this one will get you the last command)
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
while (pTemp != NULL) {
if (lstrcmpi(pTemp->ptszID, pszID) == 0 && lstrcmpiA(pTemp->pszModule, pszModule) == 0) { // match
COMMANDINFO *pNextCmd = NULL;
@@ -773,7 +770,7 @@ static char* SM_GetNextCommand(const TCHAR *pszID, const char *pszModule) // get
static int SM_GetCount(const char *pszModule)
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
int count = 0;
while (pTemp != NULL) {
@@ -787,7 +784,7 @@ static int SM_GetCount(const char *pszModule)
static SESSION_INFO* SM_FindSessionByIndex(const char *pszModule, int iItem)
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
int count = 0;
while (pTemp != NULL) {
if (!lstrcmpiA(pszModule, pTemp->pszModule)) {
@@ -805,7 +802,7 @@ static SESSION_INFO* SM_FindSessionByIndex(const char *pszModule, int iItem)
static char* SM_GetUsers(SESSION_INFO *si)
{
- SESSION_INFO *pTemp = m_WndList;
+ SESSION_INFO *pTemp = ci.wndList;
USERINFO *utemp = NULL;
char* p = NULL;
int alloced = 0;
@@ -1153,8 +1150,7 @@ USERINFO* UM_AddUser(STATUSINFO* pStatusList, USERINFO** ppUserList, const TCHAR
}
// if (!UM_FindUser(*ppUserList, pszUI, wStatus)
- USERINFO *node = (USERINFO*)mir_alloc(sizeof(USERINFO));
- ZeroMemory(node, sizeof(USERINFO));
+ USERINFO *node = (USERINFO*)mir_calloc(sizeof(USERINFO));
replaceStrT(node->pszUID, pszUID);
if (*ppUserList == NULL) { // list is empty
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp
index 2de2d14240..4fe73299b6 100644
--- a/src/modules/clist/clistmenus.cpp
+++ b/src/modules/clist/clistmenus.cpp
@@ -51,7 +51,7 @@ HANDLE hStatusMenuObject = 0;
int UnloadMoveToGroup(void);
int statustopos(int status);
-void Proto_SetStatus(const char* szProto, unsigned status);
+void Proto_SetStatus(const char *szProto, unsigned status);
bool prochotkey;
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp
index 6473461602..670a7f8f51 100644
--- a/src/modules/clist/clisttray.cpp
+++ b/src/modules/clist/clisttray.cpp
@@ -45,7 +45,7 @@ static CRITICAL_SECTION trayLockCS;
static BOOL fTrayInited = FALSE;
-static TCHAR* sttGetXStatus(const char* szProto)
+static TCHAR* sttGetXStatus(const char *szProto)
{
TCHAR* result = NULL;
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp
index 30d9ac3505..997061b117 100644
--- a/src/modules/clist/contact.cpp
+++ b/src/modules/clist/contact.cpp
@@ -47,7 +47,7 @@ static const struct {
static int GetContactStatus(HANDLE hContact)
{
- char* szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if (szProto == NULL)
return ID_STATUS_OFFLINE;
return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 07c40e5990..3fa55b5f72 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -234,7 +234,7 @@ INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey)
INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam)
{
- char* szProto = (char*)wParam;
+ char *szProto = (char*)wParam;
if (szProto == NULL)
return 0;
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp
index 06c469845a..6c763fc08b 100644
--- a/src/modules/protocols/protoaccs.cpp
+++ b/src/modules/protocols/protoaccs.cpp
@@ -487,7 +487,7 @@ struct DeactivationThreadParam
bool bErase;
};
-pfnUninitProto GetProtocolDestructor(char* szProto);
+pfnUninitProto GetProtocolDestructor(char *szProto);
static int DeactivationThread(DeactivationThreadParam* param)
{
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index d7d34a2275..4c86dead15 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -214,7 +214,7 @@ static int Proto_ValidTypingContact(HANDLE hContact, char *szProto)
static INT_PTR Proto_SelfIsTyping(WPARAM wParam, LPARAM lParam)
{
if (lParam == PROTOTYPE_SELFTYPING_OFF || lParam == PROTOTYPE_SELFTYPING_ON) {
- char* szProto = GetContactProto((HANDLE)wParam);
+ char *szProto = GetContactProto((HANDLE)wParam);
if ( !szProto)
return 0;
@@ -244,7 +244,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam)
return 0;
}
-void Proto_SetStatus(const char* szProto, unsigned status)
+void Proto_SetStatus(const char *szProto, unsigned status)
{
if (CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND)
{
@@ -741,7 +741,7 @@ void UnloadProtocolsModule()
/////////////////////////////////////////////////////////////////////////////////////////
-pfnUninitProto GetProtocolDestructor(char* szProto)
+pfnUninitProto GetProtocolDestructor(char *szProto)
{
PROTOCOLDESCRIPTOR temp;
temp.szName = szProto;
diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp
index 37366da353..3da738b389 100644
--- a/src/modules/skin/skinicons.cpp
+++ b/src/modules/skin/skinicons.cpp
@@ -160,7 +160,7 @@ int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId)
return res;
}
-int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char* szProto, int iconId)
+int ImageList_AddIcon_ProtoIconLibLoaded(HIMAGELIST hIml, const char *szProto, int iconId)
{
HICON hIcon = LoadSkinProtoIcon(szProto, iconId);
int res = ImageList_AddIcon(hIml, hIcon);
@@ -189,7 +189,7 @@ void Window_SetIcon_IcoLib(HWND hWnd, int iconId)
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinIcon(iconId));
}
-void Window_SetProtoIcon_IcoLib(HWND hWnd, const char* szProto, int iconId)
+void Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId)
{
SendMessage(hWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinProtoIcon(szProto, iconId, true));
SendMessage(hWnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinProtoIcon(szProto, iconId));
@@ -219,7 +219,7 @@ void Button_FreeIcon_IcoLib(HWND hwndDlg, int itemId)
// wParam = szProto
// lParam = status
//
-HICON LoadSkinProtoIcon(const char* szProto, int status, bool big)
+HICON LoadSkinProtoIcon(const char *szProto, int status, bool big)
{
char iconName[MAX_PATH];
INT_PTR caps2;
diff --git a/src/modules/utils/timezones.cpp b/src/modules/utils/timezones.cpp
index 9cbd78c8fb..6f27af74f3 100644
--- a/src/modules/utils/timezones.cpp
+++ b/src/modules/utils/timezones.cpp
@@ -184,7 +184,7 @@ static HANDLE timeapiGetInfoByContact(HANDLE hContact, DWORD dwFlags)
signed char timezone = (signed char)db_get_b(hContact, "UserInfo", "Timezone", -1);
if (timezone == -1)
{
- char* szProto = GetContactProto(hContact);
+ char *szProto = GetContactProto(hContact);
if ( !db_get_ts(hContact, szProto, "TzName", &dbv))
{
HANDLE res = timeapiGetInfoByName(dbv.ptszVal, dwFlags);