From 969e3f67c473c0775512f16a54b677d2430fa2b8 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 31 Mar 2017 16:42:56 +0300 Subject: code cleaning --- src/core/stdmsg/src/chat_manager.cpp | 36 +++++----- src/core/stdmsg/src/chat_options.cpp | 124 ++++++++++++++++---------------- src/core/stdmsg/src/chat_util.cpp | 18 ++--- src/core/stdmsg/src/chat_window.cpp | 13 ++-- src/core/stdmsg/src/cmdlist.cpp | 8 +-- src/core/stdmsg/src/globals.cpp | 68 +++++++++--------- src/core/stdmsg/src/globals.h | 2 +- src/core/stdmsg/src/msgdialog.cpp | 126 ++++++++++++++++---------------- src/core/stdmsg/src/msglog.cpp | 30 ++++---- src/core/stdmsg/src/msgoptions.cpp | 136 +++++++++++++++++------------------ src/core/stdmsg/src/msgs.cpp | 30 ++++---- src/core/stdmsg/src/msgs.h | 2 +- src/core/stdmsg/src/msgtimedout.cpp | 6 +- src/core/stdmsg/src/statusicon.cpp | 10 +-- src/core/stdmsg/src/stdafx.h | 2 +- src/core/stdmsg/src/tabs.cpp | 40 +++++------ 16 files changed, 324 insertions(+), 327 deletions(-) (limited to 'src') diff --git a/src/core/stdmsg/src/chat_manager.cpp b/src/core/stdmsg/src/chat_manager.cpp index 91d002492b..0a35768e03 100644 --- a/src/core/stdmsg/src/chat_manager.cpp +++ b/src/core/stdmsg/src/chat_manager.cpp @@ -59,7 +59,7 @@ SESSION_INFO* SM_GetNextWindow(SESSION_INFO *si) CHAT_MANAGER *pci; -HMENU g_hMenu = NULL; +HMENU g_hMenu = nullptr; BOOL SmileyAddInstalled = FALSE, PopupInstalled = FALSE; HIMAGELIST hIconsList; @@ -82,7 +82,7 @@ static void OnCreateModule(MODULEINFO *mi) static void OnReplaceSession(SESSION_INFO *si) { if (si->pDlg) - RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_SRMM_NICKLIST), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_SRMM_NICKLIST), nullptr, nullptr, RDW_INVALIDATE); } static void OnNewUser(SESSION_INFO *si, USERINFO*) @@ -97,7 +97,7 @@ static void OnFlashHighlight(SESSION_INFO *si, int bInactive) return; if (!g_Settings.bTabsEnable && si->pDlg && g_Settings.bFlashWindowHighlight) - SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, 900, NULL); + SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, 900, nullptr); if (g_Settings.bTabsEnable && si->pDlg) pDialog->SetMessageHighlight(si->pDlg); } @@ -108,7 +108,7 @@ static void OnFlashWindow(SESSION_INFO *si, int bInactive) return; if (!g_Settings.bTabsEnable && si->pDlg && g_Settings.bFlashWindow) - SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, 900, NULL); + SetTimer(si->pDlg->GetHwnd(), TIMERID_FLASHWND, 900, nullptr); if (g_Settings.bTabsEnable && si->pDlg) pDialog->SetTabHighlight(si->pDlg); } @@ -136,18 +136,18 @@ static void OnLoadSettings() LoadMsgDlgFont(MSGFONTID_MESSAGEAREA, &lf, &g_Settings.MessageAreaColor); g_Settings.MessageAreaFont = CreateFontIndirect(&lf); - g_Settings.iX = db_get_dw(NULL, CHAT_MODULE, "roomx", -1); - g_Settings.iY = db_get_dw(NULL, CHAT_MODULE, "roomy", -1); + g_Settings.iX = db_get_dw(0, CHAT_MODULE, "roomx", -1); + g_Settings.iY = db_get_dw(0, CHAT_MODULE, "roomy", -1); - g_Settings.bTabsEnable = db_get_b(NULL, CHAT_MODULE, "Tabs", 1) != 0; - g_Settings.bTabRestore = db_get_b(NULL, CHAT_MODULE, "TabRestore", 0) != 0; - g_Settings.bTabsAtBottom = db_get_b(NULL, CHAT_MODULE, "TabBottom", 0) != 0; - g_Settings.bTabCloseOnDblClick = db_get_b(NULL, CHAT_MODULE, "TabCloseOnDblClick", 0) != 0; + g_Settings.bTabsEnable = db_get_b(0, CHAT_MODULE, "Tabs", 1) != 0; + g_Settings.bTabRestore = db_get_b(0, CHAT_MODULE, "TabRestore", 0) != 0; + g_Settings.bTabsAtBottom = db_get_b(0, CHAT_MODULE, "TabBottom", 0) != 0; + g_Settings.bTabCloseOnDblClick = db_get_b(0, CHAT_MODULE, "TabCloseOnDblClick", 0) != 0; - g_Settings.iSplitterX = db_get_w(NULL, CHAT_MODULE, "SplitterX", 105); + g_Settings.iSplitterX = db_get_w(0, CHAT_MODULE, "SplitterX", 105); if (g_Settings.iSplitterX <= 50) g_Settings.iSplitterX = 105; - g_Settings.iSplitterY = db_get_w(NULL, CHAT_MODULE, "SplitterY", 90); + g_Settings.iSplitterY = db_get_w(0, CHAT_MODULE, "SplitterY", 90); if (g_Settings.iSplitterY <= 65) g_Settings.iSplitterY = 90; } @@ -225,12 +225,12 @@ void Load_ChatModule() void Unload_ChatModule() { - db_set_w(NULL, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX); - db_set_w(NULL, CHAT_MODULE, "SplitterY", (WORD)g_Settings.iSplitterY); - db_set_dw(NULL, CHAT_MODULE, "roomx", g_Settings.iX); - db_set_dw(NULL, CHAT_MODULE, "roomy", g_Settings.iY); - db_set_dw(NULL, CHAT_MODULE, "roomwidth", g_Settings.iWidth); - db_set_dw(NULL, CHAT_MODULE, "roomheight", g_Settings.iHeight); + db_set_w(0, CHAT_MODULE, "SplitterX", (WORD)g_Settings.iSplitterX); + db_set_w(0, CHAT_MODULE, "SplitterY", (WORD)g_Settings.iSplitterY); + db_set_dw(0, CHAT_MODULE, "roomx", g_Settings.iX); + db_set_dw(0, CHAT_MODULE, "roomy", g_Settings.iY); + db_set_dw(0, CHAT_MODULE, "roomwidth", g_Settings.iWidth); + db_set_dw(0, CHAT_MODULE, "roomheight", g_Settings.iHeight); if (g_Settings.MessageAreaFont) DeleteObject(g_Settings.MessageAreaFont); diff --git a/src/core/stdmsg/src/chat_options.cpp b/src/core/stdmsg/src/chat_options.cpp index b5a75b4241..3db5b9b045 100644 --- a/src/core/stdmsg/src/chat_options.cpp +++ b/src/core/stdmsg/src/chat_options.cpp @@ -157,9 +157,9 @@ static void FillBranch(HWND hwndTree, HTREEITEM hParent, struct branch_t *branch tvis.item.pszText = TranslateW(branch[i].szDescr); tvis.item.stateMask = TVIS_STATEIMAGEMASK; if (branch[i].iMode) - iState = ((db_get_dw(NULL, CHAT_MODULE, branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1; + iState = ((db_get_dw(0, CHAT_MODULE, branch[i].szDBName, defaultval)&branch[i].iMode)&branch[i].iMode) != 0 ? 2 : 1; else - iState = db_get_b(NULL, CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0 ? 2 : 1; + iState = db_get_b(0, CHAT_MODULE, branch[i].szDBName, branch[i].bDefault) != 0 ? 2 : 1; tvis.item.state = INDEXTOSTATEIMAGEMASK(iState); branch[i].hItem = TreeView_InsertItem(hwndTree, &tvis); } @@ -180,9 +180,9 @@ static void SaveBranch(HWND hwndTree, struct branch_t *branch, int nValues) iState |= branch[i].iMode; if (iState & GC_EVENT_ADDSTATUS) iState |= GC_EVENT_REMOVESTATUS; - db_set_dw(NULL, CHAT_MODULE, branch[i].szDBName, (DWORD)iState); + db_set_dw(0, CHAT_MODULE, branch[i].szDBName, (DWORD)iState); } - else db_set_b(NULL, CHAT_MODULE, branch[i].szDBName, bChecked); + else db_set_b(0, CHAT_MODULE, branch[i].szDBName, bChecked); } } @@ -316,7 +316,7 @@ HANDLE GetIconHandle(const char *pszIcoLibName) static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefault) { DBVARIANT dbv; - if (!db_get_ws(NULL, CHAT_MODULE, pszSetting, &dbv)) { + if (!db_get_ws(0, CHAT_MODULE, pszSetting, &dbv)) { replaceStrW(*ppPointer, dbv.ptszVal); db_free(&dbv); } @@ -336,14 +336,14 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CHECKBOXES), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); - hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), db_get_b(NULL, CHAT_MODULE, "Branch0Exp", 0) ? TRUE : FALSE); - hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), db_get_b(NULL, CHAT_MODULE, "Branch1Exp", 0) ? TRUE : FALSE); - hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), db_get_b(NULL, CHAT_MODULE, "Branch2Exp", 0) ? TRUE : FALSE); - hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the 'event filter' is enabled"), db_get_b(NULL, CHAT_MODULE, "Branch3Exp", 0) ? TRUE : FALSE); - hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), db_get_b(NULL, CHAT_MODULE, "Branch4Exp", 0) ? TRUE : FALSE); - hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(NULL, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE); + hListHeading0 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Options for using a tabbed interface"), db_get_b(0, CHAT_MODULE, "Branch0Exp", 0) ? TRUE : FALSE); + hListHeading1 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance and functionality of chat room windows"), db_get_b(0, CHAT_MODULE, "Branch1Exp", 0) ? TRUE : FALSE); + hListHeading2 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Appearance of the message log"), db_get_b(0, CHAT_MODULE, "Branch2Exp", 0) ? TRUE : FALSE); + hListHeading3 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Default events to show in new chat rooms if the 'event filter' is enabled"), db_get_b(0, CHAT_MODULE, "Branch3Exp", 0) ? TRUE : FALSE); + hListHeading4 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the message log"), db_get_b(0, CHAT_MODULE, "Branch4Exp", 0) ? TRUE : FALSE); + hListHeading5 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Icons to display in the tray"), db_get_b(0, CHAT_MODULE, "Branch5Exp", 0) ? TRUE : FALSE); if (PopupInstalled) - hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Popups to display"), db_get_b(NULL, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE); + hListHeading6 = InsertBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), LPGEN("Popups to display"), db_get_b(0, CHAT_MODULE, "Branch6Exp", 0) ? TRUE : FALSE); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, branch0, _countof(branch0), 0); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, _countof(branch2), 0); @@ -412,7 +412,7 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - BYTE b = db_get_b(NULL, CHAT_MODULE, "Tabs", 1); + BYTE b = db_get_b(0, CHAT_MODULE, "Tabs", 1); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch0, _countof(branch0)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch1, _countof(branch1)); SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch2, _countof(branch2)); @@ -421,17 +421,17 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch5, _countof(branch5)); if (PopupInstalled) SaveBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), branch6, _countof(branch6)); - g_Settings.dwIconFlags = db_get_dw(NULL, CHAT_MODULE, "IconFlags", 0x0000); - g_Settings.dwTrayIconFlags = db_get_dw(NULL, CHAT_MODULE, "TrayIconFlags", 0x1000); - g_Settings.dwPopupFlags = db_get_dw(NULL, CHAT_MODULE, "PopupFlags", 0x0000); - g_Settings.bStripFormat = db_get_b(NULL, CHAT_MODULE, "TrimFormatting", 0) != 0; - g_Settings.bTrayIconInactiveOnly = db_get_b(NULL, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0; - g_Settings.bPopupInactiveOnly = db_get_b(NULL, CHAT_MODULE, "PopupInactiveOnly", 1) != 0; - g_Settings.bLogIndentEnabled = db_get_b(NULL, CHAT_MODULE, "LogIndentEnabled", 1) != 0; - - if (b != db_get_b(NULL, CHAT_MODULE, "Tabs", 1)) { - pci->SM_BroadcastMessage(NULL, WM_CLOSE, 0, 1, FALSE); - g_Settings.bTabsEnable = db_get_b(NULL, CHAT_MODULE, "Tabs", 1) != 0; + g_Settings.dwIconFlags = db_get_dw(0, CHAT_MODULE, "IconFlags", 0x0000); + g_Settings.dwTrayIconFlags = db_get_dw(0, CHAT_MODULE, "TrayIconFlags", 0x1000); + g_Settings.dwPopupFlags = db_get_dw(0, CHAT_MODULE, "PopupFlags", 0x0000); + g_Settings.bStripFormat = db_get_b(0, CHAT_MODULE, "TrimFormatting", 0) != 0; + g_Settings.bTrayIconInactiveOnly = db_get_b(0, CHAT_MODULE, "TrayIconInactiveOnly", 1) != 0; + g_Settings.bPopupInactiveOnly = db_get_b(0, CHAT_MODULE, "PopupInactiveOnly", 1) != 0; + g_Settings.bLogIndentEnabled = db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0; + + if (b != db_get_b(0, CHAT_MODULE, "Tabs", 1)) { + pci->SM_BroadcastMessage(nullptr, WM_CLOSE, 0, 1, FALSE); + g_Settings.bTabsEnable = db_get_b(0, CHAT_MODULE, "Tabs", 1) != 0; } else Chat_UpdateOptions(); @@ -442,20 +442,20 @@ static INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM case WM_DESTROY: BYTE b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, CHAT_MODULE, "Branch1Exp", b); + db_set_b(0, CHAT_MODULE, "Branch1Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, CHAT_MODULE, "Branch2Exp", b); + db_set_b(0, CHAT_MODULE, "Branch2Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading3, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, CHAT_MODULE, "Branch3Exp", b); + db_set_b(0, CHAT_MODULE, "Branch3Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading4, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, CHAT_MODULE, "Branch4Exp", b); + db_set_b(0, CHAT_MODULE, "Branch4Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading5, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, CHAT_MODULE, "Branch5Exp", b); + db_set_b(0, CHAT_MODULE, "Branch5Exp", b); b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading0, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, CHAT_MODULE, "Branch0Exp", b); + db_set_b(0, CHAT_MODULE, "Branch0Exp", b); if (PopupInstalled) { b = TreeView_GetItemState(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading6, TVIS_EXPANDED)&TVIS_EXPANDED ? 1 : 0; - db_set_b(NULL, CHAT_MODULE, "Branch6Exp", b); + db_set_b(0, CHAT_MODULE, "Branch6Exp", b); } break; } @@ -471,13 +471,13 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0)); - SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LogLimit", 100), 0)); + SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LogLimit", 100), 0)); SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETRANGE, 0, MAKELONG(10000, 0)); - SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100), 0)); + SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LoggingLimit", 100), 0)); SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETRANGE, 0, MAKELONG(255, 10)); - SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12), 0)); + SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12), 0)); { - wchar_t* pszGroup = NULL; + wchar_t* pszGroup = nullptr; InitSetting(&pszGroup, "AddToGroup", L"Chat rooms"); SetDlgItemText(hwndDlg, IDC_GROUP, pszGroup); mir_free(pszGroup); @@ -554,11 +554,11 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, case WM_NOTIFY: if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { - wchar_t * pszText = NULL; + wchar_t * pszText = nullptr; int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_HIGHLIGHTWORDS)); if (iLen > 0) { wchar_t *ptszText = (wchar_t *)mir_alloc((iLen + 2) * sizeof(wchar_t)); - wchar_t *p2 = NULL; + wchar_t *p2 = nullptr; if (ptszText) { GetDlgItemText(hwndDlg, IDC_HIGHLIGHTWORDS, ptszText, iLen + 1); @@ -567,78 +567,78 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, *p2 = ' '; p2 = wcschr(ptszText, ','); } - db_set_ws(NULL, CHAT_MODULE, "HighlightWords", ptszText); + db_set_ws(0, CHAT_MODULE, "HighlightWords", ptszText); mir_free(ptszText); } } - else db_unset(NULL, CHAT_MODULE, "HighlightWords"); + else db_unset(0, CHAT_MODULE, "HighlightWords"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY)); if (iLen > 0) { pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText, iLen + 1); - db_set_ws(NULL, CHAT_MODULE, "LogDirectory", pszText); + db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText); } - else db_unset(NULL, CHAT_MODULE, "LogDirectory"); + else db_unset(0, CHAT_MODULE, "LogDirectory"); pci->SM_InvalidateLogDirectories(); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP)); if (iLen > 0) { pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1); - db_set_ws(NULL, CHAT_MODULE, "LogTimestamp", pszText); + db_set_ws(0, CHAT_MODULE, "LogTimestamp", pszText); } - else db_unset(NULL, CHAT_MODULE, "LogTimestamp"); + else db_unset(0, CHAT_MODULE, "LogTimestamp"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_TIMESTAMP)); if (iLen > 0) { pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1); - db_set_ws(NULL, CHAT_MODULE, "HeaderTime", pszText); + db_set_ws(0, CHAT_MODULE, "HeaderTime", pszText); } - else db_unset(NULL, CHAT_MODULE, "HeaderTime"); + else db_unset(0, CHAT_MODULE, "HeaderTime"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_INSTAMP)); if (iLen > 0) { pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_INSTAMP, pszText, iLen + 1); - db_set_ws(NULL, CHAT_MODULE, "HeaderIncoming", pszText); + db_set_ws(0, CHAT_MODULE, "HeaderIncoming", pszText); } - else db_unset(NULL, CHAT_MODULE, "HeaderIncoming"); + else db_unset(0, CHAT_MODULE, "HeaderIncoming"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_OUTSTAMP)); if (iLen > 0) { pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1); - db_set_ws(NULL, CHAT_MODULE, "HeaderOutgoing", pszText); + db_set_ws(0, CHAT_MODULE, "HeaderOutgoing", pszText); } - else db_unset(NULL, CHAT_MODULE, "HeaderOutgoing"); + else db_unset(0, CHAT_MODULE, "HeaderOutgoing"); g_Settings.bHighlightEnabled = IsDlgButtonChecked(hwndDlg, IDC_HIGHLIGHT) == BST_CHECKED; - db_set_b(NULL, CHAT_MODULE, "HighlightEnabled", g_Settings.bHighlightEnabled); + db_set_b(0, CHAT_MODULE, "HighlightEnabled", g_Settings.bHighlightEnabled); g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED; - db_set_b(NULL, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled); + db_set_b(0, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled); iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN2, UDM_GETPOS, 0, 0); - db_set_w(NULL, CHAT_MODULE, "LogLimit", (WORD)iLen); + db_set_w(0, CHAT_MODULE, "LogLimit", (WORD)iLen); iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN3, UDM_GETPOS, 0, 0); - db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen); + db_set_w(0, CHAT_MODULE, "LoggingLimit", (WORD)iLen); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP)); if (iLen > 0) { pszText = (wchar_t *)mir_realloc(pszText, (iLen + 1) * sizeof(wchar_t)); GetDlgItemText(hwndDlg, IDC_GROUP, pszText, iLen + 1); - db_set_ws(NULL, CHAT_MODULE, "AddToGroup", pszText); + db_set_ws(0, CHAT_MODULE, "AddToGroup", pszText); } - else db_set_s(NULL, CHAT_MODULE, "AddToGroup", ""); + else db_set_s(0, CHAT_MODULE, "AddToGroup", ""); mir_free(pszText); iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN4, UDM_GETPOS, 0, 0); if (iLen > 0) - db_set_b(NULL, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen); + db_set_b(0, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen); else - db_unset(NULL, CHAT_MODULE, "NicklistRowDist"); + db_unset(0, CHAT_MODULE, "NicklistRowDist"); pci->ReloadSettings(); Chat_UpdateOptions(); @@ -705,16 +705,16 @@ static INT_PTR CALLBACK DlgProcOptionsPopup(HWND hwndDlg, UINT uMsg, WPARAM wPar iLen = 1; g_Settings.iPopupStyle = iLen; - db_set_b(NULL, CHAT_MODULE, "PopupStyle", (BYTE)iLen); + db_set_b(0, CHAT_MODULE, "PopupStyle", (BYTE)iLen); iLen = SendDlgItemMessage(hwndDlg, IDC_SPIN1, UDM_GETPOS, 0, 0); g_Settings.iPopupTimeout = iLen; - db_set_w(NULL, CHAT_MODULE, "PopupTimeout", (WORD)iLen); + db_set_w(0, CHAT_MODULE, "PopupTimeout", (WORD)iLen); g_Settings.crPUBkgColour = SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_GETCOLOUR, 0, 0); - db_set_dw(NULL, CHAT_MODULE, "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_GETCOLOUR, 0, 0)); + db_set_dw(0, CHAT_MODULE, "PopupColorBG", (DWORD)SendDlgItemMessage(hwndDlg, IDC_BKG, CPM_GETCOLOUR, 0, 0)); g_Settings.crPUTextColour = SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_GETCOLOUR, 0, 0); - db_set_dw(NULL, CHAT_MODULE, "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_GETCOLOUR, 0, 0)); + db_set_dw(0, CHAT_MODULE, "PopupColorText", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TEXT, CPM_GETCOLOUR, 0, 0)); return TRUE; } break; @@ -746,7 +746,7 @@ int ChatOptionsInitialize(WPARAM wParam) odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP); odp.szTitle.a = LPGEN("Chat"); odp.szGroup.a = LPGEN("Popups"); - odp.szTab.a = NULL; + odp.szTab.a = nullptr; odp.pfnDlgProc = DlgProcOptionsPopup; Options_AddPage(wParam, &odp); } diff --git a/src/core/stdmsg/src/chat_util.cpp b/src/core/stdmsg/src/chat_util.cpp index 5dff47b878..1a7182b490 100644 --- a/src/core/stdmsg/src/chat_util.cpp +++ b/src/core/stdmsg/src/chat_util.cpp @@ -69,10 +69,10 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw) //get the number of pixels per logical inch if (bRedraw) { - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); m_log.SendMsg(WM_SETREDRAW, FALSE, 0); bFlag = TRUE; } @@ -94,7 +94,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw) sm.cbSize = sizeof(sm); sm.hwndRichEditControl = m_log.GetHwnd(); sm.Protocolname = m_si->pszModule; - sm.rangeToReplace = bRedraw ? NULL : &newsel; + sm.rangeToReplace = bRedraw ? nullptr : &newsel; sm.disableRedraw = TRUE; sm.hContact = m_si->hContact; CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm); @@ -110,7 +110,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw) if (oldsel.cpMax != oldsel.cpMin) { m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&oldsel); m_log.SendMsg(WM_SETREDRAW, TRUE, 0); - InvalidateRect(m_log.GetHwnd(), NULL, TRUE); + InvalidateRect(m_log.GetHwnd(), nullptr, TRUE); } // need to invalidate the window @@ -118,7 +118,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw) sel.cpMin = sel.cpMax = GetRichTextLength(m_log.GetHwnd()); m_log.SendMsg(EM_EXSETSEL, 0, (LPARAM)&sel); m_log.SendMsg(WM_SETREDRAW, TRUE, 0); - InvalidateRect(m_log.GetHwnd(), NULL, TRUE); + InvalidateRect(m_log.GetHwnd(), nullptr, TRUE); } } @@ -127,9 +127,9 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, bool bRedraw) char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si) { if (hwndDlg == 0 || si == 0) - return NULL; + return nullptr; - char* pszText = NULL; + char* pszText = nullptr; EDITSTREAM stream; memset(&stream, 0, sizeof(stream)); stream.pfnCallback = Srmm_MessageStreamCallback; @@ -176,7 +176,7 @@ void CheckColorsInModule(const char* pszModule) if (!pMod) return; - COLORREF crBG = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)); + COLORREF crBG = (COLORREF)db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)); for (int i = 0; i < pMod->nColorCount; i++) { if (pMod->crColors[i] == g_Settings.MessageAreaColor || pMod->crColors[i] == crBG) { if (pMod->crColors[i] == RGB(255, 255, 255)) @@ -211,6 +211,6 @@ int RestoreWindowPosition(HWND hwnd, MCONTACT hContact, bool bHide) DWORD dwFlags = SWP_NOACTIVATE | SWP_NOZORDER; if (bHide) dwFlags |= SWP_HIDEWINDOW; - SetWindowPos(hwnd, NULL, x, y, width, height, dwFlags); + SetWindowPos(hwnd, nullptr, x, y, width, height, dwFlags); return 1; } diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 5ba99792bb..98d7edab7f 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -591,7 +591,7 @@ INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wPa break; } - return(FALSE); + return FALSE; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -615,13 +615,11 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_CHAR: + if (GetWindowLongPtr(m_message.GetHwnd(), GWL_STYLE) & ES_READONLY) + break; { BOOL isCtrl = GetKeyState(VK_CONTROL) & 0x8000; BOOL isAlt = GetKeyState(VK_MENU) & 0x8000; - - if (GetWindowLongPtr(m_message.GetHwnd(), GWL_STYLE) & ES_READONLY) - break; - if (wParam == 9 && isCtrl && !isAlt) // ctrl-i (italics) return TRUE; @@ -844,8 +842,8 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) return TRUE; } } - // fall through + case WM_LBUTTONDOWN: case WM_MBUTTONDOWN: case WM_KILLFOCUS: @@ -923,10 +921,9 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) LRESULT CChatRoomDlg::WndProc_Log(UINT msg, WPARAM wParam, LPARAM lParam) { - CHARRANGE sel; - switch (msg) { case WM_LBUTTONUP: + CHARRANGE sel; m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { m_log.SendMsg(WM_COPY, 0, 0); diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp index 9c615e3271..28d06b9517 100644 --- a/src/core/stdmsg/src/cmdlist.cpp +++ b/src/core/stdmsg/src/cmdlist.cpp @@ -56,7 +56,7 @@ void msgQueue_add(MCONTACT hContact, int id, char *szMsg, int flags) mir_cslock lck(csMsgQueue); if (!msgQueue.getCount() && !timerId) - timerId = SetTimer(NULL, 0, 5000, MsgTimer); + timerId = SetTimer(nullptr, 0, 5000, MsgTimer); msgQueue.insert(item); } @@ -71,20 +71,20 @@ TMsgQueue* msgQueue_find(MCONTACT hContact, int id) msgQueue.remove(i); if (!msgQueue.getCount() && timerId) { - KillTimer(NULL, timerId); + KillTimer(nullptr, timerId); timerId = 0; } return item; } } - return NULL; + return nullptr; } void msgQueue_processack(MCONTACT hContact, int id, BOOL success, const char *szErr) { TMsgQueue *p = msgQueue_find(hContact, id); - if (p == NULL) + if (p == nullptr) return; if (!success) { diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 5b2ec570f5..73a5562008 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -59,7 +59,7 @@ static int OnMetaChanged(WPARAM hMeta, LPARAM) { if (hMeta) { HWND hwnd = WindowList_Find(pci->hWindowList, hMeta); - if (hwnd != NULL) + if (hwnd != nullptr) SendMessage(hwnd, DM_GETAVATAR, 0, 0); } return 0; @@ -74,7 +74,7 @@ static int dbaddedevent(WPARAM hContact, LPARAM hDbEvent) MCONTACT hEventContact = db_event_getContact(hDbEvent); if (hEventContact != hContact) - if ((h = WindowList_Find(pci->hWindowList, hEventContact)) != NULL) + if ((h = WindowList_Find(pci->hWindowList, hEventContact)) != nullptr) SendMessage(h, HM_DBEVENTADDED, hEventContact, hDbEvent); } return 0; @@ -105,38 +105,38 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) void ReloadGlobals() { memset(&g_dat, 0, sizeof(g_dat)); - g_dat.bShowDate = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE) != 0; - g_dat.bShowTime = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME) != 0; - g_dat.bShowSecs = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSECS, SRMSGDEFSET_SHOWSECS) != 0; - g_dat.bShowIcons = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS) != 0; - g_dat.bShowAvatar = db_get_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE) != 0; - g_dat.bShowButtons = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE) != 0; - g_dat.bShowTyping = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING) != 0; - g_dat.bShowTypingWin = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN) != 0; - g_dat.bShowTypingTray = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN) != 0; - g_dat.bShowTypingClist = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) != 0; - - g_dat.bCascade = db_get_b(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE) != 0; - g_dat.bAutoMin = db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN) != 0; - g_dat.bAutoClose = db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE) != 0; - g_dat.bHideNames = db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES) != 0; - g_dat.bShowFormat = db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWFORMAT, SRMSGDEFSET_SHOWFORMAT) != 0; - g_dat.bSendButton = db_get_b(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, SRMSGDEFSET_SENDBUTTON) != 0; - g_dat.bSendOnEnter = db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER) != 0; - g_dat.bCtrlSupport = db_get_b(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, SRMSGDEFSET_CTRLSUPPORT) != 0; - g_dat.bShowReadChar = db_get_b(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, SRMSGDEFSET_CHARCOUNT) != 0; - g_dat.bSendOnDblEnter = db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER) != 0; - g_dat.bTypingUnknown = db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN) != 0; - g_dat.bDeleteTempCont = db_get_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP) != 0; - g_dat.bSavePerContact = db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT) != 0; - g_dat.bUseStatusWinIcon = db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON) != 0; - g_dat.bDoNotStealFocus = db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS) != 0; - - g_dat.openFlags = db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS); - g_dat.nFlashMax = db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT); - g_dat.iGap = db_get_b(NULL, SRMSGMOD, SRMSGSET_BUTTONGAP, SRMSGDEFSET_BUTTONGAP); - - g_dat.msgTimeout = db_get_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT); + g_dat.bShowDate = db_get_b(0, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE) != 0; + g_dat.bShowTime = db_get_b(0, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME) != 0; + g_dat.bShowSecs = db_get_b(0, SRMMMOD, SRMSGSET_SHOWSECS, SRMSGDEFSET_SHOWSECS) != 0; + g_dat.bShowIcons = db_get_b(0, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS) != 0; + g_dat.bShowAvatar = db_get_b(0, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE) != 0; + g_dat.bShowButtons = db_get_b(0, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE) != 0; + g_dat.bShowTyping = db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING) != 0; + g_dat.bShowTypingWin = db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN) != 0; + g_dat.bShowTypingTray = db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN) != 0; + g_dat.bShowTypingClist = db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) != 0; + + g_dat.bCascade = db_get_b(0, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE) != 0; + g_dat.bAutoMin = db_get_b(0, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN) != 0; + g_dat.bAutoClose = db_get_b(0, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE) != 0; + g_dat.bHideNames = db_get_b(0, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES) != 0; + g_dat.bShowFormat = db_get_b(0, SRMMMOD, SRMSGSET_SHOWFORMAT, SRMSGDEFSET_SHOWFORMAT) != 0; + g_dat.bSendButton = db_get_b(0, SRMMMOD, SRMSGSET_SENDBUTTON, SRMSGDEFSET_SENDBUTTON) != 0; + g_dat.bSendOnEnter = db_get_b(0, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER) != 0; + g_dat.bCtrlSupport = db_get_b(0, SRMMMOD, SRMSGSET_CTRLSUPPORT, SRMSGDEFSET_CTRLSUPPORT) != 0; + g_dat.bShowReadChar = db_get_b(0, SRMMMOD, SRMSGSET_CHARCOUNT, SRMSGDEFSET_CHARCOUNT) != 0; + g_dat.bSendOnDblEnter = db_get_b(0, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER) != 0; + g_dat.bTypingUnknown = db_get_b(0, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN) != 0; + g_dat.bDeleteTempCont = db_get_b(0, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP) != 0; + g_dat.bSavePerContact = db_get_b(0, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT) != 0; + g_dat.bUseStatusWinIcon = db_get_b(0, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON) != 0; + g_dat.bDoNotStealFocus = db_get_b(0, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS) != 0; + + g_dat.openFlags = db_get_dw(0, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS); + g_dat.nFlashMax = db_get_b(0, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT); + g_dat.iGap = db_get_b(0, SRMSGMOD, SRMSGSET_BUTTONGAP, SRMSGDEFSET_BUTTONGAP); + + g_dat.msgTimeout = db_get_dw(0, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT); if (g_dat.msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) g_dat.msgTimeout = SRMSGDEFSET_MSGTIMEOUT; } diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index bfa7635e2f..fb92e0beb7 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -65,7 +65,7 @@ extern GlobalMessageData g_dat; struct CREOleCallback : public IRichEditOleCallback { - CREOleCallback() : refCount(0), nextStgId(0), pictStg(NULL) {} + CREOleCallback() : refCount(0), nextStgId(0), pictStg(nullptr) {} unsigned refCount; IStorage *pictStg; int nextStgId; diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 689916ccfb..b152f7b86e 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -50,8 +50,8 @@ static int RTL_Detect(const wchar_t *ptszText) int SendMessageDirect(const wchar_t *szMsg, MCONTACT hContact) { - if (hContact == NULL) - return NULL; + if (hContact == 0) + return 0; int flags = 0; if (RTL_Detect(szMsg)) @@ -59,7 +59,7 @@ int SendMessageDirect(const wchar_t *szMsg, MCONTACT hContact) T2Utf sendBuffer(szMsg); if (!mir_strlen(sendBuffer)) - return NULL; + return 0; if (db_mc_isMeta(hContact)) hContact = db_mc_getSrmmSub(hContact); @@ -72,7 +72,7 @@ int SendMessageDirect(const wchar_t *szMsg, MCONTACT hContact) static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* szFilename) { *pppFiles = (wchar_t**)mir_realloc(*pppFiles, (++*totalCount + 1)*sizeof(wchar_t*)); - (*pppFiles)[*totalCount] = NULL; + (*pppFiles)[*totalCount] = nullptr; (*pppFiles)[*totalCount - 1] = mir_wstrdup(szFilename); if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) { @@ -137,17 +137,17 @@ void CSrmmWindow::OnInitDialog() m_szProto = GetContactProto(m_hContact); // avatar stuff - m_limitAvatarH = db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT) ? db_get_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT) : 0; + m_limitAvatarH = db_get_b(0, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT) ? db_get_dw(0, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT) : 0; - if (m_hContact && m_szProto != NULL) + if (m_hContact && m_szProto != nullptr) m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE); else m_wStatus = ID_STATUS_OFFLINE; m_wOldStatus = m_wStatus; - m_splitterPos = (int)db_get_dw(g_dat.bSavePerContact ? m_hContact : NULL, SRMMMOD, "splitterPos", (DWORD)-1); + m_splitterPos = (int)db_get_dw(g_dat.bSavePerContact ? m_hContact : 0, SRMMMOD, "splitterPos", (DWORD)-1); m_cmdListInd = -1; m_nTypeMode = PROTOTYPE_SELFTYPING_OFF; - SetTimer(m_hwnd, TIMERID_TYPE, 1000, NULL); + SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr); RECT rc; GetWindowRect(GetDlgItem(m_hwnd, IDC_SPLITTERY), &rc); @@ -162,7 +162,7 @@ void CSrmmWindow::OnInitDialog() WindowList_Add(pci->hWindowList, m_hwnd, m_hContact); GetWindowRect(m_message.GetHwnd(), &m_minEditInit); SendMessage(m_hwnd, DM_UPDATESIZEBAR, 0, 0); - m_hwndStatus = NULL; + m_hwndStatus = nullptr; EnableWindow(GetDlgItem(m_hwnd, IDC_AVATAR), FALSE); @@ -180,18 +180,18 @@ void CSrmmWindow::OnInitDialog() } if (m_hContact) { - int historyMode = db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY); + int historyMode = db_get_b(0, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY); // This finds the first message to display, it works like shit m_hDbEventFirst = db_event_firstUnread(m_hContact); switch (historyMode) { case LOADHISTORY_COUNT: - for (int i = db_get_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i--;) { + for (int i = db_get_w(0, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); i--;) { MEVENT hPrevEvent; - if (m_hDbEventFirst == NULL) + if (m_hDbEventFirst == 0) hPrevEvent = db_event_last(m_hContact); else hPrevEvent = db_event_prev(m_hContact, m_hDbEventFirst); - if (hPrevEvent == NULL) + if (hPrevEvent == 0) break; DBEVENTINFO dbei = {}; @@ -204,19 +204,19 @@ void CSrmmWindow::OnInitDialog() case LOADHISTORY_TIME: DBEVENTINFO dbei = {}; - if (m_hDbEventFirst == NULL) - dbei.timestamp = (DWORD)time(NULL); + if (m_hDbEventFirst == 0) + dbei.timestamp = (DWORD)time(nullptr); else db_event_get(m_hDbEventFirst, &dbei); - DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); + DWORD firstTime = dbei.timestamp - 60 * db_get_w(0, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); for (;;) { MEVENT hPrevEvent; - if (m_hDbEventFirst == NULL) + if (m_hDbEventFirst == 0) hPrevEvent = db_event_last(m_hContact); else hPrevEvent = db_event_prev(m_hContact, m_hDbEventFirst); - if (hPrevEvent == NULL) + if (hPrevEvent == 0) break; dbei.cbBlob = 0; @@ -260,9 +260,9 @@ void CSrmmWindow::OnInitDialog() m_message.SendMsg(EM_SETEVENTMASK, 0, ENM_CHANGE); int flag = m_bNoActivate ? RWPF_HIDDEN : 0; - if (Utils_RestoreWindowPosition(m_hwnd, g_dat.bSavePerContact ? m_hContact : NULL, SRMMMOD, "", flag)) { + if (Utils_RestoreWindowPosition(m_hwnd, g_dat.bSavePerContact ? m_hContact : 0, SRMMMOD, "", flag)) { if (g_dat.bSavePerContact) { - if (Utils_RestoreWindowPosition(m_hwnd, NULL, SRMMMOD, "", flag | RWPF_NOMOVE)) + if (Utils_RestoreWindowPosition(m_hwnd, 0, SRMMMOD, "", flag | RWPF_NOMOVE)) SetWindowPos(m_hwnd, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); } else SetWindowPos(m_hwnd, 0, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW); @@ -273,7 +273,7 @@ void CSrmmWindow::OnInitDialog() if (m_bNoActivate) { SetWindowPos(m_hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE | SWP_SHOWWINDOW); - SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); + SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr); } else { SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW); @@ -313,12 +313,12 @@ void CSrmmWindow::OnDestroy() WindowList_Remove(pci->hWindowList, m_hwnd); - MCONTACT hContact = (g_dat.bSavePerContact) ? m_hContact : NULL; - db_set_dw(hContact ? m_hContact : NULL, SRMMMOD, "splitterPos", m_splitterPos); + MCONTACT hContact = (g_dat.bSavePerContact) ? m_hContact : 0; + db_set_dw(hContact ? m_hContact : 0, SRMMMOD, "splitterPos", m_splitterPos); if (m_hFont) { DeleteObject(m_hFont); - m_hFont = NULL; + m_hFont = nullptr; } WINDOWPLACEMENT wp = { sizeof(wp) }; @@ -378,7 +378,7 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); - if (hwndButton == NULL) + if (hwndButton == nullptr) continue; bool bShow = false; @@ -394,7 +394,7 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) if (!m_hwndStatus) { int grip = (GetWindowLongPtr(m_hwnd, GWL_STYLE) & WS_THICKFRAME) ? SBARS_SIZEGRIP : 0; - m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | grip, 0, 0, 0, 0, m_hwnd, NULL, g_hInst, NULL); + m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, nullptr, WS_CHILD | WS_VISIBLE | grip, 0, 0, 0, 0, m_hwnd, nullptr, g_hInst, nullptr); SendMessage(m_hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0); } @@ -402,7 +402,7 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) m_splitter.Show(); m_btnOk.Show(g_dat.bSendButton); m_btnOk.Enable(GetWindowTextLength(m_message.GetHwnd()) != 0); - if (m_avatarPic == NULL || !g_dat.bShowAvatar) + if (m_avatarPic == nullptr || !g_dat.bShowAvatar) ShowWindow(GetDlgItem(m_hwnd, IDC_AVATAR), SW_HIDE); SendMessage(m_hwnd, DM_UPDATETITLE, 0, 0); SendMessage(m_hwnd, WM_SIZE, 0, 0); @@ -410,22 +410,22 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) if (m_hBkgBrush) DeleteObject(m_hBkgBrush); - COLORREF colour = db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR); + COLORREF colour = db_get_dw(0, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR); m_hBkgBrush = CreateSolidBrush(colour); m_log.SendMsg(EM_SETBKGNDCOLOR, 0, colour); m_message.SendMsg(EM_SETBKGNDCOLOR, 0, colour); // avatar stuff - m_avatarPic = NULL; + m_avatarPic = nullptr; m_limitAvatarH = 0; if (CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_AVATARS) - m_limitAvatarH = db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT) ? - db_get_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT) : 0; + m_limitAvatarH = db_get_b(0, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT) ? + db_get_dw(0, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT) : 0; if (bUpdateAvatar) SendMessage(m_hwnd, DM_GETAVATAR, 0, 0); - InvalidateRect(m_message.GetHwnd(), NULL, FALSE); + InvalidateRect(m_message.GetHwnd(), nullptr, FALSE); LOGFONT lf; CHARFORMAT cf = {}; @@ -481,7 +481,7 @@ void CSrmmWindow::NotifyTyping(int mode) // Don't send to protocols that are offline // Don't send to users who are not visible and // Don't send to users who are not on the visible list when you are in invisible mode. - if (!db_get_b(m_hContact, SRMMMOD, SRMSGSET_TYPING, db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) + if (!db_get_b(m_hContact, SRMMMOD, SRMSGSET_TYPING, db_get_b(0, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) return; if (!m_szProto) @@ -518,9 +518,9 @@ void CSrmmWindow::ShowAvatar() if (ace && (INT_PTR)ace != CALLSERVICE_NOTFOUND && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST)) m_avatarPic = ace->hbmPic; else - m_avatarPic = NULL; + m_avatarPic = nullptr; } - else m_avatarPic = NULL; + else m_avatarPic = nullptr; SendMessage(m_hwnd, DM_UPDATESIZEBAR, 0, 0); SendMessage(m_hwnd, DM_AVATARSIZECHANGE, 0, 0); @@ -570,8 +570,8 @@ void CSrmmWindow::SetupStatusBar() void CSrmmWindow::SetStatusData(StatusTextData *st) { - SendMessage(m_hwndStatus, SB_SETICON, 0, (LPARAM)(st == NULL ? 0 : st->hIcon)); - SendMessage(m_hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == NULL ? L"" : st->tszText)); + SendMessage(m_hwndStatus, SB_SETICON, 0, (LPARAM)(st == nullptr ? 0 : st->hIcon)); + SendMessage(m_hwndStatus, SB_SETTEXT, 0, (LPARAM)(st == nullptr ? L"" : st->tszText)); } void CSrmmWindow::UpdateReadChars() @@ -768,8 +768,8 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) // Someone added items? if (GetMenuItemCount(mwpd.hMenu) > 0) { - SetCursor(LoadCursor(NULL, IDC_ARROW)); - mwpd.selection = TrackPopupMenu(mwpd.hMenu, TPM_RETURNCMD, mwpd.pt.x, mwpd.pt.y, 0, m_message.GetHwnd(), NULL); + SetCursor(LoadCursor(nullptr, IDC_ARROW)); + mwpd.selection = TrackPopupMenu(mwpd.hMenu, TPM_RETURNCMD, mwpd.pt.x, mwpd.pt.y, 0, m_message.GetHwnd(), nullptr); } // Second notification @@ -856,20 +856,20 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; HMENU hMenu = Menu_BuildContactMenu(m_hContact); - TrackPopupMenu(hMenu, 0, pt2.x, pt2.y, 0, m_hwnd, NULL); + TrackPopupMenu(hMenu, 0, pt2.x, pt2.y, 0, m_hwnd, nullptr); DestroyMenu(hMenu); } break; case WM_DROPFILES: // Mod from tabsrmm - if (m_szProto == NULL) break; - if (!(CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break; + if (m_szProto == nullptr) break; + if (!(CallProtoService(m_szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_FILESEND)) break; if (m_wStatus == ID_STATUS_OFFLINE) break; - if (m_hContact != NULL) { + if (m_hContact != 0) { wchar_t szFilename[MAX_PATH]; HDROP hDrop = (HDROP)wParam; - int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i; - wchar_t **ppFiles = NULL; + int fileCount = DragQueryFile(hDrop, -1, nullptr, 0), totalCount = 0, i; + wchar_t **ppFiles = nullptr; for (i = 0; i < fileCount; i++) { DragQueryFile(hDrop, i, szFilename, _countof(szFilename)); AddToFileList(&ppFiles, &totalCount, szFilename); @@ -886,7 +886,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case DM_AVATARCALCSIZE: - if (m_avatarPic == NULL || !g_dat.bShowAvatar) { + if (m_avatarPic == nullptr || !g_dat.bShowAvatar) { m_avatarWidth = 50; m_avatarHeight = 50; ShowWindow(GetDlgItem(m_hwnd, IDC_AVATAR), SW_HIDE); @@ -954,7 +954,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case DM_USERNAMETOCLIP: if (m_hContact) { ptrW id(Contact_GetInfo(CNF_UNIQUEID, m_hContact, m_szProto)); - if (id != NULL && OpenClipboard(m_hwnd)) { + if (id != nullptr && OpenClipboard(m_hwnd)) { EmptyClipboard(); HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(id) * sizeof(wchar_t) + 1); mir_wstrcpy((wchar_t*)GlobalLock(hData), id); @@ -971,8 +971,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_lastMessage) { wchar_t date[64], time[64], fmt[128]; - TimeZone_PrintTimeStamp(NULL, m_lastMessage, L"d", date, _countof(date), 0); - TimeZone_PrintTimeStamp(NULL, m_lastMessage, L"t", time, _countof(time), 0); + TimeZone_PrintTimeStamp(nullptr, m_lastMessage, L"d", date, _countof(date), 0); + TimeZone_PrintTimeStamp(nullptr, m_lastMessage, L"t", time, _countof(time), 0); mir_snwprintf(fmt, TranslateT("Last message received on %s at %s."), date, time); SendMessage(m_hwndStatus, SB_SETTEXT, 0, (LPARAM)fmt); } @@ -991,7 +991,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_wStatus = db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE); wchar_t *contactName = pcli->pfnGetContactDisplayName(m_hContact, 0); - wchar_t *szStatus = pcli->pfnGetStatusModeDescription(m_szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE), 0); + wchar_t *szStatus = pcli->pfnGetStatusModeDescription(m_szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(m_hContact, m_szProto, "Status", ID_STATUS_OFFLINE), 0); if (g_dat.bUseStatusWinIcon) mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session")); else @@ -1095,12 +1095,12 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) // The statusbar sometimes draws over these 2 controls so // redraw them if (m_hwndStatus) { - RedrawWindow(GetDlgItem(m_hwnd, IDOK), NULL, NULL, RDW_INVALIDATE); - RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(m_hwnd, IDOK), nullptr, nullptr, RDW_INVALIDATE); + RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); } if (g_dat.bShowAvatar && m_avatarPic) - RedrawWindow(GetDlgItem(m_hwnd, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(m_hwnd, IDC_AVATAR), nullptr, nullptr, RDW_INVALIDATE); if (bottomScroll) PostMessage(m_hwnd, DM_SCROLLLOGTOBOTTOM, 0, 0); @@ -1131,7 +1131,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case HM_DBEVENTADDED: if (wParam == m_hContact) { MEVENT hDbEvent = lParam; - if (m_hDbEventFirst == NULL) + if (m_hDbEventFirst == 0) m_hDbEventFirst = hDbEvent; DBEVENTINFO dbei = {}; @@ -1149,7 +1149,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_lastMessage = dbei.timestamp; SendMessage(m_hwnd, DM_UPDATELASTMESSAGE, 0, 0); } - if (hDbEvent != m_hDbEventFirst && db_event_next(m_hContact, hDbEvent) == NULL) + if (hDbEvent != m_hDbEventFirst && db_event_next(m_hContact, hDbEvent) == 0) SendMessage(m_hwnd, DM_APPENDTOLOG, lParam, 0); else SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); @@ -1163,10 +1163,10 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS; GetScrollInfo(m_log.GetHwnd(), SB_VERT, &si); if ((si.nPos + (int)si.nPage + 5) < si.nMax) - SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); + SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr); } } - else SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); + else SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr); } } } @@ -1278,7 +1278,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) else { HMENU hMenu = Menu_BuildContactMenu(m_hContact); GetWindowRect(GetDlgItem(m_hwnd, LOWORD(wParam)), &rc); - TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, m_hwnd, NULL); + TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, m_hwnd, nullptr); DestroyMenu(hMenu); } break; @@ -1337,7 +1337,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) switch (((MSGFILTER *)lParam)->msg) { case WM_LBUTTONDOWN: hCur = GetCursor(); - if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) { + if (hCur == LoadCursor(nullptr, IDC_SIZENS) || hCur == LoadCursor(nullptr, IDC_SIZEWE) || hCur == LoadCursor(nullptr, IDC_SIZENESW) || hCur == LoadCursor(nullptr, IDC_SIZENWSE)) { SetWindowLongPtr(m_hwnd, DWLP_MSGRESULT, TRUE); return TRUE; } @@ -1345,8 +1345,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: hCur = GetCursor(); - if (hCur == LoadCursor(NULL, IDC_SIZENS) || hCur == LoadCursor(NULL, IDC_SIZEWE) || hCur == LoadCursor(NULL, IDC_SIZENESW) || hCur == LoadCursor(NULL, IDC_SIZENWSE)) - SetCursor(LoadCursor(NULL, IDC_ARROW)); + if (hCur == LoadCursor(nullptr, IDC_SIZENS) || hCur == LoadCursor(nullptr, IDC_SIZEWE) || hCur == LoadCursor(nullptr, IDC_SIZENESW) || hCur == LoadCursor(nullptr, IDC_SIZENWSE)) + SetCursor(LoadCursor(nullptr, IDC_ARROW)); break; case WM_RBUTTONUP: @@ -1362,7 +1362,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) POINT pt = { GET_X_LPARAM(pLink->lParam), GET_Y_LPARAM(pLink->lParam) }; ClientToScreen(pLink->nmhdr.hwndFrom, &pt); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr)) { case IDM_COPY: SendMessage(pLink->nmhdr.hwndFrom, WM_COPY, 0, 0); break; @@ -1376,7 +1376,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; case IDM_CLEAR: ClearLog(); - m_hDbEventFirst = NULL; + m_hDbEventFirst = 0; break; } DestroyMenu(hSubMenu); diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 8db9ac92a7..a2250afaad 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -63,7 +63,7 @@ static void AppendPlainUnicode(CMStringA &buf, const wchar_t *str) static void AppendToBufferWithRTF(CMStringA &buf, const wchar_t *line) { - if (line == NULL) + if (line == nullptr) return; buf.Append("{\\uc1 "); @@ -148,22 +148,22 @@ static void AppendToBufferWithRTF(CMStringA &buf, const wchar_t *line) static void CreateRTFHeader(CMStringA &buffer) { - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); buffer.Append("{\\rtf1\\ansi\\deff0{\\fonttbl"); LOGFONT lf; - for (int i = 0; LoadMsgDlgFont(i, &lf, NULL); i++) + for (int i = 0; LoadMsgDlgFont(i, &lf, nullptr); i++) buffer.AppendFormat(FONT_FORMAT, i, lf.lfCharSet, lf.lfFaceName); buffer.Append("}{\\colortbl "); COLORREF colour; - for (int i = 0; LoadMsgDlgFont(i, NULL, &colour); i++) + for (int i = 0; LoadMsgDlgFont(i, nullptr, &colour); i++) buffer.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour)); - if (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) + if (GetSysColorBrush(COLOR_HOTLIGHT) == nullptr) colour = RGB(0, 0, 255); else colour = GetSysColor(COLOR_HOTLIGHT); @@ -181,7 +181,7 @@ static void CreateRTFTail(CMStringA &buffer) static void SetToStyle(int style, CMStringA &dest) { LOGFONT lf; - LoadMsgDlgFont(style, &lf, NULL); + LoadMsgDlgFont(style, &lf, nullptr); if (style != MSGFONTID_MYCOLON && style != MSGFONTID_YOURCOLON) dest.AppendChar(' '); dest.AppendFormat("\\f%u\\cf%u\\b%d\\i%d\\fs%u ", style, style, lf.lfWeight >= FW_BOLD ? 1 : 0, lf.lfItalic, 2 * abs(lf.lfHeight) * 74 / logPixelSY); @@ -258,7 +258,7 @@ static bool CreateRTFFromDbEvent(LogStreamData *dat) else szFormat = g_dat.bShowDate ? L"d t" : L"t"; - TimeZone_PrintTimeStamp(NULL, dbei.timestamp, szFormat, str, _countof(str), 0); + TimeZone_PrintTimeStamp(nullptr, dbei.timestamp, szFormat, str, _countof(str), 0); SetToStyle((dbei.flags & DBEF_SENT) ? MSGFONTID_MYTIME : MSGFONTID_YOURTIME, buf); AppendToBufferWithRTF(buf, str); @@ -269,7 +269,7 @@ static bool CreateRTFFromDbEvent(LogStreamData *dat) wchar_t *szName; if (dbei.flags & DBEF_SENT) { - if (wchar_t *p = Contact_GetInfo(CNF_DISPLAY, NULL, dbei.szModule)) + if (wchar_t *p = Contact_GetInfo(CNF_DISPLAY, 0, dbei.szModule)) szName = NEWWSTR_ALLOCA(p); else szName = TranslateT("Me"); @@ -289,7 +289,7 @@ static bool CreateRTFFromDbEvent(LogStreamData *dat) case EVENTTYPE_JABBER_CHATSTATES: case EVENTTYPE_JABBER_PRESENCE: if (dbei.flags & DBEF_SENT) { - if (wchar_t *p = Contact_GetInfo(CNF_DISPLAY, NULL, dbei.szModule)) { + if (wchar_t *p = Contact_GetInfo(CNF_DISPLAY, 0, dbei.szModule)) { szName = NEWWSTR_ALLOCA(p); mir_free(p); } @@ -448,7 +448,7 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend) m_log.SendMsg(WM_SETREDRAW, TRUE, 0); if (bottomScroll) - RedrawWindow(m_log.GetHwnd(), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(m_log.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); m_hDbEventLast = streamData.hDbEventLast; } @@ -456,7 +456,7 @@ void CSrmmWindow::StreamInEvents(MEVENT hDbEventFirst, int count, bool bAppend) #define RTFPICTHEADERMAXSIZE 78 void LoadMsgLogIcons(void) { - HBRUSH hBkgBrush = CreateSolidBrush(db_get_dw(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); + HBRUSH hBkgBrush = CreateSolidBrush(db_get_dw(0, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); BITMAPINFOHEADER bih = { sizeof(bih) }; bih.biBitCount = 24; @@ -471,7 +471,7 @@ void LoadMsgLogIcons(void) rc.right = bih.biWidth; rc.bottom = bih.biHeight; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); HBITMAP hBmp = CreateCompatibleBitmap(hdc, bih.biWidth, bih.biHeight); HDC hdcMem = CreateCompatibleDC(hdc); PBYTE pBmpBits = (PBYTE)mir_alloc(widthBytes * bih.biHeight); @@ -483,7 +483,7 @@ void LoadMsgLogIcons(void) size_t rtfHeaderSize = mir_snprintf(pLogIconBmpBits[i], size, "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, bih.biWidth, bih.biHeight); HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp); FillRect(hdcMem, &rc, hBkgBrush); - DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL); + DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(hIcon); SelectObject(hdcMem, hoBmp); @@ -497,7 +497,7 @@ void LoadMsgLogIcons(void) mir_free(pBmpBits); DeleteDC(hdcMem); DeleteObject(hBmp); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); DeleteObject(hBkgBrush); } diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 75467c6d18..8dfeb617a8 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -62,16 +62,16 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) if (colour) { mir_snprintf(str, "SRMFont%dCol", i); - *colour = db_get_dw(NULL, SRMMMOD, str, fontOptionsList[i].defColour); + *colour = db_get_dw(0, SRMMMOD, str, fontOptionsList[i].defColour); } if (lf) { mir_snprintf(str, "SRMFont%dSize", i); - lf->lfHeight = (char)db_get_b(NULL, SRMMMOD, str, fontOptionsList[i].defSize); + lf->lfHeight = (char)db_get_b(0, SRMMMOD, str, fontOptionsList[i].defSize); lf->lfWidth = 0; lf->lfEscapement = 0; lf->lfOrientation = 0; mir_snprintf(str, "SRMFont%dSty", i); - int style = db_get_b(NULL, SRMMMOD, str, fontOptionsList[i].defStyle); + int style = db_get_b(0, SRMMMOD, str, fontOptionsList[i].defStyle); lf->lfWeight = style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL; lf->lfItalic = style & DBFONTF_ITALIC ? 1 : 0; lf->lfUnderline = 0; @@ -82,14 +82,14 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; mir_snprintf(str, "SRMFont%d", i); - ptrW wszFontFace(db_get_wsa(NULL, SRMMMOD, str)); + ptrW wszFontFace(db_get_wsa(0, SRMMMOD, str)); if (wszFontFace == nullptr) wcsncpy_s(lf->lfFaceName, fontOptionsList[i].szDefFace, _TRUNCATE); else mir_wstrncpy(lf->lfFaceName, wszFontFace, _countof(lf->lfFaceName)); mir_snprintf(str, "SRMFont%dSet", i); - lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName)); + lf->lfCharSet = db_get_b(0, SRMMMOD, str, MsgDlgGetFontDefaultCharset(lf->lfFaceName)); } return true; } @@ -154,7 +154,7 @@ statusValues[] = static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) { TVINSERTSTRUCT tvis; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE; for (int i = 0; i < nValues; i++) { @@ -189,7 +189,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP TranslateDialogDefault(hwndDlg); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_POPLIST), GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES); - FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, _countof(statusValues), db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS)); + FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, _countof(statusValues), db_get_dw(0, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS)); CheckDlgButton(hwndDlg, IDC_DELTEMP, g_dat.bDeleteTempCont ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AUTOMIN, g_dat.bAutoMin ? BST_CHECKED : BST_UNCHECKED); @@ -200,15 +200,15 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_CTRLSUPPORT, g_dat.bCtrlSupport ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWSENDBTN, g_dat.bSendButton ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SENDONENTER, g_dat.bSendOnEnter ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_LIMITAVATARH, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_LIMITAVATARH, db_get_b(0, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, g_dat.bSendOnDblEnter ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat.bShowAvatar ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWBUTTONLINE, g_dat.bShowButtons ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, g_dat.bSavePerContact ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DONOTSTEALFOCUS, g_dat.bDoNotStealFocus ? BST_CHECKED : BST_UNCHECKED); { - DWORD avatarHeight = db_get_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT); - SetDlgItemInt(hwndDlg, IDC_NFLASHES, db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT), FALSE); + DWORD avatarHeight = db_get_dw(0, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT); + SetDlgItemInt(hwndDlg, IDC_NFLASHES, db_get_b(0, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT), FALSE); SetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, avatarHeight, FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITAVATARH), IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)) @@ -216,7 +216,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP else EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH)); - DWORD msgTimeout = db_get_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT); + DWORD msgTimeout = db_get_dw(0, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT); SetDlgItemInt(hwndDlg, IDC_SECONDS, msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout / 1000 : SRMSGDEFSET_MSGTIMEOUT / 1000, FALSE); } EnableWindow(GetDlgItem(hwndDlg, IDC_CASCADE), !g_dat.bSavePerContact); @@ -285,32 +285,32 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - db_set_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST))); - db_set_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DONOTSTEALFOCUS)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWBUTTONLINE)); - db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN)); - db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT)); - db_set_b(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CASCADE)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER)); - db_set_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN)); - - db_set_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)); - db_set_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH)); + db_set_dw(0, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST))); + db_set_b(0, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DONOTSTEALFOCUS)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWBUTTONLINE)); + db_set_b(0, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN)); + db_set_b(0, SRMMMOD, SRMSGSET_AUTOCLOSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE)); + db_set_b(0, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT)); + db_set_b(0, SRMMMOD, SRMSGSET_CASCADE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CASCADE)); + db_set_b(0, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER)); + db_set_b(0, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER)); + db_set_b(0, SRMMMOD, SRMSGSET_STATUSICON, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN)); + + db_set_b(0, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)); + db_set_b(0, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH)); - DWORD avatarHeight = GetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, NULL, TRUE); - db_set_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, avatarHeight <= 0 ? SRMSGDEFSET_AVHEIGHT : avatarHeight); + DWORD avatarHeight = GetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, nullptr, TRUE); + db_set_dw(0, SRMMMOD, SRMSGSET_AVHEIGHT, avatarHeight <= 0 ? SRMSGDEFSET_AVHEIGHT : avatarHeight); - db_set_b(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSENDBTN)); - db_set_b(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHARCOUNT)); - db_set_b(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CTRLSUPPORT)); - db_set_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DELTEMP)); - db_set_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, (BYTE)GetDlgItemInt(hwndDlg, IDC_NFLASHES, NULL, TRUE)); + db_set_b(0, SRMMMOD, SRMSGSET_SENDBUTTON, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSENDBTN)); + db_set_b(0, SRMMMOD, SRMSGSET_CHARCOUNT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHARCOUNT)); + db_set_b(0, SRMMMOD, SRMSGSET_CTRLSUPPORT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CTRLSUPPORT)); + db_set_b(0, SRMMMOD, SRMSGSET_DELTEMP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DELTEMP)); + db_set_b(0, SRMMMOD, SRMSGSET_FLASHCOUNT, (BYTE)GetDlgItemInt(hwndDlg, IDC_NFLASHES, nullptr, TRUE)); - DWORD msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000; + DWORD msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, nullptr, TRUE) * 1000; if (msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) msgTimeout = SRMSGDEFSET_MSGTIMEOUT; - db_set_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout); + db_set_dw(0, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout); ReloadGlobals(); WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, TRUE, 0); @@ -329,7 +329,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - switch (db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) { + switch (db_get_b(0, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) { case LOADHISTORY_UNREAD: CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED); break; @@ -346,18 +346,18 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, break; } SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); + SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(0, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(12 * 60, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); + SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(0, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); - CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWTIMES, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, db_get_b(0, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !db_get_b(0, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWTIMES, db_get_b(0, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSECS), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); - CheckDlgButton(hwndDlg, IDC_SHOWSECS, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSECS, SRMSGDEFSET_SHOWSECS) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWSECS, db_get_b(0, SRMMMOD, SRMSGSET_SHOWSECS, SRMSGDEFSET_SHOWSECS) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWDATES), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); - CheckDlgButton(hwndDlg, IDC_SHOWDATES, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWFORMATTING, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWFORMAT, SRMSGDEFSET_SHOWFORMAT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWDATES, db_get_b(0, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWFORMATTING, db_get_b(0, SRMMMOD, SRMSGSET_SHOWFORMAT, SRMSGDEFSET_SHOWFORMAT) ? BST_CHECKED : BST_UNCHECKED); return TRUE; case WM_COMMAND: @@ -391,19 +391,19 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT)) - db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT); + db_set_b(0, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT); else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME)) - db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME); + db_set_b(0, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME); else - db_set_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD); - db_set_w(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0)); - db_set_w(NULL, SRMMMOD, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS)); - db_set_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWSECS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSECS)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWFORMAT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWFORMATTING)); + db_set_b(0, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD); + db_set_w(0, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, SRMMMOD, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS)); + db_set_b(0, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE)BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWSECS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWSECS)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWFORMAT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWFORMATTING)); FreeMsgLogIcons(); LoadMsgLogIcons(); @@ -423,17 +423,17 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, static void ResetCList(HWND hwndDlg) { - SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0); + SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETUSEGROUPS, db_get_b(0, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT), 0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETHIDEEMPTYGROUPS, 1, 0); } static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) { - BYTE defType = db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW); + BYTE defType = db_get_b(0, SRMMMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW); if (hItemNew && defType) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItemNew, 1); - if (hItemUnknown && db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) + if (hItemUnknown && db_get_b(0, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItemUnknown, 1); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { @@ -446,10 +446,10 @@ static void RebuildList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) static void SaveList(HWND hwndDlg, HANDLE hItemNew, HANDLE hItemUnknown) { if (hItemNew) - db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGNEW, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItemNew, 0) ? 1 : 0)); + db_set_b(0, SRMMMOD, SRMSGSET_TYPINGNEW, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItemNew, 0) ? 1 : 0)); if (hItemUnknown) - db_set_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItemUnknown, 0) ? 1 : 0)); + db_set_b(0, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItemUnknown, 0) ? 1 : 0)); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0); @@ -475,11 +475,11 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam } SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE) | (CLS_SHOWHIDDEN) | (CLS_NOHIDEOFFLINE)); ResetCList(hwndDlg); - CheckDlgButton(hwndDlg, IDC_SHOWNOTIFY, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_TYPEWIN, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_TYPETRAY, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NOTIFYBALLOON, !db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWNOTIFY, db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TYPEWIN, db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_TYPETRAY, db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NOTIFYBALLOON, !db_get_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEWIN), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); @@ -532,10 +532,10 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: SaveList(hwndDlg, hItemNew, hItemUnknown); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); - db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWTYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); + db_set_b(0, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); ReloadGlobals(); WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, TRUE, 0); } @@ -587,7 +587,7 @@ static int ModernOptInitialise(WPARAM wParam, LPARAM) obj.iSection = MODERNOPT_PAGE_MSGS; obj.iType = MODERNOPT_TYPE_SECTIONPAGE; obj.iBoldControls = iBoldControls; - obj.lpzClassicGroup = NULL; + obj.lpzClassicGroup = nullptr; obj.lpzClassicPage = "Message Sessions"; obj.lpzClassicTab = "Messaging"; obj.lpzHelpUrl = "http://wiki.miranda-ng.org/"; diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 03ef642e93..f7f59929e8 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -144,7 +144,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) { CLISTEVENT *cle = (CLISTEVENT *)lParam; if (cle) - SendMessageCmd(cle->hContact, NULL, 0); + SendMessageCmd(cle->hContact, nullptr, 0); return 0; } @@ -179,7 +179,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) IcoLib_ReleaseIcon(cle.hIcon); } - else Clist_TrayNotifyW(NULL, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); + else Clist_TrayNotifyW(nullptr, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); } return 0; } @@ -187,7 +187,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if (cws->szModule == NULL) + if (cws->szModule == nullptr) return 0; if (!strcmp(cws->szModule, "CList")) @@ -240,7 +240,7 @@ static void RestoreUnreadMessageAlerts(void) dbei.cbBlob = 0; db_event_get(hDbEvent, &dbei); if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) { - int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != NULL; + int windowAlreadyExists = WindowList_Find(pci->hWindowList, hContact) != nullptr; if (windowAlreadyExists) continue; @@ -395,15 +395,15 @@ void SetButtonsPos(HWND hwndDlg, bool bIsChat) CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); - if (hwndButton == NULL || cbd->m_bHidden) + if (hwndButton == nullptr || cbd->m_bHidden) continue; if (cbd->m_bRSided) { iRightX -= g_dat.iGap + cbd->m_iButtonWidth; - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } else { - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE); iLeftX += g_dat.iGap + cbd->m_iButtonWidth; } } @@ -480,15 +480,15 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) static INT_PTR SetStatusText(WPARAM wParam, LPARAM lParam) { StatusTextData *st = (StatusTextData*)lParam; - if (st == NULL) + if (st == nullptr) return 1; HWND hwnd = WindowList_Find(pci->hWindowList, wParam); - if (hwnd == NULL) + if (hwnd == nullptr) return 1; CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (dat == NULL) + if (dat == nullptr) return 1; dat->SetStatusData(st); @@ -499,7 +499,7 @@ static wchar_t tszError[] = LPGENW("Miranda could not load the built-in message int LoadSendRecvMessageModule(void) { - if ((hMsftEdit = LoadLibrary(L"Msftedit.dll")) == NULL) { + if ((hMsftEdit = LoadLibrary(L"Msftedit.dll")) == nullptr) { if (IDYES != MessageBox(0, TranslateW(tszError), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) return 1; return 0; @@ -558,14 +558,14 @@ STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj) AddRef(); return S_OK; } - *ppvObj = NULL; + *ppvObj = nullptr; return E_NOINTERFACE; } STDMETHODIMP_(ULONG) CREOleCallback::AddRef() { if (refCount == 0) - StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg); + StgCreateDocfile(nullptr, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg); return ++refCount; } @@ -575,7 +575,7 @@ STDMETHODIMP_(ULONG) CREOleCallback::Release() if (--refCount == 0) { if (pictStg) { pictStg->Release(); - pictStg = NULL; + pictStg = nullptr; } } return refCount; @@ -617,7 +617,7 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE * lplpstg) char szName[64]; mir_snprintf(szName, "s%u", nextStgId++); MultiByteToWideChar(CP_ACP, 0, szName, -1, szwName, _countof(szwName)); - if (pictStg == NULL) + if (pictStg == nullptr) return STG_E_MEDIUMFULL; return pictStg->CreateStorage(szwName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg); } diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index aa365e17d1..d4e8ba328b 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -99,7 +99,7 @@ public: HBITMAP m_avatarPic; public: - CSrmmWindow(MCONTACT hContact, bool bNoActivate, const char *szInitialText = NULL, bool bIsUnicode = false); + CSrmmWindow(MCONTACT hContact, bool bNoActivate, const char *szInitialText = nullptr, bool bIsUnicode = false); virtual void OnInitDialog() override; virtual void OnDestroy() override; diff --git a/src/core/stdmsg/src/msgtimedout.cpp b/src/core/stdmsg/src/msgtimedout.cpp index 6fc9d129a5..044dd74b5e 100644 --- a/src/core/stdmsg/src/msgtimedout.cpp +++ b/src/core/stdmsg/src/msgtimedout.cpp @@ -49,7 +49,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SetDlgItemText(hwndDlg, IDC_MSGTEXT, ptrW(mir_utf8decodeW(item->szMsg))); HWND hwndParent = GetParent(hwndDlg); - if (hwndParent != NULL) { + if (hwndParent != nullptr) { RECT rc, rcParent; if (GetWindowRect(hwndDlg, &rc)) if (GetWindowRect(hwndParent, &rcParent)) @@ -86,9 +86,9 @@ void MessageFailureProcess(TMsgQueue *item, const char* err) MCONTACT hContact = db_mc_tryMeta(item->hContact); HWND hwnd = WindowList_Find(pci->hWindowList, hContact); - if (hwnd == NULL) { + if (hwnd == nullptr) { // If message window doesn't already exist, open a new one - SendMessageCmd(item->hContact, NULL, 0); + SendMessageCmd(item->hContact, nullptr, 0); hwnd = WindowList_Find(pci->hWindowList, hContact); } else SendMessage(hwnd, DM_REMAKELOG, 0, 0); diff --git a/src/core/stdmsg/src/statusicon.cpp b/src/core/stdmsg/src/statusicon.cpp index 7478f2d14e..c82669f941 100644 --- a/src/core/stdmsg/src/statusicon.cpp +++ b/src/core/stdmsg/src/statusicon.cpp @@ -26,11 +26,11 @@ HANDLE hHookIconPressedEvt; static int OnSrmmIconChanged(WPARAM hContact, LPARAM) { - if (hContact == NULL) + if (hContact == 0) WindowList_Broadcast(pci->hWindowList, DM_STATUSICONCHANGE, 0, 0); else { HWND hwnd = WindowList_Find(pci->hWindowList, hContact); - if (hwnd != NULL) + if (hwnd != nullptr) PostMessage(hwnd, DM_STATUSICONCHANGE, 0, 0); } return 0; @@ -48,7 +48,7 @@ void DrawStatusIcons(MCONTACT hContact, HDC hDC, const RECT &rc, int gap) HICON hIcon = ((sid->flags & MBF_DISABLED) && sid->hIconDisabled) ? sid->hIconDisabled : sid->hIcon; SetBkMode(hDC, TRANSPARENT); - DrawIconEx(hDC, x, (rc.top + rc.bottom - cy_icon) >> 1, hIcon, cx_icon, cy_icon, 0, NULL, DI_NORMAL); + DrawIconEx(hDC, x, (rc.top + rc.bottom - cy_icon) >> 1, hIcon, cx_icon, cy_icon, 0, nullptr, DI_NORMAL); x += cx_icon + gap; } @@ -58,7 +58,7 @@ void CheckStatusIconClick(MCONTACT hContact, HWND hwndFrom, POINT pt, const RECT { int iconNum = (pt.x - rc.left) / (GetSystemMetrics(SM_CXSMICON) + gap); StatusIconData *sid = Srmm_GetNthIcon(hContact, iconNum); - if (sid == NULL) + if (sid == nullptr) return; StatusIconClickData sicd = { sizeof(sicd) }; @@ -89,7 +89,7 @@ int DeinitStatusIcons() int GetStatusIconsCount(MCONTACT hContact) { int nIcon = 0; - while (Srmm_GetNthIcon(hContact, nIcon) != NULL) + while (Srmm_GetNthIcon(hContact, nIcon) != nullptr) nIcon++; return nIcon; } diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index b97132d10e..a7ed5a0da7 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -147,10 +147,10 @@ int GetRichTextLength(HWND hwnd); void SetButtonsPos(HWND hwndDlg, bool bIsChat); int RestoreWindowPosition(HWND hwnd, MCONTACT hContact, bool bHide); - // message.cpp char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si); +///////////////////////////////////////////////////////////////////////////////////////// // tabs.cpp struct CTabbedWindow : public CDlgBase diff --git a/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index 40f5312476..79bde8096e 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -150,8 +150,8 @@ void CTabbedWindow::OnInitDialog() SetWindowLongPtr(m_tab.GetHwnd(), GWLP_USERDATA, LPARAM(this)); mir_subclassWindow(m_tab.GetHwnd(), &CSrmmWindow::TabSubclassProc); - if (db_get_b(NULL, CHAT_MODULE, "SavePosition", 0)) - RestoreWindowPosition(m_hwnd, NULL, false); + if (db_get_b(0, CHAT_MODULE, "SavePosition", 0)) + RestoreWindowPosition(m_hwnd, 0, false); LONG_PTR mask = GetWindowLongPtr(m_tab.GetHwnd(), GWL_STYLE); if (g_Settings.bTabsAtBottom) @@ -190,7 +190,7 @@ void CTabbedWindow::AddPage(SESSION_INFO *si, int insertAt) Show(SW_SHOW); CChatRoomDlg *pTab = new CChatRoomDlg(si); - m_tab.AddPage(szTemp, NULL, pTab); + m_tab.AddPage(szTemp, nullptr, pTab); FixTabIcons(pTab); m_tab.ActivatePage(m_tab.GetCount() - 1); @@ -223,7 +223,7 @@ void CTabbedWindow::FixTabIcons(CChatRoomDlg *pDlg) TabCtrl_SetItem(m_tab.GetHwnd(), idx, &tci); } } - else RedrawWindow(m_tab.GetHwnd(), NULL, NULL, RDW_INVALIDATE); + else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); } void CTabbedWindow::SetMessageHighlight(CChatRoomDlg *pDlg) @@ -235,9 +235,9 @@ void CTabbedWindow::SetMessageHighlight(CChatRoomDlg *pDlg) pDlg->m_si->wState |= GC_EVENT_HIGHLIGHT; FixTabIcons(pDlg); if (g_Settings.bFlashWindowHighlight && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwnd) - SetTimer(m_hwnd, TIMERID_FLASHWND, 900, NULL); + SetTimer(m_hwnd, TIMERID_FLASHWND, 900, nullptr); } - else RedrawWindow(m_tab.GetHwnd(), NULL, NULL, RDW_INVALIDATE); + else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); } void CTabbedWindow::SetTabHighlight(CChatRoomDlg *pDlg) @@ -248,15 +248,15 @@ void CTabbedWindow::SetTabHighlight(CChatRoomDlg *pDlg) FixTabIcons(pDlg); if (g_Settings.bFlashWindow && GetActiveWindow() != m_hwnd && GetForegroundWindow() != m_hwnd) - SetTimer(m_hwnd, TIMERID_FLASHWND, 900, NULL); + SetTimer(m_hwnd, TIMERID_FLASHWND, 900, nullptr); } - else RedrawWindow(m_tab.GetHwnd(), NULL, NULL, RDW_INVALIDATE); + else RedrawWindow(m_tab.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE); } void CTabbedWindow::TabClicked() { CChatRoomDlg *pDlg = (CChatRoomDlg*)m_tab.GetActivePage(); - if (pDlg == NULL) + if (pDlg == nullptr) return; SESSION_INFO *s = pDlg->m_si; @@ -339,7 +339,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (m_tab.GetCount() == 0) PostMessage(m_hwnd, WM_CLOSE, 0, 0); else { - if (m_tab.GetNthPage(idx) == NULL) + if (m_tab.GetNthPage(idx) == nullptr) idx--; m_tab.ActivatePage(idx); } @@ -433,7 +433,7 @@ INT_PTR CTabbedWindow::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) } else CheckMenuItem(hSubMenu, ID_LOCKPOSITION, MF_BYCOMMAND | MF_UNCHECKED); - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, tci.pt.x, tci.pt.y, 0, m_hwnd, NULL)) { + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, tci.pt.x, tci.pt.y, 0, m_hwnd, nullptr)) { case ID_CLOSE: SendMessage(m_hwnd, GC_REMOVETAB, 0, (LPARAM)m_tab.GetNthPage(i)); break; @@ -475,21 +475,21 @@ CTabbedWindow *pDialog = nullptr; void CTabbedWindow::OnDestroy() { - if (db_get_b(NULL, CHAT_MODULE, "SavePosition", 0)) { + if (db_get_b(0, CHAT_MODULE, "SavePosition", 0)) { RECT rc; GetWindowRect(m_hwnd, &rc); - db_set_dw(NULL, CHAT_MODULE, "roomx", rc.left); - db_set_dw(NULL, CHAT_MODULE, "roomy", rc.top); - db_set_dw(NULL, CHAT_MODULE, "roomwidth", rc.right - rc.left); - db_set_dw(NULL, CHAT_MODULE, "roomheight", rc.bottom - rc.top); + db_set_dw(0, CHAT_MODULE, "roomx", rc.left); + db_set_dw(0, CHAT_MODULE, "roomy", rc.top); + db_set_dw(0, CHAT_MODULE, "roomwidth", rc.right - rc.left); + db_set_dw(0, CHAT_MODULE, "roomheight", rc.bottom - rc.top); } - pDialog = NULL; + pDialog = nullptr; } void InitTabs() { - if (g_Settings.bTabsEnable && pDialog == NULL) { + if (g_Settings.bTabsEnable && pDialog == nullptr) { pDialog = new CTabbedWindow(); pDialog->Create(); } @@ -499,9 +499,9 @@ void InitTabs() void UninitTabs() { - if (pDialog != NULL) { + if (pDialog != nullptr) { pDialog->Close(); - pDialog = NULL; + pDialog = nullptr; } arSavedTabs.destroy(); -- cgit v1.2.3