summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-03-09 20:45:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-03-09 20:45:04 +0300
commitf3ff9ad5341bb0b0a0453e61a2d419e8c02f14b0 (patch)
tree40b4468a2a24643b2640a43a6af6f0d1242c8219
parente5fdfcde3880eb7edaf573fb883dd4ef86972082 (diff)
cosmetic fixes
-rw-r--r--plugins/Scriver/src/chat/log.cpp9
-rw-r--r--src/core/stdmsg/src/chat_window.cpp126
-rw-r--r--src/mir_app/src/chat_log.cpp18
-rw-r--r--src/mir_app/src/chat_manager.cpp234
-rw-r--r--src/mir_app/src/chat_svc.cpp98
5 files changed, 241 insertions, 244 deletions
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp
index 0499847dac..87cb9fc8f1 100644
--- a/plugins/Scriver/src/chat/log.cpp
+++ b/plugins/Scriver/src/chat/log.cpp
@@ -33,8 +33,6 @@ void CChatRoomDlg::Log_StreamInEvent(LOGINFO* lin, BOOL bRedraw)
if (!bRedraw && (m_si->iType == GCW_CHATROOM || m_si->iType == GCW_PRIVMESS) && m_bFilterEnabled && !(m_iLogFilterFlags & lin->iType))
return;
- BOOL bFlag = FALSE;
-
LOGSTREAMDATA streamData;
memset(&streamData, 0, sizeof(streamData));
streamData.hwnd = m_log.GetHwnd();
@@ -74,9 +72,10 @@ void CChatRoomDlg::Log_StreamInEvent(LOGINFO* lin, BOOL bRedraw)
WPARAM wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF;
// get the number of pixels per logical inch
+ bool bFlag = false;
if (bRedraw) {
m_log.SendMsg(WM_SETREDRAW, FALSE, 0);
- bFlag = TRUE;
+ bFlag = true;
}
// stream in the event(s)
@@ -85,9 +84,7 @@ void CChatRoomDlg::Log_StreamInEvent(LOGINFO* lin, BOOL bRedraw)
m_log.SendMsg(EM_STREAMIN, wp, (LPARAM)&stream);
// do smileys
- if (g_dat.smileyAddInstalled && (bRedraw || (lin->ptszText &&
- lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS)))
- {
+ if (g_dat.smileyAddInstalled && (bRedraw || (lin->ptszText && lin->iType != GC_EVENT_JOIN && lin->iType != GC_EVENT_NICK && lin->iType != GC_EVENT_ADDSTATUS && lin->iType != GC_EVENT_REMOVESTATUS))) {
newsel.cpMax = -1;
newsel.cpMin = sel.cpMin;
if (newsel.cpMin < 0)
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp
index 7292b9aa00..00f630271b 100644
--- a/src/core/stdmsg/src/chat_window.cpp
+++ b/src/core/stdmsg/src/chat_window.cpp
@@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-static HKL hkl = NULL;
+static HKL hkl = nullptr;
struct MESSAGESUBDATA
{
@@ -38,11 +38,11 @@ int CChatRoomDlg::Resizer(UTILRESIZECONTROL *urc)
SESSION_INFO *si = m_si;
RECT rc;
- BOOL bControl = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTopButtons", 1);
- BOOL bFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowFormatButtons", 1);
- BOOL bToolbar = bFormat || bControl;
- BOOL bSend = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowSend", 0);
- BOOL bNick = si->iType != GCW_SERVER && m_bNicklistEnabled;
+ bool bControl = db_get_b(0, CHAT_MODULE, "ShowTopButtons", 1) != 0;
+ bool bFormat = db_get_b(0, CHAT_MODULE, "ShowFormatButtons", 1) != 0;
+ bool bToolbar = bFormat || bControl;
+ bool bSend = db_get_b(0, CHAT_MODULE, "ShowSend", 0) != 0;
+ bool bNick = si->iType != GCW_SERVER && m_bNicklistEnabled;
switch (urc->wId) {
case IDOK:
@@ -136,13 +136,13 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
return TRUE;
if (wParam == '\n' || wParam == '\r') {
- if ((isCtrl != 0) ^ (0 != db_get_b(NULL, CHAT_MODULE, "SendOnEnter", 1))) {
+ if ((isCtrl != 0) ^ (0 != db_get_b(0, CHAT_MODULE, "SendOnEnter", 1))) {
PostMessage(hwndDlg, WM_COMMAND, IDOK, 0);
return 0;
}
- if (db_get_b(NULL, CHAT_MODULE, "SendOnDblEnter", 0)) {
- if (dat->lastEnterTime + 2 < time(NULL))
- dat->lastEnterTime = time(NULL);
+ if (db_get_b(0, CHAT_MODULE, "SendOnDblEnter", 0)) {
+ if (dat->lastEnterTime + 2 < time(nullptr))
+ dat->lastEnterTime = time(nullptr);
else {
SendMessage(hwnd, WM_KEYDOWN, VK_BACK, 0);
SendMessage(hwnd, WM_KEYUP, VK_BACK, 0);
@@ -168,11 +168,11 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
BOOL isAlt = GetKeyState(VK_MENU) & 0x8000;
if (wParam == VK_RETURN) {
dat->szTabSave[0] = '\0';
- if ((isCtrl != 0) ^ (0 != db_get_b(NULL, CHAT_MODULE, "SendOnEnter", 1)))
+ if ((isCtrl != 0) ^ (0 != db_get_b(0, CHAT_MODULE, "SendOnEnter", 1)))
return 0;
- if (db_get_b(NULL, CHAT_MODULE, "SendOnDblEnter", 0))
- if (dat->lastEnterTime + 2 >= time(NULL))
+ if (db_get_b(0, CHAT_MODULE, "SendOnDblEnter", 0))
+ if (dat->lastEnterTime + 2 >= time(nullptr))
return 0;
break;
@@ -208,7 +208,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
SendMessage(hwndDlg, GC_SWITCHTAB, 0, (int)wParam - (int)VK_NUMPAD1);
if (wParam == VK_TAB && !isCtrl && !isShift) { //tab-autocomplete
- wchar_t* pszText = NULL;
+ wchar_t *pszText = nullptr;
LRESULT lResult = (LRESULT)SendMessage(hwnd, EM_GETSEL, 0, 0);
SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
@@ -241,7 +241,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
mir_wstrncpy(pszSelName, pszText + start, end - start + 1);
wchar_t *pszName = pci->UM_FindUserAutoComplete(dat->si->pUsers, dat->szTabSave, pszSelName);
- if (pszName == NULL) {
+ if (pszName == nullptr) {
pszName = dat->szTabSave;
SendMessage(hwnd, EM_SETSEL, start, end);
if (end != start)
@@ -258,7 +258,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
}
SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
return 0;
}
@@ -382,14 +382,14 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
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);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
SendMessage(hwnd, EM_SETSEL, iLen, iLen);
dat->lastEnterTime = 0;
return TRUE;
}
if (wParam == VK_DOWN && isCtrl && !isAlt) {
- char* lpPrevCmd = pci->SM_GetNextCommand(dat->si->ptszID, dat->si->pszModule);
+ char *lpPrevCmd = pci->SM_GetNextCommand(dat->si->ptszID, dat->si->pszModule);
SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
if (lpPrevCmd) {
@@ -406,7 +406,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
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);
+ RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
SendMessage(hwnd, EM_SETSEL, iLen, iLen);
dat->lastEnterTime = 0;
return TRUE;
@@ -439,7 +439,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
ClientToScreen(hwnd, &pt);
CHARRANGE all = { 0, -1 };
- UINT uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ UINT uID = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, nullptr);
switch (uID) {
case 0:
break;
@@ -487,7 +487,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
MODULEINFO *pmi = pci->MM_FindModule(dat->si->pszModule);
- if (pmi == NULL)
+ if (pmi == nullptr)
break;
if (pmi->bColor) {
@@ -507,7 +507,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
if (pmi->bBkgColor) {
int index = GetColorIndex(dat->si->pszModule, cf.crBackColor);
- COLORREF crB = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ COLORREF crB = (COLORREF)db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
UINT u = IsDlgButtonChecked(hwndDlg, IDC_BKGCOLOR);
if (index >= 0) {
@@ -562,7 +562,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
INT_PTR CALLBACK CChatRoomDlg::FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- static CChatRoomDlg *pDlg = NULL;
+ static CChatRoomDlg *pDlg = nullptr;
switch (uMsg) {
case WM_INITDIALOG:
pDlg = (CChatRoomDlg*)lParam;
@@ -634,7 +634,7 @@ static LRESULT CALLBACK ButtonSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, L
{
switch (msg) {
case WM_RBUTTONUP:
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) != 0) {
+ if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) != 0) {
if (GetDlgItem(GetParent(hwnd), IDC_FILTER) == hwnd)
SendMessage(GetParent(hwnd), GC_SHOWFILTERMENU, 0, 0);
if (GetDlgItem(GetParent(hwnd), IDC_COLOR) == hwnd)
@@ -697,7 +697,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_ERASEBKGND:
{
HDC dc = (HDC)wParam;
- if (dc == NULL)
+ if (dc == nullptr)
return 0;
int index = SendMessage(hwnd, LB_GETTOPINDEX, 0, 0);
@@ -785,7 +785,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
default:
- pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, NULL, uID);
+ pci->DoEventHookAsync(GetParent(hwnd), si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, uID);
break;
}
DestroyGCMenu(&hMenu, 1);
@@ -807,12 +807,12 @@ int GetTextPixelSize(wchar_t* pszText, HFONT hFont, BOOL bWidth)
if (!pszText || !hFont)
return 0;
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
HFONT hOldFont = (HFONT)SelectObject(hdc, hFont);
RECT rc = {};
DrawText(hdc, pszText, -1, &rc, DT_CALCRECT);
SelectObject(hdc, hOldFont);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
return bWidth ? rc.right - rc.left : rc.bottom - rc.top;
}
@@ -913,7 +913,7 @@ void CChatRoomDlg::OnInitDialog()
if (!g_Settings.bTabsEnable)
dwFlags |= SBARS_SIZEGRIP;
- m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, dwFlags, 0, 0, 0, 0, m_hwnd, NULL, g_hInst, NULL);
+ m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, nullptr, dwFlags, 0, 0, 0, 0, m_hwnd, nullptr, g_hInst, nullptr);
SendMessage(m_hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0);
SendDlgItemMessage(m_hwnd, IDC_LOG, EM_HIDESELECTION, TRUE, 0);
@@ -937,7 +937,7 @@ void CChatRoomDlg::OnDestroy()
m_si->pDlg = nullptr;
m_si->wState &= ~STATE_TALK;
- DestroyWindow(m_hwndStatus); m_hwndStatus = NULL;
+ DestroyWindow(m_hwndStatus); m_hwndStatus = nullptr;
NotifyLocalWinEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSE);
}
@@ -969,7 +969,7 @@ void CChatRoomDlg::OnClick_Color(CCtrlButton *pButton)
cf.dwEffects = 0;
if (IsDlgButtonChecked(m_hwnd, IDC_COLOR)) {
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_COLOR);
else if (m_bFGSet) {
cf.dwMask = CFM_COLOR;
@@ -994,7 +994,7 @@ void CChatRoomDlg::OnClick_BkColor(CCtrlButton *pButton)
cf.dwEffects = 0;
if (IsDlgButtonChecked(m_hwnd, IDC_BKGCOLOR)) {
- if (db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ if (db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWCOLORCHOOSER, 0, IDC_BKGCOLOR);
else if (m_bBGSet) {
cf.dwMask = CFM_BACKCOLOR;
@@ -1004,7 +1004,7 @@ void CChatRoomDlg::OnClick_BkColor(CCtrlButton *pButton)
}
else {
cf.dwMask = CFM_BACKCOLOR;
- cf.crBackColor = (COLORREF)db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ cf.crBackColor = (COLORREF)db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
}
@@ -1016,7 +1016,7 @@ void CChatRoomDlg::OnClick_Filter(CCtrlButton *pButton)
m_bFilterEnabled = !m_bFilterEnabled;
SendDlgItemMessage(m_hwnd, IDC_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIconEx(m_bFilterEnabled ? "filter" : "filter2", FALSE));
- if (m_bFilterEnabled && db_get_b(NULL, CHAT_MODULE, "RightClickFilter", 0) == 0)
+ if (m_bFilterEnabled && db_get_b(0, CHAT_MODULE, "RightClickFilter", 0) == 0)
SendMessage(m_hwnd, GC_SHOWFILTERMENU, 0, 0);
else
SendMessage(m_hwnd, GC_REDRAWLOG, 0, 0);
@@ -1029,7 +1029,7 @@ void CChatRoomDlg::OnClick_History(CCtrlButton *pButton)
MODULEINFO *pInfo = pci->MM_FindModule(m_si->pszModule);
if (pInfo)
- ShellExecute(m_hwnd, NULL, pci->GetChatLogsFilename(m_si, 0), NULL, NULL, SW_SHOW);
+ ShellExecute(m_hwnd, nullptr, pci->GetChatLogsFilename(m_si, 0), nullptr, nullptr, SW_SHOW);
}
void CChatRoomDlg::OnClick_NickList(CCtrlButton *pButton)
@@ -1047,7 +1047,7 @@ void CChatRoomDlg::OnClick_NickList(CCtrlButton *pButton)
void CChatRoomDlg::OnClick_Options(CCtrlButton *pButton)
{
if (pButton->Enabled())
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0);
+ pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_CHANMGR, nullptr, nullptr, 0);
}
void CChatRoomDlg::OnClick_Ok(CCtrlButton *pButton)
@@ -1056,11 +1056,11 @@ void CChatRoomDlg::OnClick_Ok(CCtrlButton *pButton)
return;
ptrA pszRtf(Message_GetFromStream(m_hwnd, m_si));
- if (pszRtf == NULL)
+ if (pszRtf == nullptr)
return;
MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
- if (mi == NULL)
+ if (mi == nullptr)
return;
pci->SM_AddCommand(m_si->ptszID, m_si->pszModule, pszRtf);
@@ -1078,7 +1078,7 @@ void CChatRoomDlg::OnClick_Ok(CCtrlButton *pButton)
EnableWindow(m_btnOk.GetHwnd(), FALSE);
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0);
+ pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_MESSAGE, nullptr, ptszText, 0);
SetFocus(m_message.GetHwnd());
}
@@ -1092,7 +1092,7 @@ void CChatRoomDlg::OnListDblclick(CCtrlListBox*)
int item = LOWORD(SendDlgItemMessage(m_hwnd, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(hti.pt.x, hti.pt.y)));
USERINFO *ui = pci->SM_GetUserFromIndex(m_si->ptszID, m_si->pszModule, item);
- if (ui == NULL)
+ if (ui == nullptr)
return;
if (GetKeyState(VK_SHIFT) & 0x8000) {
@@ -1155,7 +1155,7 @@ void CChatRoomDlg::SetWindowPosition()
return;
}
- if (db_get_b(NULL, CHAT_MODULE, "SavePosition", 0)) {
+ if (db_get_b(0, CHAT_MODULE, "SavePosition", 0)) {
if (RestoreWindowPosition(m_hwnd, m_hContact, true)) {
ShowWindow(m_hwnd, SW_HIDE);
return;
@@ -1165,7 +1165,7 @@ void CChatRoomDlg::SetWindowPosition()
else SetWindowPos(m_hwnd, 0, (screen.right - screen.left) / 2 - (550) / 2, (screen.bottom - screen.top) / 2 - (400) / 2, (550), (400), SWP_NOZORDER | SWP_HIDEWINDOW | SWP_NOACTIVATE);
SESSION_INFO *pActive = pci->GetActiveSession();
- if (pActive && pActive->pDlg && db_get_b(NULL, CHAT_MODULE, "CascadeWindows", 1)) {
+ if (pActive && pActive->pDlg && db_get_b(0, CHAT_MODULE, "CascadeWindows", 1)) {
RECT rcThis, rcNew;
int dwFlag = SWP_NOZORDER | SWP_NOACTIVATE;
if (!IsWindowVisible(m_hwnd))
@@ -1236,15 +1236,15 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
cf.dwMask = CFM_COLOR | CFM_BOLD | CFM_UNDERLINE | CFM_BACKCOLOR;
cf.dwEffects = 0;
cf.crTextColor = g_Settings.MessageAreaColor;
- cf.crBackColor = db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
- SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETBKGNDCOLOR, 0, db_get_dw(NULL, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)));
+ cf.crBackColor = db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW));
+ SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETBKGNDCOLOR, 0, db_get_dw(0, CHAT_MODULE, "ColorMessageBG", GetSysColor(COLOR_WINDOW)));
SendDlgItemMessage(m_hwnd, IDC_MESSAGE, WM_SETFONT, (WPARAM)g_Settings.MessageAreaFont, MAKELPARAM(TRUE, 0));
SendDlgItemMessage(m_hwnd, IDC_MESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cf);
{
// nicklist
int ih = GetTextPixelSize(L"AQGglo", g_Settings.UserListFont, FALSE);
int ih2 = GetTextPixelSize(L"AQGglo", g_Settings.UserListHeadingsFont, FALSE);
- int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
+ int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12);
int font = ih > ih2 ? ih : ih2;
// make sure we have space for icon!
@@ -1252,7 +1252,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
font = font > 16 ? font : 16;
SendDlgItemMessage(m_hwnd, IDC_LIST, LB_SETITEMHEIGHT, 0, height > font ? height : font);
- InvalidateRect(m_nickList.GetHwnd(), NULL, TRUE);
+ InvalidateRect(m_nickList.GetHwnd(), nullptr, TRUE);
}
SendMessage(m_hwnd, WM_SIZE, 0, 0);
SendMessage(m_hwnd, GC_REDRAWLOG2, 0, 0);
@@ -1321,9 +1321,9 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (!IsIconic(m_hwnd)) {
SendMessage(m_hwndStatus, WM_SIZE, 0, 0);
- BOOL bControl = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowTopButtons", 1);
- BOOL bFormat = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowFormatButtons", 1);
- BOOL bSend = (BOOL)db_get_b(NULL, CHAT_MODULE, "ShowSend", 0);
+ BOOL bControl = (BOOL)db_get_b(0, CHAT_MODULE, "ShowTopButtons", 1);
+ BOOL bFormat = (BOOL)db_get_b(0, CHAT_MODULE, "ShowFormatButtons", 1);
+ BOOL bSend = (BOOL)db_get_b(0, CHAT_MODULE, "ShowSend", 0);
BOOL bNick = m_si->iType != GCW_SERVER && m_bNicklistEnabled;
ShowWindow(m_btnBold.GetHwnd(), bFormat ? SW_SHOW : SW_HIDE);
@@ -1358,15 +1358,15 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
CSrmmBaseDialog::DlgProc(uMsg, wParam, lParam); // call built-in resizer
SetButtonsPos(m_hwnd, true);
- InvalidateRect(m_hwndStatus, NULL, TRUE);
- RedrawWindow(m_message.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
- RedrawWindow(m_btnOk.GetHwnd(), NULL, NULL, RDW_INVALIDATE);
+ InvalidateRect(m_hwndStatus, nullptr, TRUE);
+ RedrawWindow(m_message.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
+ RedrawWindow(m_btnOk.GetHwnd(), nullptr, nullptr, RDW_INVALIDATE);
SaveWindowPosition(false);
}
return TRUE;
case GC_REDRAWWINDOW:
- InvalidateRect(m_hwnd, NULL, TRUE);
+ InvalidateRect(m_hwnd, nullptr, TRUE);
break;
case GC_REDRAWLOG:
@@ -1376,7 +1376,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (m_si->iEventCount > 60) {
int index = 0;
while (index < 59) {
- if (pLog->next == NULL)
+ if (pLog->next == nullptr)
break;
pLog = pLog->next;
@@ -1417,7 +1417,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
int ih = GetTextPixelSize(L"AQGgl'", g_Settings.UserListFont, FALSE);
int ih2 = GetTextPixelSize(L"AQGg'", g_Settings.UserListHeadingsFont, FALSE);
int font = ih > ih2 ? ih : ih2;
- int height = db_get_b(NULL, CHAT_MODULE, "NicklistRowDist", 12);
+ int height = db_get_b(0, CHAT_MODULE, "NicklistRowDist", 12);
// make sure we have space for icon!
if (g_Settings.bShowContactStatus)
@@ -1455,14 +1455,14 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) {
HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
x_offset += 18;
}
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(m_si, ui), 10, 10, 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset, pci->SM_GetStatusIcon(m_si, ui), 10, 10, 0, nullptr, DI_NORMAL);
x_offset += 12;
if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) {
HICON hIcon = Skin_LoadProtoIcon(m_si->pszModule, ui->ContactStatus);
- DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, NULL, DI_NORMAL);
+ DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 3, hIcon, 16, 16, 0, nullptr, DI_NORMAL);
x_offset += 18;
}
@@ -1506,7 +1506,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
case SESSION_TERMINATE:
if (!g_Settings.bTabsEnable) {
SaveWindowPosition(true);
- if (db_get_b(NULL, CHAT_MODULE, "SavePosition", 0)) {
+ if (db_get_b(0, CHAT_MODULE, "SavePosition", 0)) {
db_set_dw(m_hContact, CHAT_MODULE, "roomx", m_si->iX);
db_set_dw(m_hContact, CHAT_MODULE, "roomy", m_si->iY);
db_set_dw(m_hContact, CHAT_MODULE, "roomwidth", m_si->iWidth);
@@ -1530,7 +1530,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
goto LABEL_SHOWWINDOW;
case SESSION_INITDONE:
- if (db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) != 0)
+ if (db_get_b(0, CHAT_MODULE, "PopupOnJoin", 0) != 0)
return TRUE;
// fall through
case WINDOW_VISIBLE:
@@ -1680,7 +1680,7 @@ LABEL_SHOWWINDOW:
CHARRANGE all = { 0, -1 };
HMENU hMenu = 0;
- UINT uID = CreateGCMenu(m_hwnd, &hMenu, 1, pt, m_si, NULL, pszWord);
+ UINT uID = CreateGCMenu(m_hwnd, &hMenu, 1, pt, m_si, nullptr, pszWord);
switch (uID) {
case 0:
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
@@ -1725,7 +1725,7 @@ LABEL_SHOWWINDOW:
default:
PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0);
- pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_LOGMENU, NULL, NULL, uID);
+ pci->DoEventHookAsync(m_hwnd, m_si->ptszID, m_si->pszModule, GC_USER_LOGMENU, nullptr, nullptr, uID);
break;
}
DestroyGCMenu(&hMenu, 5);
@@ -1741,7 +1741,7 @@ LABEL_SHOWWINDOW:
ScreenToClient(m_nickList.GetHwnd(), &p);
int item = LOWORD(SendDlgItemMessage(m_hwnd, IDC_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y)));
USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item);
- if (ui != NULL) {
+ if (ui != nullptr) {
static wchar_t ptszBuf[1024];
mir_snwprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index 2a7ab9234f..d60428a28b 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -194,7 +194,7 @@ static void AddEventToBuffer(CMStringA &buf, LOGSTREAMDATA *streamData)
LOGINFO *lin = streamData->lin;
wchar_t szTemp[512], szTemp2[512];
- wchar_t* pszNick = NULL;
+ wchar_t* pszNick = nullptr;
if (lin->ptszNick) {
if (g_Settings->bLogLimitNames && mir_wstrlen(lin->ptszNick) > 20) {
mir_wstrncpy(szTemp2, lin->ptszNick, 20);
@@ -312,7 +312,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
continue;
// create new line, and set font and color
- if (lin->next != NULL)
+ if (lin->next != nullptr)
buf.Append("\\par ");
buf.AppendFormat("%s ", Log_SetStyle(0));
@@ -388,10 +388,10 @@ char* Log_CreateRtfHeader(MODULEINFO *mi)
CMStringA buf;
// get the number of pixels per logical inch
- HDC hdc = GetDC(NULL);
+ HDC hdc = GetDC(nullptr);
chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
// ### RTF HEADER
@@ -449,7 +449,7 @@ void LoadMsgLogBitmaps(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);
@@ -461,7 +461,7 @@ void LoadMsgLogBitmaps(void)
HICON hIcon = chatApi.hIcons[i];
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);
SelectObject(hdcMem, hoBmp);
GetDIBits(hdc, hBmp, 0, bih.biHeight, pBmpBits, (BITMAPINFO *)& bih, DIB_RGB_COLORS);
@@ -473,14 +473,14 @@ void LoadMsgLogBitmaps(void)
mir_free(pBmpBits);
DeleteDC(hdcMem);
DeleteObject(hBmp);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
DeleteObject(hBkgBrush);
if (chatApi.logPixelSY == 0) {
- hdc = GetDC(NULL);
+ hdc = GetDC(nullptr);
chatApi.logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY);
chatApi.logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX);
- ReleaseDC(NULL, hdc);
+ ReleaseDC(nullptr, hdc);
}
for (int i = 0; i < OPTIONS_FONTCOUNT; i++) {
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index 1ff2b061e2..bdd3604861 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -96,7 +96,7 @@ static void SM_FreeSession(SESSION_INFO *si)
mir_free(si->ptszStatusbarText);
mir_free(si->ptszTopic);
- while (si->lpCommands != NULL) {
+ while (si->lpCommands != nullptr) {
COMMANDINFO *pNext = si->lpCommands->next;
mir_free(si->lpCommands->lpCommand);
mir_free(si->lpCommands);
@@ -117,7 +117,7 @@ int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL removeCon
if ((!pszID && si->iType != GCW_SERVER || !mir_wstrcmpi(si->ptszID, pszID)) && !mir_strcmpi(si->pszModule, pszModule)) {
if (si->pDlg)
SendMessage(si->pDlg->GetHwnd(), GC_CONTROL_MSG, SESSION_TERMINATE, 0);
- DoEventHook(si, GC_SESSION_TERMINATE, NULL, NULL, (INT_PTR)si->pItemData);
+ DoEventHook(si, GC_SESSION_TERMINATE, nullptr, nullptr, (INT_PTR)si->pItemData);
// contact may have been deleted here already, since function may be called after deleting
// contact so the handle may be invalid, therefore db_get_b shall return 0
@@ -158,7 +158,7 @@ BOOL SM_SetOffline(const wchar_t *pszID, const char *pszModule)
continue;
chatApi.UM_RemoveAll(&si->pUsers);
- si->pMe = NULL;
+ si->pMe = nullptr;
si->nUsersInNicklist = 0;
if (si->iType != GCW_SERVER)
si->bInitDone = false;
@@ -173,10 +173,10 @@ BOOL SM_SetOffline(const wchar_t *pszID, const char *pszModule)
static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui)
{
if (!ui || !si)
- return NULL;
+ return nullptr;
STATUSINFO *ti = chatApi.TM_FindStatus(si->pStatuses, chatApi.TM_WordToString(si->pStatuses, ui->Status));
- if (ti != NULL) {
+ if (ti != nullptr) {
if ((UINT_PTR)ti->hIcon >= STATUSICONCOUNT)
return ti->hIcon;
@@ -188,7 +188,7 @@ static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO * ui)
BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, bool bIsHighlighted)
{
SESSION_INFO *p = SM_FindSession(pszID, pszModule);
- if (p == NULL)
+ if (p == nullptr)
return TRUE;
LOGINFO *li = chatApi.LM_AddEvent(&p->pLog, &p->pLogEnd);
@@ -219,7 +219,7 @@ BOOL SM_MoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *psz
return FALSE;
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- if (si == NULL)
+ if (si == nullptr)
return FALSE;
chatApi.UM_SortUser(&si->pUsers, pszUID);
@@ -243,7 +243,7 @@ BOOL SM_RemoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *p
chatApi.OnRemoveUser(si, ui);
if (si->pMe == ui)
- si->pMe = NULL;
+ si->pMe = nullptr;
chatApi.UM_RemoveUser(&si->pUsers, pszUID);
if (si->pDlg)
@@ -260,13 +260,13 @@ BOOL SM_RemoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *p
static USERINFO* SM_GetUserFromIndex(const wchar_t *pszID, const char *pszModule, int index)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- return (si == NULL) ? NULL : chatApi.UM_FindUserFromIndex(si->pUsers, index);
+ return (si == nullptr) ? nullptr : chatApi.UM_FindUserFromIndex(si->pUsers, index);
}
BOOL SM_GiveStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszStatus)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- if (si == NULL)
+ if (si == nullptr)
return FALSE;
USERINFO *ui = chatApi.UM_GiveStatus(si->pUsers, pszUID, chatApi.TM_StringToWord(si->pStatuses, pszStatus));
@@ -281,7 +281,7 @@ BOOL SM_GiveStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *p
BOOL SM_SetContactStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, WORD wStatus)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- if (si == NULL)
+ if (si == nullptr)
return FALSE;
USERINFO *ui = chatApi.UM_SetContactStatus(si->pUsers, pszUID, wStatus);
@@ -296,7 +296,7 @@ BOOL SM_SetContactStatus(const wchar_t *pszID, const char *pszModule, const wcha
BOOL SM_TakeStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszStatus)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- if (si == NULL)
+ if (si == nullptr)
return FALSE;
USERINFO *ui = chatApi.UM_TakeStatus(si->pUsers, pszUID, chatApi.TM_StringToWord(si->pStatuses, pszStatus));
@@ -310,7 +310,7 @@ BOOL SM_TakeStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *p
LRESULT SM_SendMessage(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
{
- if (pszModule == NULL)
+ if (pszModule == nullptr)
return 0;
for (int i = 0; i < g_arSessions.getCount(); i++) {
@@ -405,7 +405,7 @@ void SM_RemoveAll(void)
if (si->pDlg)
SendMessage(si->pDlg->GetHwnd(), GC_CONTROL_MSG, SESSION_TERMINATE, 0);
- DoEventHook(si, GC_SESSION_TERMINATE, NULL, NULL, (INT_PTR)si->pItemData);
+ DoEventHook(si, GC_SESSION_TERMINATE, nullptr, nullptr, (INT_PTR)si->pItemData);
SM_FreeSession(si);
}
@@ -415,16 +415,16 @@ void SM_RemoveAll(void)
static void SM_AddCommand(const wchar_t *pszID, const char *pszModule, const char* lpNewCommand)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- if (si == NULL)
+ if (si == nullptr)
return;
COMMANDINFO *node = (COMMANDINFO *)mir_alloc(sizeof(COMMANDINFO));
node->lpCommand = mir_strdup(lpNewCommand);
- node->last = NULL; // always added at beginning!
+ node->last = nullptr; // always added at beginning!
// new commands are added at start
- if (si->lpCommands == NULL) {
- node->next = NULL;
+ if (si->lpCommands == nullptr) {
+ node->next = nullptr;
si->lpCommands = node;
}
else {
@@ -432,30 +432,30 @@ static void SM_AddCommand(const wchar_t *pszID, const char *pszModule, const cha
si->lpCommands->last = node; // hmm, weird
si->lpCommands = node;
}
- si->lpCurrentCommand = NULL; // current command
+ si->lpCurrentCommand = nullptr; // current command
si->wCommandsNum++;
if (si->wCommandsNum > WINDOWS_COMMANDS_MAX) {
COMMANDINFO *pCurComm = si->lpCommands;
- while (pCurComm->next != NULL) { pCurComm = pCurComm->next; }
+ while (pCurComm->next != nullptr) { pCurComm = pCurComm->next; }
COMMANDINFO *pLast = pCurComm->last;
mir_free(pCurComm->lpCommand);
mir_free(pCurComm);
- pLast->next = NULL;
+ pLast->next = nullptr;
// done
si->wCommandsNum--;
}
}
-static char* SM_GetPrevCommand(const wchar_t *pszID, const char *pszModule) // get previous command. returns NULL if previous command does not exist. current command remains as it was.
+static char* SM_GetPrevCommand(const wchar_t *pszID, const char *pszModule) // get previous command. returns nullptr if previous command does not exist. current command remains as it was.
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- if (si == NULL)
- return NULL;
+ if (si == nullptr)
+ return nullptr;
- COMMANDINFO *pPrevCmd = NULL;
- if (si->lpCurrentCommand != NULL) {
- if (si->lpCurrentCommand->next != NULL) // not NULL
+ COMMANDINFO *pPrevCmd = nullptr;
+ if (si->lpCurrentCommand != nullptr) {
+ if (si->lpCurrentCommand->next != nullptr) // not nullptr
pPrevCmd = si->lpCurrentCommand->next; // next command (newest at beginning)
else
pPrevCmd = si->lpCurrentCommand;
@@ -463,21 +463,21 @@ static char* SM_GetPrevCommand(const wchar_t *pszID, const char *pszModule) // g
else pPrevCmd = si->lpCommands;
si->lpCurrentCommand = pPrevCmd; // make it the new command
- return (pPrevCmd) ? pPrevCmd->lpCommand : NULL;
+ return (pPrevCmd) ? pPrevCmd->lpCommand : nullptr;
}
-static char* SM_GetNextCommand(const wchar_t *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)
+static char* SM_GetNextCommand(const wchar_t *pszID, const char *pszModule) // get next command. returns nullptr if next command does not exist. current command becomes nullptr (a prev command after this one will get you the last command)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
- if (si == NULL)
- return NULL;
+ if (si == nullptr)
+ return nullptr;
- COMMANDINFO *pNextCmd = NULL;
- if (si->lpCurrentCommand != NULL)
+ COMMANDINFO *pNextCmd = nullptr;
+ if (si->lpCurrentCommand != nullptr)
pNextCmd = si->lpCurrentCommand->last; // last command (newest at beginning)
si->lpCurrentCommand = pNextCmd; // make it the new command
- return (pNextCmd) ? pNextCmd->lpCommand : NULL;
+ return (pNextCmd) ? pNextCmd->lpCommand : nullptr;
}
static int SM_GetCount(const char *pszModule)
@@ -505,29 +505,29 @@ static SESSION_INFO* SM_FindSessionByIndex(const char *pszModule, int iItem)
count++;
}
}
- return NULL;
+ return nullptr;
}
char* SM_GetUsers(SESSION_INFO *si)
{
- if (si == NULL)
- return NULL;
+ if (si == nullptr)
+ return nullptr;
- USERINFO *utemp = NULL;
+ USERINFO *utemp = nullptr;
for (int i = 0; i < g_arSessions.getCount(); i++) {
SESSION_INFO *p = g_arSessions[i];
if (si == p) {
- if ((utemp = p->pUsers) == NULL)
- return NULL;
+ if ((utemp = p->pUsers) == nullptr)
+ return nullptr;
break;
}
}
- if (utemp == NULL)
- return NULL;
+ if (utemp == nullptr)
+ return nullptr;
- char* p = NULL;
+ char* p = nullptr;
size_t alloced = 0;
do {
size_t pLen = mir_strlen(p), nameLen = mir_wstrlen(utemp->pszUID);
@@ -538,7 +538,7 @@ char* SM_GetUsers(SESSION_INFO *si)
mir_strcpy(p + pLen + nameLen, " ");
utemp = utemp->next;
}
- while (utemp != NULL);
+ while (utemp != nullptr);
return p;
}
@@ -559,20 +559,20 @@ static void SM_InvalidateLogDirectories()
static MODULEINFO* MM_AddModule(const char *pszModule)
{
- if (pszModule == NULL)
- return NULL;
+ if (pszModule == nullptr)
+ return nullptr;
if (chatApi.MM_FindModule(pszModule))
- return NULL;
+ return nullptr;
MODULEINFO *node = (MODULEINFO*)mir_calloc(g_cbModuleInfo);
replaceStr(node->pszModule, pszModule);
if (chatApi.OnCreateModule)
chatApi.OnCreateModule(node);
- if (m_ModList == NULL) { // list is empty
+ if (m_ModList == nullptr) { // list is empty
m_ModList = node;
- node->next = NULL;
+ node->next = nullptr;
}
else {
node->next = m_ModList;
@@ -585,7 +585,7 @@ static void MM_IconsChanged()
{
LoadChatIcons();
- for (MODULEINFO *mi = m_ModList; mi != NULL; mi = mi->next) {
+ for (MODULEINFO *mi = m_ModList; mi != nullptr; mi = mi->next) {
Safe_DestroyIcon(mi->hOnlineIcon);
Safe_DestroyIcon(mi->hOfflineIcon);
Safe_DestroyIcon(mi->hOnlineTalkIcon);
@@ -598,32 +598,32 @@ static void MM_IconsChanged()
static void MM_FontsChanged()
{
- for (MODULEINFO *mi = m_ModList; mi != NULL; mi = mi->next)
+ for (MODULEINFO *mi = m_ModList; mi != nullptr; mi = mi->next)
mi->pszHeader = chatApi.Log_CreateRtfHeader(mi);
}
static MODULEINFO* MM_FindModule(const char *pszModule)
{
if (!pszModule)
- return NULL;
+ return nullptr;
- for (MODULEINFO *mi = m_ModList; mi != NULL; mi = mi->next)
+ for (MODULEINFO *mi = m_ModList; mi != nullptr; mi = mi->next)
if (mir_strcmpi(mi->pszModule, pszModule) == 0)
return mi;
- return NULL;
+ return nullptr;
}
// stupid thing..
static void MM_FixColors()
{
- for (MODULEINFO *mi = m_ModList; mi != NULL; mi = mi->next)
+ for (MODULEINFO *mi = m_ModList; mi != nullptr; mi = mi->next)
CheckColorsInModule(mi->pszModule);
}
static BOOL MM_RemoveAll(void)
{
- while (m_ModList != NULL) {
+ while (m_ModList != nullptr) {
MODULEINFO *pLast = m_ModList->next;
mir_free(m_ModList->pszModule);
mir_free(m_ModList->ptszModDispName);
@@ -638,7 +638,7 @@ static BOOL MM_RemoveAll(void)
mir_free(m_ModList);
m_ModList = pLast;
}
- m_ModList = NULL;
+ m_ModList = nullptr;
return TRUE;
}
@@ -652,7 +652,7 @@ static BOOL MM_RemoveAll(void)
static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszStatus, int *iCount)
{
if (!ppStatusList || !pszStatus)
- return NULL;
+ return nullptr;
if (!chatApi.TM_FindStatus(*ppStatusList, pszStatus)) {
STATUSINFO *node = (STATUSINFO*)mir_alloc(sizeof(STATUSINFO));
@@ -662,10 +662,10 @@ static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszSta
while ((INT_PTR)node->hIcon > STATUSICONCOUNT - 1)
node->hIcon--;
- if (*ppStatusList == NULL) { // list is empty
+ if (*ppStatusList == nullptr) { // list is empty
node->Status = 1;
*ppStatusList = node;
- node->next = NULL;
+ node->next = nullptr;
}
else {
node->Status = ppStatusList[0]->Status * 2;
@@ -681,9 +681,9 @@ static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszSta
static STATUSINFO* TM_FindStatus(STATUSINFO *pStatusList, const wchar_t *pszStatus)
{
if (!pStatusList || !pszStatus)
- return NULL;
+ return nullptr;
- for (STATUSINFO *pTemp = pStatusList; pTemp != NULL; pTemp = pTemp->next)
+ for (STATUSINFO *pTemp = pStatusList; pTemp != nullptr; pTemp = pTemp->next)
if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
return pTemp;
@@ -695,11 +695,11 @@ static WORD TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus)
if (!pStatusList || !pszStatus)
return 0;
- for (STATUSINFO *pTemp = pStatusList; pTemp != NULL; pTemp = pTemp->next) {
+ for (STATUSINFO *pTemp = pStatusList; pTemp != nullptr; pTemp = pTemp->next) {
if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
return pTemp->Status;
- if (pTemp->next == NULL)
+ if (pTemp->next == nullptr)
return pStatusList->Status;
}
return 0;
@@ -708,9 +708,9 @@ static WORD TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus)
static wchar_t* TM_WordToString(STATUSINFO *pStatusList, WORD Status)
{
if (!pStatusList)
- return NULL;
+ return nullptr;
- for (STATUSINFO *pTemp = pStatusList; pTemp != NULL; pTemp = pTemp->next) {
+ for (STATUSINFO *pTemp = pStatusList; pTemp != nullptr; pTemp = pTemp->next) {
if (pTemp->Status & Status) {
Status -= pTemp->Status;
if (Status == 0)
@@ -725,7 +725,7 @@ static BOOL TM_RemoveAll(STATUSINFO **ppStatusList)
if (!ppStatusList)
return FALSE;
- while (*ppStatusList != NULL) {
+ while (*ppStatusList != nullptr) {
STATUSINFO *pLast = ppStatusList[0]->next;
mir_free(ppStatusList[0]->pszGroup);
if ((INT_PTR)ppStatusList[0]->hIcon > 10)
@@ -733,7 +733,7 @@ static BOOL TM_RemoveAll(STATUSINFO **ppStatusList)
mir_free(*ppStatusList);
*ppStatusList = pLast;
}
- *ppStatusList = NULL;
+ *ppStatusList = nullptr;
return TRUE;
}
@@ -765,17 +765,17 @@ static int UM_CompareItem(USERINFO *u1, const wchar_t *pszNick, WORD wStatus)
static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID)
{
- USERINFO *ui = *ppUserList, *pLast = NULL;
+ USERINFO *ui = *ppUserList, *pLast = nullptr;
if (!ui || !pszUID)
- return NULL;
+ return nullptr;
while (ui && mir_wstrcmpi(ui->pszUID, pszUID)) {
pLast = ui;
ui = ui->next;
}
- if (ui == NULL)
- return NULL;
+ if (ui == nullptr)
+ return nullptr;
USERINFO *node = ui;
if (pLast)
@@ -784,16 +784,16 @@ static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID)
*ppUserList = ui->next;
ui = *ppUserList;
- pLast = NULL;
+ pLast = nullptr;
while (ui && chatApi.UM_CompareItem(ui, node->pszNick, node->Status) <= 0) {
pLast = ui;
ui = ui->next;
}
- if (*ppUserList == NULL) { // list is empty
+ if (*ppUserList == nullptr) { // list is empty
*ppUserList = node;
- node->next = NULL;
+ node->next = nullptr;
}
else {
if (pLast) {
@@ -811,10 +811,10 @@ static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID)
USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const wchar_t *pszUID, const wchar_t *pszNick, WORD wStatus)
{
- if (pStatusList == NULL || ppUserList == NULL || pszNick == NULL)
- return NULL;
+ if (pStatusList == nullptr || ppUserList == nullptr || pszNick == nullptr)
+ return nullptr;
- USERINFO *ui = *ppUserList, *pLast = NULL;
+ USERINFO *ui = *ppUserList, *pLast = nullptr;
while (ui && chatApi.UM_CompareItem(ui, pszNick, wStatus) <= 0) {
pLast = ui;
ui = ui->next;
@@ -824,9 +824,9 @@ USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const wchar
USERINFO *node = (USERINFO*)mir_calloc(sizeof(USERINFO));
replaceStrW(node->pszUID, pszUID);
- if (*ppUserList == NULL) { // list is empty
+ if (*ppUserList == nullptr) { // list is empty
*ppUserList = node;
- node->next = NULL;
+ node->next = nullptr;
}
else {
if (pLast) {
@@ -845,34 +845,34 @@ USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const wchar
static USERINFO* UM_FindUser(USERINFO *pUserList, const wchar_t *pszUID)
{
if (!pUserList || !pszUID)
- return NULL;
+ return nullptr;
- for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next)
+ for (USERINFO *ui = pUserList; ui != nullptr; ui = ui->next)
if (!mir_wstrcmpi(ui->pszUID, pszUID))
return ui;
- return NULL;
+ return nullptr;
}
static USERINFO* UM_FindUserFromIndex(USERINFO *pUserList, int index)
{
if (!pUserList)
- return NULL;
+ return nullptr;
int i = 0;
- for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next) {
+ for (USERINFO *ui = pUserList; ui != nullptr; ui = ui->next) {
if (i == index)
return ui;
i++;
}
- return NULL;
+ return nullptr;
}
static USERINFO* UM_GiveStatus(USERINFO *pUserList, const wchar_t *pszUID, WORD status)
{
USERINFO *ui = UM_FindUser(pUserList, pszUID);
- if (ui == NULL)
- return NULL;
+ if (ui == nullptr)
+ return nullptr;
ui->Status |= status;
return ui;
@@ -881,8 +881,8 @@ static USERINFO* UM_GiveStatus(USERINFO *pUserList, const wchar_t *pszUID, WORD
static USERINFO* UM_SetContactStatus(USERINFO *pUserList, const wchar_t *pszUID, WORD status)
{
USERINFO *ui = UM_FindUser(pUserList, pszUID);
- if (ui == NULL)
- return NULL;
+ if (ui == nullptr)
+ return nullptr;
ui->ContactStatus = status;
return ui;
@@ -893,11 +893,11 @@ static BOOL UM_SetStatusEx(USERINFO *pUserList, const wchar_t* pszText, int flag
int bOnlyMe = (flags & GC_SSE_ONLYLISTED) != 0, bSetStatus = (flags & GC_SSE_ONLINE) != 0;
char cDelimiter = (flags & GC_SSE_TABDELIMITED) ? '\t' : ' ';
- for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next) {
+ for (USERINFO *ui = pUserList; ui != nullptr; ui = ui->next) {
if (!bOnlyMe)
ui->iStatusEx = 0;
- if (pszText != NULL) {
+ if (pszText != nullptr) {
wchar_t *s = (wchar_t *)wcsstr(pszText, ui->pszUID);
if (s) {
ui->iStatusEx = 0;
@@ -915,8 +915,8 @@ static BOOL UM_SetStatusEx(USERINFO *pUserList, const wchar_t* pszText, int flag
static USERINFO* UM_TakeStatus(USERINFO *pUserList, const wchar_t *pszUID, WORD status)
{
USERINFO *ui = UM_FindUser(pUserList, pszUID);
- if (ui == NULL)
- return NULL;
+ if (ui == nullptr)
+ return nullptr;
ui->Status &= ~status;
return ui;
@@ -925,10 +925,10 @@ static USERINFO* UM_TakeStatus(USERINFO *pUserList, const wchar_t *pszUID, WORD
static wchar_t* UM_FindUserAutoComplete(USERINFO *pUserList, const wchar_t* pszOriginal, const wchar_t* pszCurrent)
{
if (!pUserList || !pszOriginal || !pszCurrent)
- return NULL;
+ return nullptr;
- wchar_t *pszName = NULL;
- for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next)
+ wchar_t *pszName = nullptr;
+ for (USERINFO *ui = pUserList; ui != nullptr; ui = ui->next)
if (ui->pszNick && my_strstri(ui->pszNick, pszOriginal) == ui->pszNick)
if (mir_wstrcmpi(ui->pszNick, pszCurrent) > 0 && (!pszName || mir_wstrcmpi(ui->pszNick, pszName) < 0))
pszName = ui->pszNick;
@@ -941,10 +941,10 @@ static BOOL UM_RemoveUser(USERINFO **ppUserList, const wchar_t *pszUID)
if (!ppUserList || !pszUID)
return FALSE;
- USERINFO *ui = *ppUserList, *pLast = NULL;
- while (ui != NULL) {
+ USERINFO *ui = *ppUserList, *pLast = nullptr;
+ while (ui != nullptr) {
if (!mir_wstrcmpi(ui->pszUID, pszUID)) {
- if (pLast == NULL)
+ if (pLast == nullptr)
*ppUserList = ui->next;
else
pLast->next = ui->next;
@@ -964,14 +964,14 @@ static BOOL UM_RemoveAll(USERINFO **ppUserList)
if (!ppUserList)
return FALSE;
- while (*ppUserList != NULL) {
+ while (*ppUserList != nullptr) {
USERINFO *pLast = ppUserList[0]->next;
mir_free(ppUserList[0]->pszUID);
mir_free(ppUserList[0]->pszNick);
mir_free(*ppUserList);
*ppUserList = pLast;
}
- *ppUserList = NULL;
+ *ppUserList = nullptr;
return TRUE;
}
@@ -985,20 +985,20 @@ static BOOL UM_RemoveAll(USERINFO **ppUserList)
static LOGINFO* LM_AddEvent(LOGINFO **ppLogListStart, LOGINFO** ppLogListEnd)
{
if (!ppLogListStart || !ppLogListEnd)
- return NULL;
+ return nullptr;
LOGINFO *node = (LOGINFO*)mir_calloc(sizeof(LOGINFO));
- if (*ppLogListStart == NULL) { // list is empty
+ if (*ppLogListStart == nullptr) { // list is empty
*ppLogListStart = node;
*ppLogListEnd = node;
- node->next = NULL;
- node->prev = NULL;
+ node->next = nullptr;
+ node->prev = nullptr;
}
else {
ppLogListStart[0]->prev = node;
node->next = *ppLogListStart;
*ppLogListStart = node;
- ppLogListStart[0]->prev = NULL;
+ ppLogListStart[0]->prev = nullptr;
}
return node;
@@ -1007,10 +1007,10 @@ static LOGINFO* LM_AddEvent(LOGINFO **ppLogListStart, LOGINFO** ppLogListEnd)
static BOOL LM_TrimLog(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd, int iCount)
{
LOGINFO *pTemp = *ppLogListEnd;
- while (pTemp != NULL && iCount > 0) {
+ while (pTemp != nullptr && iCount > 0) {
*ppLogListEnd = pTemp->prev;
- if (*ppLogListEnd == NULL)
- *ppLogListStart = NULL;
+ if (*ppLogListEnd == nullptr)
+ *ppLogListStart = nullptr;
mir_free(pTemp->ptszNick);
mir_free(pTemp->ptszUserInfo);
@@ -1020,14 +1020,14 @@ static BOOL LM_TrimLog(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd, int iCo
pTemp = *ppLogListEnd;
iCount--;
}
- ppLogListEnd[0]->next = NULL;
+ ppLogListEnd[0]->next = nullptr;
return TRUE;
}
static BOOL LM_RemoveAll(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd)
{
- while (*ppLogListStart != NULL) {
+ while (*ppLogListStart != nullptr) {
LOGINFO *pLast = ppLogListStart[0]->next;
mir_free(ppLogListStart[0]->ptszText);
mir_free(ppLogListStart[0]->ptszNick);
@@ -1036,8 +1036,8 @@ static BOOL LM_RemoveAll(LOGINFO **ppLogListStart, LOGINFO **ppLogListEnd)
mir_free(*ppLogListStart);
*ppLogListStart = pLast;
}
- *ppLogListStart = NULL;
- *ppLogListEnd = NULL;
+ *ppLogListStart = nullptr;
+ *ppLogListEnd = nullptr;
return TRUE;
}
@@ -1049,7 +1049,7 @@ static BOOL DoEventHook(const wchar_t *pszID, const char *pszModule, int iType,
MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _hLangpack)
{
- if (pInit == NULL)
+ if (pInit == nullptr)
return &chatApi;
// wipe out old junk
@@ -1070,14 +1070,14 @@ MIR_APP_DLL(CHAT_MANAGER*) Chat_GetInterface(CHAT_MANAGER_INITDATA *pInit, int _
}
if (g_cbModuleInfo) { // reallocate old modules
mir_cslock lck(csChat);
- MODULEINFO *pPrev = NULL;
+ MODULEINFO *pPrev = nullptr;
for (MODULEINFO *p = m_ModList; p; p = p->next) {
MODULEINFO *p1 = (MODULEINFO*)mir_realloc(p, pInit->cbModuleInfo);
memset(PBYTE(p1) + sizeof(GCModuleInfoBase), 0, pInit->cbModuleInfo - sizeof(GCModuleInfoBase));
if (p1 != p) { // realloc could change a pointer, reinsert a structure
if (m_ModList == p)
m_ModList = p1;
- if (pPrev != NULL)
+ if (pPrev != nullptr)
pPrev->next = p1;
p = p1;
}
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 8256520450..0446d8979d 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -30,17 +30,17 @@ HGENMENU hJoinMenuItem, hLeaveMenuItem;
mir_cs csChat;
static HANDLE
- hServiceRegister = NULL,
- hServiceNewChat = NULL,
- hServiceAddEvent = NULL,
- hServiceGetAddEventPtr = NULL,
- hServiceGetInfo = NULL,
- hServiceGetCount = NULL,
- hEventPrebuildMenu = NULL,
- hEventDoubleclicked = NULL,
- hEventJoinChat = NULL,
- hEventLeaveChat = NULL,
- hHookEvent = NULL;
+ hServiceRegister = nullptr,
+ hServiceNewChat = nullptr,
+ hServiceAddEvent = nullptr,
+ hServiceGetAddEventPtr = nullptr,
+ hServiceGetInfo = nullptr,
+ hServiceGetCount = nullptr,
+ hEventPrebuildMenu = nullptr,
+ hEventDoubleclicked = nullptr,
+ hEventJoinChat = nullptr,
+ hEventLeaveChat = nullptr,
+ hHookEvent = nullptr;
/////////////////////////////////////////////////////////////////////////////////////////
// Post-load event hooks
@@ -81,11 +81,11 @@ static int FontsChanged(WPARAM, LPARAM)
LoadMsgLogBitmaps();
SetIndentSize();
- g_Settings->bLogIndentEnabled = (db_get_b(NULL, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
+ g_Settings->bLogIndentEnabled = (db_get_b(0, CHAT_MODULE, "LogIndentEnabled", 1) != 0) ? TRUE : FALSE;
chatApi.MM_FontsChanged();
chatApi.MM_FixColors();
- chatApi.SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE);
+ chatApi.SM_BroadcastMessage(nullptr, GC_SETWNDPROPS, 0, 0, TRUE);
return 0;
}
@@ -95,14 +95,14 @@ static int IconsChanged(WPARAM, LPARAM)
LoadMsgLogBitmaps();
chatApi.MM_IconsChanged();
- chatApi.SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, FALSE);
+ chatApi.SM_BroadcastMessage(nullptr, GC_SETWNDPROPS, 0, 0, FALSE);
return 0;
}
static int PreShutdown(WPARAM, LPARAM)
{
- if (g_Settings != NULL) {
- chatApi.SM_BroadcastMessage(NULL, GC_CLOSEWINDOW, 0, 1, FALSE);
+ if (g_Settings != nullptr) {
+ chatApi.SM_BroadcastMessage(nullptr, GC_CLOSEWINDOW, 0, 1, FALSE);
SM_RemoveAll();
chatApi.MM_RemoveAll();
@@ -115,7 +115,7 @@ static int PreShutdown(WPARAM, LPARAM)
static int SmileyOptionsChanged(WPARAM, LPARAM)
{
- chatApi.SM_BroadcastMessage(NULL, GC_REDRAWLOG, 0, 1, FALSE);
+ chatApi.SM_BroadcastMessage(nullptr, GC_REDRAWLOG, 0, 1, FALSE);
return 0;
}
@@ -134,7 +134,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_GetInfo(GC_INFO *gci)
si = chatApi.SM_FindSessionByIndex(gci->pszModule, gci->iItem);
else
si = chatApi.SM_FindSession(gci->pszID, gci->pszModule);
- if (si == NULL)
+ if (si == nullptr)
return 1;
if (gci->Flags & GCF_DATA) gci->pItemData = si->pItemData;
@@ -152,12 +152,12 @@ EXTERN_C MIR_APP_DLL(int) Chat_GetInfo(GC_INFO *gci)
MIR_APP_DLL(int) Chat_Register(const GCREGISTER *gcr)
{
- if (gcr == NULL)
+ if (gcr == nullptr)
return GC_ERROR;
mir_cslock lck(csChat);
MODULEINFO *mi = chatApi.MM_AddModule(gcr->pszModule);
- if (mi == NULL)
+ if (mi == nullptr)
return GC_ERROR;
mi->ptszModDispName = mir_wstrdup(gcr->ptszDispName);
@@ -196,19 +196,19 @@ EXTERN_C MIR_APP_DLL(GCSessionInfoBase*) Chat_NewSession(
{
mir_cslockfull lck(csChat);
MODULEINFO *mi = chatApi.MM_FindModule(pszModule);
- if (mi == NULL)
- return NULL;
+ if (mi == nullptr)
+ return nullptr;
// try to restart a session first
SESSION_INFO *si = chatApi.SM_FindSession(ptszID, pszModule);
- if (si != NULL) {
+ if (si != nullptr) {
chatApi.UM_RemoveAll(&si->pUsers);
chatApi.TM_RemoveAll(&si->pStatuses);
lck.unlock();
si->iStatusCount = 0;
si->nUsersInNicklist = 0;
- si->pMe = NULL;
+ si->pMe = nullptr;
if (chatApi.OnReplaceSession)
chatApi.OnReplaceSession(si);
@@ -289,7 +289,7 @@ static INT_PTR __stdcall stubRoomControl(void *param)
case SESSION_INITDONE:
if (SESSION_INFO *si = chatApi.SM_FindSession(p->wszId, p->szModule)) {
SetInitDone(si);
- if (p->command != SESSION_INITDONE || db_get_b(NULL, CHAT_MODULE, "PopupOnJoin", 0) == 0)
+ if (p->command != SESSION_INITDONE || db_get_b(0, CHAT_MODULE, "PopupOnJoin", 0) == 0)
chatApi.ShowRoom(si);
return 0;
}
@@ -369,13 +369,13 @@ static INT_PTR __stdcall stubFlash(void *param)
static void AddUser(GCEVENT *gce)
{
SESSION_INFO *si = chatApi.SM_FindSession(gce->pDest->ptszID, gce->pDest->pszModule);
- if (si == NULL)
+ if (si == nullptr)
return;
WORD status = chatApi.TM_StringToWord(si->pStatuses, gce->ptszStatus);
USERINFO *ui = chatApi.UM_AddUser(si->pStatuses, &si->pUsers, gce->ptszUID, gce->ptszNick, status);
- if (ui == NULL)
+ if (ui == nullptr)
return;
si->nUsersInNicklist++;
@@ -429,11 +429,11 @@ static BOOL AddEventToAllMatchingUID(GCEVENT *gce)
EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
{
- if (gce == NULL)
+ if (gce == nullptr)
return GC_EVENT_ERROR;
GCDEST *gcd = gce->pDest;
- if (gcd == NULL)
+ if (gcd == nullptr)
return GC_EVENT_ERROR;
if (!IsEventSupported(gcd->iType))
@@ -456,7 +456,7 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
return 0;
replaceStrW(si->ptszTopic, pwszNew);
- if (pwszNew != NULL)
+ if (pwszNew != nullptr)
db_set_ws(si->hContact, si->pszModule, "Topic", si->ptszTopic);
else
db_unset(si->hContact, si->pszModule, "Topic");
@@ -464,8 +464,8 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
if (chatApi.OnSetTopic)
chatApi.OnSetTopic(si);
- if (db_get_b(NULL, CHAT_MODULE, "TopicOnClist", 0)) {
- if (pwszNew != NULL)
+ if (db_get_b(0, CHAT_MODULE, "TopicOnClist", 0)) {
+ if (pwszNew != nullptr)
db_set_ws(si->hContact, "CList", "StatusMsg", si->ptszTopic);
else
db_unset(si->hContact, "CList", "StatusMsg");
@@ -475,12 +475,12 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
case GC_EVENT_ADDSTATUS:
SM_GiveStatus(gcd->ptszID, gcd->pszModule, gce->ptszUID, gce->ptszStatus);
- bIsHighlighted = chatApi.IsHighlighted(NULL, gce);
+ bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_REMOVESTATUS:
SM_TakeStatus(gcd->ptszID, gcd->pszModule, gce->ptszUID, gce->ptszStatus);
- bIsHighlighted = chatApi.IsHighlighted(NULL, gce);
+ bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_MESSAGE:
@@ -493,25 +493,25 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
case GC_EVENT_NICK:
SM_ChangeNick(gcd->ptszID, gcd->pszModule, gce);
- bIsHighlighted = chatApi.IsHighlighted(NULL, gce);
+ bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_JOIN:
AddUser(gce);
- bIsHighlighted = chatApi.IsHighlighted(NULL, gce);
+ bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
break;
case GC_EVENT_PART:
case GC_EVENT_QUIT:
case GC_EVENT_KICK:
bRemoveFlag = TRUE;
- bIsHighlighted = chatApi.IsHighlighted(NULL, gce);
+ bIsHighlighted = chatApi.IsHighlighted(nullptr, gce);
break;
}
// Decide which window (log) should have the event
- LPCTSTR pWnd = NULL;
- LPCSTR pMod = NULL;
+ LPCTSTR pWnd = nullptr;
+ LPCSTR pMod = nullptr;
if (gcd->ptszID) {
pWnd = gcd->ptszID;
pMod = gcd->pszModule;
@@ -584,13 +584,13 @@ EXTERN_C MIR_APP_DLL(int) Chat_Event(GCEVENT *gce)
MIR_APP_DLL(int) Chat_AddGroup(const char *szModule, const wchar_t *wszId, const wchar_t *wszText, HICON hIcon)
{
- if (wszText == NULL)
+ if (wszText == nullptr)
return GC_EVENT_ERROR;
mir_cslock lck(csChat);
SESSION_INFO *si = SM_FindSession(wszId, szModule);
- if (si == NULL)
- return NULL;
+ if (si == nullptr)
+ return 0;
STATUSINFO *ti = chatApi.TM_AddStatus(&si->pStatuses, wszText, &si->iStatusCount);
if (ti) {
@@ -606,7 +606,7 @@ MIR_APP_DLL(int) Chat_AddGroup(const char *szModule, const wchar_t *wszId, const
MIR_APP_DLL(int) Chat_ChangeSessionName(const char *szModule, const wchar_t *wszId, const wchar_t *wszNewName)
{
- if (wszNewName == NULL)
+ if (wszNewName == nullptr)
return GC_EVENT_ERROR;
SESSION_INFO *si;
@@ -629,7 +629,7 @@ MIR_APP_DLL(int) Chat_ChangeSessionName(const char *szModule, const wchar_t *wsz
MIR_APP_DLL(int) Chat_ChangeUserId(const char *szModule, const wchar_t *wszId, const wchar_t *wszOldId, const wchar_t *wszNewId)
{
- if (szModule == NULL || wszNewId == NULL)
+ if (szModule == nullptr || wszNewId == nullptr)
return GC_EVENT_ERROR;
mir_cslock lck(csChat);
@@ -652,12 +652,12 @@ MIR_APP_DLL(void*) Chat_GetUserInfo(const char *szModule, const wchar_t *wszId)
mir_cslock lck(csChat);
if (SESSION_INFO *si = chatApi.SM_FindSession(wszId, szModule))
return si->pItemData;
- return NULL;
+ return nullptr;
}
MIR_APP_DLL(int) Chat_SendUserMessage(const char *szModule, const wchar_t *wszId, const wchar_t *wszText)
{
- if (wszText == NULL || szModule == NULL)
+ if (wszText == nullptr || szModule == nullptr)
return GC_EVENT_ERROR;
mir_cslock lck(csChat);
@@ -667,7 +667,7 @@ MIR_APP_DLL(int) Chat_SendUserMessage(const char *szModule, const wchar_t *wszId
continue;
if (si->iType == GCW_CHATROOM || si->iType == GCW_PRIVMESS)
- DoEventHook(si, GC_USER_MESSAGE, NULL, wszText, 0);
+ DoEventHook(si, GC_USER_MESSAGE, nullptr, wszText, 0);
if (wszId)
break;
}
@@ -707,7 +707,7 @@ MIR_APP_DLL(int) Chat_SetStatusEx(const char *szModule, const wchar_t *wszId, in
chatApi.UM_SetStatusEx(si->pUsers, wszText, flags);
if (si->pDlg)
- RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_LIST), NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(si->pDlg->GetHwnd(), IDC_LIST), nullptr, nullptr, RDW_INVALIDATE);
if (wszId)
break;
}
@@ -753,7 +753,7 @@ static int ModulesLoaded(WPARAM, LPARAM)
hLeaveMenuItem = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, LeaveChat);
- chatApi.SetAllOffline(TRUE, NULL);
+ chatApi.SetAllOffline(TRUE, nullptr);
return 0;
}