From 7b19b6715a75c52e0285ee2031a8fa2ddace1da7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 8 Mar 2017 15:46:18 +0300 Subject: code cleaning --- plugins/TabSRMM/src/ImageDataObject.cpp | 10 +- plugins/TabSRMM/src/ImageDataObject.h | 4 +- plugins/TabSRMM/src/TSButton.cpp | 28 +++--- plugins/TabSRMM/src/buttonsbar.cpp | 34 +++---- plugins/TabSRMM/src/chat_log.cpp | 54 +++++------ plugins/TabSRMM/src/chat_main.cpp | 30 +++--- plugins/TabSRMM/src/chat_manager.cpp | 12 +-- plugins/TabSRMM/src/chat_options.cpp | 124 ++++++++++++------------ plugins/TabSRMM/src/chat_tools.cpp | 32 +++---- plugins/TabSRMM/src/chat_window.cpp | 142 +++++++++++++-------------- plugins/TabSRMM/src/contactcache.cpp | 22 ++--- plugins/TabSRMM/src/container.cpp | 144 ++++++++++++++-------------- plugins/TabSRMM/src/containeroptions.cpp | 16 ++-- plugins/TabSRMM/src/controls.cpp | 18 ++-- plugins/TabSRMM/src/eventpopups.cpp | 30 +++--- plugins/TabSRMM/src/generic_msghandlers.cpp | 70 +++++++------- plugins/TabSRMM/src/globals.cpp | 20 ++-- plugins/TabSRMM/src/hotkeyhandler.cpp | 26 ++--- plugins/TabSRMM/src/infopanel.cpp | 28 +++--- plugins/TabSRMM/src/mim.cpp | 32 +++---- plugins/TabSRMM/src/modplus.cpp | 4 +- plugins/TabSRMM/src/msgdialog.cpp | 84 ++++++++-------- plugins/TabSRMM/src/msgdlgutils.cpp | 84 ++++++++-------- plugins/TabSRMM/src/msglog.cpp | 50 +++++----- plugins/TabSRMM/src/msgoptions.cpp | 58 +++++------ plugins/TabSRMM/src/msgs.cpp | 58 +++++------ plugins/TabSRMM/src/msgs.h | 2 +- plugins/TabSRMM/src/muchighlight.cpp | 2 +- plugins/TabSRMM/src/selectcontainer.cpp | 2 +- plugins/TabSRMM/src/sendlater.cpp | 4 +- plugins/TabSRMM/src/sendqueue.cpp | 26 ++--- plugins/TabSRMM/src/sidebar.cpp | 58 +++++------ plugins/TabSRMM/src/sidebar.h | 4 +- plugins/TabSRMM/src/srmm.cpp | 2 +- plugins/TabSRMM/src/tabctrl.cpp | 82 ++++++++-------- plugins/TabSRMM/src/taskbar.cpp | 10 +- plugins/TabSRMM/src/taskbar.h | 4 +- plugins/TabSRMM/src/templates.cpp | 18 ++-- plugins/TabSRMM/src/themeio.cpp | 24 ++--- plugins/TabSRMM/src/themes.cpp | 56 +++++------ plugins/TabSRMM/src/translator.cpp | 20 ++-- plugins/TabSRMM/src/trayicon.cpp | 20 ++-- plugins/TabSRMM/src/typingnotify.cpp | 10 +- plugins/TabSRMM/src/userprefs.cpp | 4 +- plugins/TabSRMM/src/utils.cpp | 48 +++++----- 45 files changed, 806 insertions(+), 804 deletions(-) (limited to 'plugins/TabSRMM/src') diff --git a/plugins/TabSRMM/src/ImageDataObject.cpp b/plugins/TabSRMM/src/ImageDataObject.cpp index 6834c7e56d..22346707f9 100644 --- a/plugins/TabSRMM/src/ImageDataObject.cpp +++ b/plugins/TabSRMM/src/ImageDataObject.cpp @@ -48,7 +48,7 @@ bool CImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap) pRichEditOle->GetClientSite(&pOleClientSite); CComPtr lpLockBytes; - if (FAILED(::CreateILockBytesOnHGlobal(NULL, TRUE, &lpLockBytes))) + if (FAILED(::CreateILockBytesOnHGlobal(nullptr, TRUE, &lpLockBytes))) return false; // Initialize a Storage Object @@ -58,7 +58,7 @@ bool CImageDataObject::InsertBitmap(IRichEditOle* pRichEditOle, HBITMAP hBitmap) // The final ole object which will be inserted in the richedit control CComPtr pOleObject = pods->GetOleObject(pOleClientSite, pStorage); - if (pOleObject == NULL) + if (pOleObject == nullptr) return false; // all items are "contained" -- this makes our reference to this object @@ -88,11 +88,11 @@ void CImageDataObject::SetBitmap(HBITMAP hBitmap) STGMEDIUM stgm; stgm.tymed = TYMED_GDI; // Storage medium = HBITMAP handle stgm.hBitmap = hBitmap; - stgm.pUnkForRelease = NULL; // Use ReleaseStgMedium + stgm.pUnkForRelease = nullptr; // Use ReleaseStgMedium FORMATETC fm; fm.cfFormat = CF_BITMAP; // Clipboard format = CF_BITMAP - fm.ptd = NULL; // Target Device = Screen + fm.ptd = nullptr; // Target Device = Screen fm.dwAspect = DVASPECT_CONTENT; // Level of detail = Full content fm.lindex = -1; // Index = Not applicaple fm.tymed = TYMED_GDI; // Storage medium = HBITMAP handle @@ -104,6 +104,6 @@ IOleObject* CImageDataObject::GetOleObject(IOleClientSite *pOleClientSite, IStor { IOleObject *pOleObject; if (FAILED(::OleCreateStaticFromData(this, IID_IOleObject, OLERENDER_FORMAT, &m_format, pOleClientSite, pStorage, (void **)&pOleObject))) - return NULL; + return nullptr; return pOleObject; } diff --git a/plugins/TabSRMM/src/ImageDataObject.h b/plugins/TabSRMM/src/ImageDataObject.h index d5342d3f05..9a4c9ad5de 100644 --- a/plugins/TabSRMM/src/ImageDataObject.h +++ b/plugins/TabSRMM/src/ImageDataObject.h @@ -80,12 +80,12 @@ public: STDMETHOD(GetData)(FORMATETC*, STGMEDIUM *pmedium) { HANDLE hDst; hDst = ::OleDuplicateData(m_stgmed.hBitmap, CF_BITMAP, 0); - if (hDst == NULL) + if (hDst == nullptr) return E_HANDLE; pmedium->tymed = TYMED_GDI; pmedium->hBitmap = (HBITMAP)hDst; - pmedium->pUnkForRelease = NULL; + pmedium->pUnkForRelease = nullptr; return S_OK; } diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 1cf5f57536..8fa0b55cd2 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -94,11 +94,11 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) bf_buttonglyph.AlphaFormat = 0; } - if (ctl == NULL || hdcPaint == NULL) + if (ctl == nullptr || hdcPaint == nullptr) return; CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(GetParent(ctl->hwnd), GWLP_USERDATA); - if (dat == NULL) + if (dat == nullptr) return; HDC hdcMem; @@ -111,7 +111,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) CopyRect(&rcContent, &rcClient); if (CMimAPI::m_haveBufferedPaint) { - hbp = CMimAPI::m_pfnBeginBufferedPaint(hdcPaint, &rcContent, BPBF_TOPDOWNDIB, NULL, &hdcMem); + hbp = CMimAPI::m_pfnBeginBufferedPaint(hdcPaint, &rcContent, BPBF_TOPDOWNDIB, nullptr, &hdcMem); hbmMem = hOld = 0; } else { @@ -295,9 +295,9 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) sz.cx -= szHot.cx; } if (ctl->arrow) - DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - PluginConfig.m_smcxicon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - PluginConfig.m_smcyicon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); + DrawState(hdcMem, nullptr, nullptr, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - PluginConfig.m_smcxicon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - PluginConfig.m_smcyicon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED); SelectObject(hdcMem, ctl->hFont); - DrawState(hdcMem, NULL, NULL, (LPARAM)szText, mir_wstrlen(szText), (rcText.right - rcText.left - sz.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - sz.cy) / 2 : (rcText.bottom - rcText.top - sz.cy) / 2 - (ctl->stateId == PBS_PRESSED ? 0 : 1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); + DrawState(hdcMem, nullptr, nullptr, (LPARAM)szText, mir_wstrlen(szText), (rcText.right - rcText.left - sz.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - sz.cy) / 2 : (rcText.bottom - rcText.top - sz.cy) / 2 - (ctl->stateId == PBS_PRESSED ? 0 : 1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED); SelectObject(hdcMem, hOldFont); } @@ -363,21 +363,21 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L DeleteObject(ii.hbmMask); DeleteObject(ii.hbmColor); - bct->hBitmap = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hBitmap = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); } else if (wParam == IMAGE_BITMAP) { bct->hBitmap = (HBITMAP)lParam; if (bct->hIconPrivate) DestroyIcon(bct->hIconPrivate); - bct->hIcon = bct->hIconPrivate = NULL; - InvalidateRect(bct->hwnd, NULL, TRUE); + bct->hIcon = bct->hIconPrivate = nullptr; + InvalidateRect(bct->hwnd, nullptr, TRUE); } return 0; case BUTTONSETARROW: // turn arrow on/off bct->arrow = (HICON)wParam; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); return 0; case BUTTONSETASDIMMED: @@ -394,7 +394,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case BUTTONSETASNORMAL: bct->stateId = (wParam) ? PBS_NORMAL : PBS_DISABLED; - InvalidateRect(bct->hwnd, NULL, FALSE); + InvalidateRect(bct->hwnd, nullptr, FALSE); break; case BUTTONGETSTATEID: @@ -428,7 +428,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (bct->sitem->testCloseButton() != -1) return TRUE; bct->stateId = PBS_PRESSED; - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); bct->sitem->activateSession(); } @@ -443,7 +443,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(w, BN_CLICKED), (LPARAM)hwndDlg); } } - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); return 0; } break; @@ -459,7 +459,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_MOUSEMOVE: if (bct->arrow && bct->stateId == PBS_HOT) - InvalidateRect(bct->hwnd, NULL, TRUE); + InvalidateRect(bct->hwnd, nullptr, TRUE); if (bct->sitem) { if (bct->sitem->testCloseButton() != -1) { diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index b3a610fa71..a911db110a 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -142,7 +142,7 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) void CTabBaseDlg::BB_InitDlgButtons() { - BYTE gap = DPISCALEX_S(db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1)); + BYTE gap = DPISCALEX_S(db_get_b(0, SRMSGMOD, "ButtonsBarGap", 1)); RECT rcSplitter; GetWindowRect(GetDlgItem(m_hwnd, (m_bType == SESSIONTYPE_IM) ? IDC_SPLITTERY : IDC_SPLITTERY), &rcSplitter); @@ -159,7 +159,7 @@ void CTabBaseDlg::BB_InitDlgButtons() 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; if (!cbd->m_bHidden) { @@ -208,7 +208,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() HWND hwndButton = 0; - BYTE gap = DPISCALEX_S(db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1)); + BYTE gap = DPISCALEX_S(db_get_b(0, SRMSGMOD, "ButtonsBarGap", 1)); bool showToolbar = !(m_pContainer->dwFlags & CNT_HIDETOOLBAR); bool bBottomToolbar = (m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0; @@ -235,8 +235,8 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() foravatar = m_pic.cx + gap; if ((m_pContainer->dwFlags & CNT_SIDEBAR) && (m_pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_LEFT)) { - if (NULL != hwndToggleSideBar) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, hwndToggleSideBar, NULL, 4, 2 + splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + if (nullptr != hwndToggleSideBar) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, hwndToggleSideBar, nullptr, 4, 2 + splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); lwidth += 10; tempL -= 10; } @@ -251,8 +251,8 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (!showToolbar) { ShowWindow(hwndButton, SW_HIDE); - if (NULL != hwndButton) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, lwidth, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + if (nullptr != hwndButton) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, lwidth, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); if (IsWindowVisible(hwndButton) || (cbd->m_bSeparator && !(cbd->m_bAutoHidden || cbd->m_bHidden))) lwidth += cbd->m_iButtonWidth + gap; if (!IsWindowEnabled(hwndButton) && !IsWindowVisible(hwndButton) && !cbd->m_bAutoHidden) @@ -278,16 +278,16 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() cbd->m_bAutoHidden = 0; } } - if (NULL != hwndButton) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, lwidth, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE);// SWP_NOCOPYBITS); + if (nullptr != hwndButton) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, lwidth, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE);// SWP_NOCOPYBITS); if (IsWindowVisible(hwndButton) || (cbd->m_bSeparator && !(cbd->m_bAutoHidden || cbd->m_bHidden))) lwidth += cbd->m_iButtonWidth + gap; } } if ((m_pContainer->dwFlags & CNT_SIDEBAR) && (m_pContainer->SideBar->getFlags() & CSideBar::SIDEBARORIENTATION_RIGHT)) { - if (NULL != hwndToggleSideBar) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, hwndToggleSideBar, NULL, rect.right - foravatar - 10, 2 + splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + if (nullptr != hwndToggleSideBar) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, hwndToggleSideBar, nullptr, rect.right - foravatar - 10, 2 + splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); rwidth += 12; tempR -= 12; } @@ -303,8 +303,8 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() ShowWindow(hwndButton, SW_HIDE); if (IsWindowVisible(hwndButton) || (cbd->m_bSeparator && !(cbd->m_bAutoHidden || cbd->m_bHidden))) rwidth += cbd->m_iButtonWidth + gap; - if (NULL != hwndButton) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, rect.right - foravatar - rwidth + gap, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + if (nullptr != hwndButton) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, rect.right - foravatar - rwidth + gap, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); if (!IsWindowEnabled(hwndButton) && !IsWindowVisible(hwndButton) && !cbd->m_bAutoHidden) cbd->m_bAutoHidden = 1; continue; @@ -331,8 +331,8 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (IsWindowVisible(hwndButton) || (cbd->m_bSeparator && !(cbd->m_bAutoHidden || cbd->m_bHidden))) rwidth += cbd->m_iButtonWidth + gap; - if (NULL != hwndButton) /* Wine fix. */ - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, rect.right - foravatar - rwidth + gap, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); + if (nullptr != hwndButton) /* Wine fix. */ + hdwp = DeferWindowPos(hdwp, hwndButton, nullptr, rect.right - foravatar - rwidth + gap, splitterY - iOff, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } } return EndDeferWindowPos(hdwp); @@ -351,7 +351,7 @@ void CTabBaseDlg::CB_DestroyAllButtons() void CTabBaseDlg::CB_DestroyButton(DWORD dwButtonCID, DWORD dwFlags) { HWND hwndButton = GetDlgItem(m_hwnd, dwButtonCID); - if (hwndButton == NULL) + if (hwndButton == nullptr) return; RECT rc = { 0 }; @@ -368,7 +368,7 @@ void CTabBaseDlg::CB_DestroyButton(DWORD dwButtonCID, DWORD dwFlags) void CTabBaseDlg::CB_ChangeButton(CustomButtonData *cbd) { HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); - if (hwndButton == NULL) + if (hwndButton == nullptr) return; if (cbd->m_hIcon) diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp index 90d2441eb4..a1fdf98a11 100644 --- a/plugins/TabSRMM/src/chat_log.cpp +++ b/plugins/TabSRMM/src/chat_log.cpp @@ -44,12 +44,12 @@ static char *szDivider = "\\strike---------------------------------------------- static char* u2a(const wchar_t* src, int codepage) { - int cbLen = WideCharToMultiByte(codepage, 0, src, -1, NULL, 0, NULL, NULL); + int cbLen = WideCharToMultiByte(codepage, 0, src, -1, nullptr, 0, nullptr, nullptr); char* result = (char*)mir_alloc(cbLen + 1); - if (result == NULL) - return NULL; + if (result == nullptr) + return nullptr; - WideCharToMultiByte(codepage, 0, src, -1, result, cbLen, NULL, NULL); + WideCharToMultiByte(codepage, 0, src, -1, result, cbLen, nullptr, nullptr); result[cbLen] = 0; return result; } @@ -61,15 +61,15 @@ static char* t2acp(const wchar_t* src, int codepage) static wchar_t *a2tcp(const char *text, int cp) { - if (text != NULL) { - int cbLen = MultiByteToWideChar(cp, 0, text, -1, NULL, 0); + if (text != nullptr) { + int cbLen = MultiByteToWideChar(cp, 0, text, -1, nullptr, 0); wchar_t* result = (wchar_t*)mir_alloc(sizeof(wchar_t)*(cbLen + 1)); - if (result == NULL) - return NULL; + if (result == nullptr) + return nullptr; MultiByteToWideChar(cp, 0, text, -1, result, cbLen); return result; } - return NULL; + return nullptr; } static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, wchar_t **buffer, int *cbBufferEnd, int *cbBufferAlloced, const wchar_t *fmt, ...) @@ -171,7 +171,7 @@ static void AddEventToBufferIEView(wchar_t **buffer, int *bufferEnd, int *buffer switch (streamData->lin->iType) { case GC_EVENT_MESSAGE: if (streamData->lin->ptszText) { - wchar_t *ptszTemp = NULL; + wchar_t *ptszTemp = nullptr; wchar_t *ptszText = streamData->lin->ptszText; if (streamData->dat->codePage != CP_ACP) { char *aText = t2acp(streamData->lin->ptszText, CP_ACP); @@ -251,7 +251,7 @@ static void AddEventToBufferIEView(wchar_t **buffer, int *bufferEnd, int *buffer static void LogEventIEView(LOGSTREAMDATA *streamData, wchar_t *ptszNick) { - wchar_t *buffer = NULL; + wchar_t *buffer = nullptr; int bufferEnd = 0; int bufferAlloced = 0; IEVIEWEVENTDATA ied; @@ -316,7 +316,7 @@ static void LogEventIEView(LOGSTREAMDATA *streamData, wchar_t *ptszNick) ied.dwData |= g_Settings.bShowTime ? IEEDD_GC_SHOW_TIME : 0; ied.dwData |= IEEDD_GC_SHOW_ICON; ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT2; - ied.next = NULL; + ied.next = nullptr; CallService(streamData->dat->m_hwndIEView ? MS_IEVIEW_EVENT : MS_HPP_EG_EVENT, 0, (LPARAM)&event); mir_free(buffer); } @@ -521,12 +521,12 @@ static void Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, CMStringA static void AddEventToBuffer(CMStringA &str, LOGSTREAMDATA *streamData) { wchar_t szTemp[512], szTemp2[512]; - wchar_t* pszNick = NULL; + wchar_t* pszNick = nullptr; - if (streamData == NULL) + if (streamData == nullptr) return; - if (streamData->lin == NULL) + if (streamData->lin == nullptr) return; if (streamData->lin->ptszNick) { @@ -637,10 +637,10 @@ char* Log_CreateRtfHeader(MODULEINFO *mi) // get the number of pixels per logical inch if (pci->logPixelSY == 0) { - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); pci->logPixelSX = GetDeviceCaps(hdc, LOGPIXELSX); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); } // ### RTF HEADER @@ -674,7 +674,7 @@ char* Log_CreateRtfHeader(MODULEINFO *mi) szString[1] = 0; szString[0] = 0x28; - pci->LoadMsgDlgFont(17, &lf, NULL); + pci->LoadMsgDlgFont(17, &lf, nullptr); HFONT hFont = CreateFontIndirect(&lf); int iText = GetTextPixelSize(szString, hFont, true) + 3; DeleteObject(hFont); @@ -717,7 +717,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) while (lin) { // filter if ((streamData->si->iType != GCW_CHATROOM && streamData->si->iType != GCW_PRIVMESS) || !streamData->si->bFilterEnabled || (streamData->si->iLogFilterFlags & lin->iType) != 0) { - if (lin->next != NULL) + if (lin->next != nullptr) str.Append("\\par "); if (streamData->dat->m_dwFlags & MWF_DIVIDERWANTED || lin->dwFlags & MWF_DIVIDERWANTED) { @@ -836,7 +836,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG if (lstrdat) { // create the RTF - if (lstrdat->buffer == NULL) { + if (lstrdat->buffer == nullptr) { lstrdat->bufferOffset = 0; lstrdat->buffer = Log_CreateRTF(lstrdat); lstrdat->bufferLen = (int)mir_strlen(lstrdat->buffer); @@ -850,7 +850,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG // mir_free stuff if the streaming operation is complete if (lstrdat->bufferOffset == lstrdat->bufferLen) { mir_free(lstrdat->buffer); - lstrdat->buffer = NULL; + lstrdat->buffer = nullptr; } } @@ -908,13 +908,13 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, 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); SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); bFlag = true; - // SetCursor(LoadCursor(NULL, IDC_ARROW)); + // SetCursor(LoadCursor(nullptr, IDC_ARROW)); } // stream in the event(s) @@ -974,7 +974,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw) SMADD_RICHEDIT3 sm = { sizeof(sm) }; sm.hwndRichEditControl = hwndRich; sm.Protocolname = si->pszModule; - sm.rangeToReplace = bRedraw ? NULL : &newsel; + sm.rangeToReplace = bRedraw ? nullptr : &newsel; sm.disableRedraw = TRUE; sm.hContact = si->hContact; CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm); @@ -1010,7 +1010,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw) if (oldsel.cpMax != oldsel.cpMin) { SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&oldsel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hwndRich, NULL, TRUE); + InvalidateRect(hwndRich, nullptr, TRUE); } // need to invalidate the window @@ -1018,6 +1018,6 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw) sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich); SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel); SendMessage(hwndRich, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hwndRich, NULL, TRUE); + InvalidateRect(hwndRich, nullptr, TRUE); } } diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index 7ff48d9c6e..aeac520800 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -29,7 +29,7 @@ #include "stdafx.h" HANDLE g_hWindowList; -HMENU g_hMenu = NULL; +HMENU g_hMenu = nullptr; CHAT_MANAGER *pci; TMUCSettings g_Settings; @@ -50,7 +50,7 @@ static void OnReplaceSession(SESSION_INFO *si) if (si->hContact) Chat_SetFilters(si); if (si->hWnd) - RedrawWindow(GetDlgItem(si->hWnd, IDC_LIST), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(si->hWnd, IDC_LIST), nullptr, nullptr, RDW_INVALIDATE); } static void OnSetTopic(SESSION_INFO *si) @@ -84,7 +84,7 @@ static void OnCreateModule(MODULEINFO *mi) static void OnLoadSettings() { - g_Settings.iEventLimitThreshold = db_get_w(NULL, CHAT_MODULE, "LogLimitThreshold", 20); + g_Settings.iEventLimitThreshold = db_get_w(0, CHAT_MODULE, "LogLimitThreshold", 20); g_Settings.dwIconFlags = M.GetDword(CHAT_MODULE, "IconFlags", 0x0000); g_Settings.bOpenInDefault = M.GetBool(CHAT_MODULE, "DefaultContainer", true); g_Settings.UserListColors[CHAT_STATUS_NORMAL] = M.GetDword(CHATFONT_MODULE, "Font18Col", RGB(0, 0, 0)); @@ -122,13 +122,13 @@ static void OnLoadSettings() } LOGFONT lf; - pci->LoadMsgDlgFont(18, &lf, NULL); + pci->LoadMsgDlgFont(18, &lf, nullptr); g_Settings.UserListFonts[CHAT_STATUS_NORMAL] = CreateFontIndirect(&lf); - pci->LoadMsgDlgFont(19, &lf, NULL); + pci->LoadMsgDlgFont(19, &lf, nullptr); g_Settings.UserListFonts[CHAT_STATUS_AWAY] = CreateFontIndirect(&lf); - pci->LoadMsgDlgFont(5, &lf, NULL); + pci->LoadMsgDlgFont(5, &lf, nullptr); g_Settings.UserListFonts[CHAT_STATUS_OFFLINE] = CreateFontIndirect(&lf); int ih = GetTextPixelSize(L"AQGglo", g_Settings.UserListFonts[CHAT_STATUS_NORMAL], false); @@ -170,30 +170,30 @@ static int CopyChatSetting(const char *szSetting, LPARAM param) static void CheckUpdate() { // already converted? - int compat = db_get_b(NULL, "Compatibility", "TabChatFonts", 0); + int compat = db_get_b(0, "Compatibility", "TabChatFonts", 0); if (compat >= 3) return; if (compat == 0) { LIST szSettings(120); - db_enum_settings(NULL, CopyChatSetting, CHAT_OLDFONTMODULE, &szSettings); + db_enum_settings(0, CopyChatSetting, CHAT_OLDFONTMODULE, &szSettings); DBVARIANT dbv; for (int i = szSettings.getCount() - 1; i >= 0; i--) { char *p = szSettings[i]; - db_get(NULL, CHAT_OLDFONTMODULE, p, &dbv); - db_set(NULL, CHATFONT_MODULE, p, &dbv); + db_get(0, CHAT_OLDFONTMODULE, p, &dbv); + db_set(0, CHATFONT_MODULE, p, &dbv); db_free(&dbv); mir_free(p); } - db_delete_module(NULL, CHAT_OLDFONTMODULE); + db_delete_module(0, CHAT_OLDFONTMODULE); compat++; } if (compat == 1) { DWORD oldBackColor = db_get_dw(0, FONTMODULE, "BkgColourMUC", SRMSGDEFSET_BKGCOLOUR); - db_set_dw(NULL, CHAT_MODULE, "ColorLogBG", oldBackColor); + db_set_dw(0, CHAT_MODULE, "ColorLogBG", oldBackColor); db_unset(0, FONTMODULE, "BkgColourMUC"); compat++; } @@ -201,12 +201,12 @@ static void CheckUpdate() if (compat == 2) { COLORREF color0 = M.GetDword(CHAT_MODULE, "NickColor2", 0); COLORREF color2 = M.GetDword(CHAT_MODULE, "NickColor0", 0); - db_set_dw(NULL, CHAT_MODULE, "NickColor0", color0); - db_set_dw(NULL, CHAT_MODULE, "NickColor2", color2); + db_set_dw(0, CHAT_MODULE, "NickColor0", color0); + db_set_dw(0, CHAT_MODULE, "NickColor2", color2); compat++; } - db_set_b(NULL, "Compatibility", "TabChatFonts", 3); + db_set_b(0, "Compatibility", "TabChatFonts", 3); } // load the module diff --git a/plugins/TabSRMM/src/chat_manager.cpp b/plugins/TabSRMM/src/chat_manager.cpp index 3a93a8a444..cff97336cf 100644 --- a/plugins/TabSRMM/src/chat_manager.cpp +++ b/plugins/TabSRMM/src/chat_manager.cpp @@ -28,7 +28,7 @@ static int sttCompareNicknames(const wchar_t *s1, const wchar_t *s2) { - if (s2 == NULL) + if (s2 == nullptr) return 1; // skip rubbish @@ -89,7 +89,7 @@ SESSION_INFO* SM_FindSessionByHWND(HWND hWnd) if (si->hWnd == hWnd) return si; - return NULL; + return nullptr; } SESSION_INFO* SM_FindSessionByHCONTACT(MCONTACT h) @@ -98,19 +98,19 @@ SESSION_INFO* SM_FindSessionByHCONTACT(MCONTACT h) if (si->hContact == h) return si; - return NULL; + return nullptr; } SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const wchar_t* pszOriginal, const wchar_t* pszCurrent) { - if (prevSession == NULL && my_strstri(currSession->ptszName, pszOriginal) == currSession->ptszName) + if (prevSession == nullptr && my_strstri(currSession->ptszName, pszOriginal) == currSession->ptszName) return currSession; - wchar_t *pszName = NULL; + wchar_t *pszName = nullptr; if (currSession == prevSession) pszCurrent = pszOriginal; - SESSION_INFO *pResult = NULL; + SESSION_INFO *pResult = nullptr; for (SESSION_INFO *si = pci->wndList; si; si = si->next) if (si != currSession && !mir_strcmpi(pszModule, si->pszModule)) if (my_strstri(si->ptszName, pszOriginal) == si->ptszName) diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 15d829834f..5566b3d538 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -136,40 +136,40 @@ struct branch_t HTREEITEM hItem; }; static branch_t branch1[] = { - { LPGENW("Open new chat rooms in the default container"), "DefaultContainer", 0, 1, NULL }, - { LPGENW("Flash window when someone speaks"), "FlashWindow", 0, 0, NULL }, - { LPGENW("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL }, - { LPGENW("Create tabs or windows for highlight events"), "CreateWindowOnHighlight", 0, 0, NULL }, - { LPGENW("Activate chat window on highlight"), "AnnoyingHighlight", 0, 0, NULL }, - { LPGENW("Show list of users in the chat room"), "ShowNicklist", 0, 1, NULL }, - { LPGENW("Colorize nicknames in member list"), "ColorizeNicks", 0, 1, NULL }, - { LPGENW("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 1, NULL }, - { LPGENW("Show topic as status message on the contact list"), "TopicOnClist", 0, 1, NULL }, - { LPGENW("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0, NULL }, - { LPGENW("Hide or show the window by double click in the contact list"), "ToggleVisibility", 0, 0, NULL }, - { LPGENW("Sync splitter position with standard IM sessions"), "SyncSplitter", 0, 0, NULL }, - { LPGENW("Show contact's status modes if supported by the protocol"), "ShowContactStatus", 0, 1, NULL }, - { LPGENW("Display contact's status icon before user role icon"), "ContactStatusFirst", 0, 0, NULL }, - { LPGENW("Use IRC style status indicators in the nick list"), "ClassicIndicators", 0, 0, NULL }, - { LPGENW("Use alternative sorting method in member list"), "AlternativeSorting", 0, 1, NULL } + { LPGENW("Open new chat rooms in the default container"), "DefaultContainer", 0, 1, nullptr }, + { LPGENW("Flash window when someone speaks"), "FlashWindow", 0, 0, nullptr }, + { LPGENW("Flash window when a word is highlighted"), "FlashWindowHighlight", 0, 1, nullptr }, + { LPGENW("Create tabs or windows for highlight events"), "CreateWindowOnHighlight", 0, 0, nullptr }, + { LPGENW("Activate chat window on highlight"), "AnnoyingHighlight", 0, 0, nullptr }, + { LPGENW("Show list of users in the chat room"), "ShowNicklist", 0, 1, nullptr }, + { LPGENW("Colorize nicknames in member list"), "ColorizeNicks", 0, 1, nullptr }, + { LPGENW("Show button menus when right clicking the buttons"), "RightClickFilter", 0, 1, nullptr }, + { LPGENW("Show topic as status message on the contact list"), "TopicOnClist", 0, 1, nullptr }, + { LPGENW("Do not pop up the window when joining a chat room"), "PopupOnJoin", 0, 0, nullptr }, + { LPGENW("Hide or show the window by double click in the contact list"), "ToggleVisibility", 0, 0, nullptr }, + { LPGENW("Sync splitter position with standard IM sessions"), "SyncSplitter", 0, 0, nullptr }, + { LPGENW("Show contact's status modes if supported by the protocol"), "ShowContactStatus", 0, 1, nullptr }, + { LPGENW("Display contact's status icon before user role icon"), "ContactStatusFirst", 0, 0, nullptr }, + { LPGENW("Use IRC style status indicators in the nick list"), "ClassicIndicators", 0, 0, nullptr }, + { LPGENW("Use alternative sorting method in member list"), "AlternativeSorting", 0, 1, nullptr } }; static branch_t branch2[] = { - { LPGENW("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL }, - { LPGENW("Timestamp only when event time differs"), "ShowTimeStampIfChanged", 0, 0, NULL }, - { LPGENW("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0, NULL }, - { LPGENW("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL }, - { LPGENW("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1, NULL }, - { LPGENW("Add a colon (:) to auto-completed user names"), "AddColonToAutoComplete", 0, 1, NULL }, - { LPGENW("Add a comma instead of a colon to auto-completed user names"), "UseCommaAsColon", 0, 0, NULL }, - { LPGENW("Start private conversation on double click in nick list (insert nick if unchecked)"), "DoubleClick4Privat", 0, 0, NULL }, - { LPGENW("Strip colors from messages in the log"), "StripFormatting", 0, 0, NULL }, - { LPGENW("Enable the 'event filter' for new rooms"), "FilterEnabled", 0, 0, NULL }, - { LPGENW("Use IRC style status indicators in the log"), "LogClassicIndicators", 0, 0, NULL }, - { LPGENW("Allow clickable user names in the message log"), "ClickableNicks", 0, 1, NULL }, - { LPGENW("Add new line after names"), "NewlineAfterNames", 0, 0, NULL }, - { LPGENW("Colorize user names in message log"), "ColorizeNicksInLog", 0, 1, NULL }, - { LPGENW("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, NULL } + { LPGENW("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, nullptr }, + { LPGENW("Timestamp only when event time differs"), "ShowTimeStampIfChanged", 0, 0, nullptr }, + { LPGENW("Timestamp has same color as the event"), "TimeStampEventColour", 0, 0, nullptr }, + { LPGENW("Indent the second line of a message"), "LogIndentEnabled", 0, 1, nullptr }, + { LPGENW("Limit user names in the message log to 20 characters"), "LogLimitNames", 0, 1, nullptr }, + { LPGENW("Add a colon (:) to auto-completed user names"), "AddColonToAutoComplete", 0, 1, nullptr }, + { LPGENW("Add a comma instead of a colon to auto-completed user names"), "UseCommaAsColon", 0, 0, nullptr }, + { LPGENW("Start private conversation on double click in nick list (insert nick if unchecked)"), "DoubleClick4Privat", 0, 0, nullptr }, + { LPGENW("Strip colors from messages in the log"), "StripFormatting", 0, 0, nullptr }, + { LPGENW("Enable the 'event filter' for new rooms"), "FilterEnabled", 0, 0, nullptr }, + { LPGENW("Use IRC style status indicators in the log"), "LogClassicIndicators", 0, 0, nullptr }, + { LPGENW("Allow clickable user names in the message log"), "ClickableNicks", 0, 1, nullptr }, + { LPGENW("Add new line after names"), "NewlineAfterNames", 0, 0, nullptr }, + { LPGENW("Colorize user names in message log"), "ColorizeNicksInLog", 0, 1, nullptr }, + { LPGENW("Scale down icons to 10x10 pixels in the chat log"), "ScaleIcons", 0, 1, nullptr } }; static HWND hPathTip = 0; @@ -223,8 +223,8 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM wcsncpy_s(lf->lfFaceName, L"Webdings", _TRUNCATE); } else { - ptrW tszDefFace(db_get_wsa(NULL, szMod, str)); - if (tszDefFace == NULL) + ptrW tszDefFace(db_get_wsa(0, szMod, str)); + if (tszDefFace == nullptr) wcsncpy_s(lf->lfFaceName, fol[j].szDefFace, _TRUNCATE); else wcsncpy_s(lf->lfFaceName, tszDefFace, _TRUNCATE); @@ -235,7 +235,7 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM static HTREEITEM InsertBranch(HWND hwndTree, wchar_t* pszDescr, BOOL bExpanded) { TVINSERTSTRUCT tvis; - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; tvis.item.pszText = TranslateW(pszDescr); @@ -354,8 +354,8 @@ HICON LoadIconEx(char *pszIcoLibName) static void InitSetting(wchar_t* &ppPointer, const char *pszSetting, const wchar_t *pszDefault) { - ptrW val(db_get_wsa(NULL, CHAT_MODULE, pszSetting)); - replaceStrW(ppPointer, (val != NULL) ? val : pszDefault); + ptrW val(db_get_wsa(0, CHAT_MODULE, pszSetting)); + replaceStrW(ppPointer, (val != nullptr) ? val : pszDefault); } #define OPT_FIXHEADINGS (WM_USER+1) @@ -365,11 +365,11 @@ static UINT _o1controls[] = { IDC_CHECKBOXES, IDC_GROUP, IDC_STATIC_ADD }; HWND CreateToolTip(HWND hwndParent, LPTSTR ptszText, LPTSTR ptszTitle) { HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, - TOOLTIPS_CLASS, NULL, + TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hwndParent, NULL, g_hInst, NULL); + hwndParent, nullptr, g_hInst, nullptr); SetWindowPos(hwndTT, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -408,7 +408,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading1, branch1, _countof(branch1), 0x0000); FillBranch(GetDlgItem(hwndDlg, IDC_CHECKBOXES), hListHeading2, branch2, _countof(branch2), 0x0000); - wchar_t* pszGroup = NULL; + wchar_t* pszGroup = nullptr; InitSetting(pszGroup, "AddToGroup", L"Chat rooms"); SetDlgItemText(hwndDlg, IDC_GROUP, pszGroup); mir_free(pszGroup); @@ -433,16 +433,16 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: int iLen; - wchar_t *pszText = NULL; + wchar_t *pszText = nullptr; BYTE b; iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_GROUP)); if (iLen > 0) { pszText = (wchar_t*)mir_realloc(pszText, (iLen + 2) * 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_ws(NULL, CHAT_MODULE, "AddToGroup", L""); + else db_set_ws(0, CHAT_MODULE, "AddToGroup", L""); mir_free(pszText); @@ -453,7 +453,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM pci->ReloadSettings(); pci->MM_IconsChanged(); pci->MM_FontsChanged(); - pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); + pci->SM_BroadcastMessage(nullptr, GC_SETWNDPROPS, 0, 0, TRUE); SM_ReconfigureFilters(); return TRUE; } @@ -672,7 +672,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM TranslateDialogDefault(hwndDlg); { SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETRANGE, 0, MAKELONG(5000, 0)); - SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LogLimit", 100), 0)); + SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LogLimit", 100), 0)); SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETRANGE, 0, MAKELONG(255, 10)); SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_SETPOS, 0, MAKELONG(M.GetByte(CHAT_MODULE, "NicklistRowDist", 12), 0)); SetDlgItemText(hwndDlg, IDC_LOGTIMESTAMP, g_Settings.pszTimeStampLog); @@ -684,7 +684,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM Utils::enableDlgControl(hwndDlg, IDC_LOGDIRECTORY, g_Settings.bLoggingEnabled); Utils::enableDlgControl(hwndDlg, IDC_FONTCHOOSE, g_Settings.bLoggingEnabled); SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETRANGE, 0, MAKELONG(10000, 0)); - SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, CHAT_MODULE, "LoggingLimit", 100), 0)); + SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_SETPOS, 0, MAKELONG(db_get_w(0, CHAT_MODULE, "LoggingLimit", 100), 0)); Utils::enableDlgControl(hwndDlg, IDC_LIMIT, g_Settings.bLoggingEnabled); wchar_t tszTooltipText[2048]; @@ -723,7 +723,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM hPathTip = CreateToolTip(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), tszTooltipText, TranslateT("Variables")); } if (hPathTip) - SetTimer(hwndDlg, 0, 3000, NULL); + SetTimer(hwndDlg, 0, 3000, nullptr); break; case WM_COMMAND: @@ -818,66 +818,66 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM case WM_NOTIFY: if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY) { - char *pszText = NULL; + char *pszText = nullptr; int iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY)); if (iLen > 0) { wchar_t *pszText1 = (wchar_t*)mir_alloc(iLen*sizeof(wchar_t) + 2); GetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, pszText1, iLen + 1); - db_set_ws(NULL, CHAT_MODULE, "LogDirectory", pszText1); + db_set_ws(0, CHAT_MODULE, "LogDirectory", pszText1); mir_free(pszText1); g_Settings.bLoggingEnabled = IsDlgButtonChecked(hwndDlg, IDC_LOGGING) == BST_CHECKED; db_set_b(0, CHAT_MODULE, "LoggingEnabled", g_Settings.bLoggingEnabled); } else { - db_unset(NULL, CHAT_MODULE, "LogDirectory"); + db_unset(0, CHAT_MODULE, "LogDirectory"); db_set_b(0, CHAT_MODULE, "LoggingEnabled", 0); } pci->SM_InvalidateLogDirectories(); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN4, UDM_GETPOS, 0, 0); - db_set_w(NULL, CHAT_MODULE, "LoggingLimit", (WORD)iLen); + db_set_w(0, CHAT_MODULE, "LoggingLimit", (WORD)iLen); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN3, UDM_GETPOS, 0, 0); if (iLen > 0) db_set_b(0, CHAT_MODULE, "NicklistRowDist", (BYTE)iLen); else - db_unset(NULL, CHAT_MODULE, "NicklistRowDist"); + db_unset(0, CHAT_MODULE, "NicklistRowDist"); iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_LOGTIMESTAMP)); if (iLen > 0) { pszText = (char *)mir_realloc(pszText, iLen + 1); GetDlgItemTextA(hwndDlg, IDC_LOGTIMESTAMP, pszText, iLen + 1); - db_set_s(NULL, CHAT_MODULE, "LogTimestamp", pszText); + db_set_s(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 = (char *)mir_realloc(pszText, iLen + 1); GetDlgItemTextA(hwndDlg, IDC_TIMESTAMP, pszText, iLen + 1); - db_set_s(NULL, CHAT_MODULE, "HeaderTime", pszText); + db_set_s(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 = (char *)mir_realloc(pszText, iLen + 1); GetDlgItemTextA(hwndDlg, IDC_INSTAMP, pszText, iLen + 1); - db_set_s(NULL, CHAT_MODULE, "HeaderIncoming", pszText); + db_set_s(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 = (char *)mir_realloc(pszText, iLen + 1); GetDlgItemTextA(hwndDlg, IDC_OUTSTAMP, pszText, iLen + 1); - db_set_s(NULL, CHAT_MODULE, "HeaderOutgoing", pszText); + db_set_s(0, CHAT_MODULE, "HeaderOutgoing", pszText); } - else db_unset(NULL, CHAT_MODULE, "HeaderOutgoing"); + else db_unset(0, CHAT_MODULE, "HeaderOutgoing"); iLen = SendDlgItemMessage(hwndDlg, IDC_CHAT_SPIN2, UDM_GETPOS, 0, 0); - db_set_w(NULL, CHAT_MODULE, "LogLimit", (WORD)iLen); + db_set_w(0, CHAT_MODULE, "LogLimit", (WORD)iLen); mir_free(pszText); if (pci->hListBkgBrush) @@ -887,7 +887,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM pci->ReloadSettings(); pci->MM_FontsChanged(); pci->MM_FixColors(); - pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); + pci->SM_BroadcastMessage(nullptr, GC_SETWNDPROPS, 0, 0, TRUE); PluginConfig.reloadSettings(); CacheMsgLogIcons(); @@ -995,7 +995,7 @@ INT_PTR CALLBACK DlgProcOptions3(HWND hwndDlg, UINT uMsg, WPARAM, LPARAM lParam) pci->ReloadSettings(); pci->MM_FontsChanged(); - pci->SM_BroadcastMessage(NULL, GC_SETWNDPROPS, 0, 0, TRUE); + pci->SM_BroadcastMessage(nullptr, GC_SETWNDPROPS, 0, 0, TRUE); SM_ReconfigureFilters(); return TRUE; } diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 329ba9b6b3..68c5cf40a9 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -113,7 +113,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa pd.lchIcon = LoadIconEx("window"); PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName); - mir_snwprintf(pd.lptzContactName, L"%s - %s", (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, pcli->pfnGetContactDisplayName(hContact, 0)); + mir_snwprintf(pd.lptzContactName, L"%s - %s", (pa == nullptr) ? _A2T(pszProtoName) : pa->tszAccountName, pcli->pfnGetContactDisplayName(hContact, 0)); wcsncpy_s(pd.lptzText, TranslateW(szBuf), _TRUNCATE); pd.iSeconds = g_Settings.iPopupTimeout; @@ -138,11 +138,11 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) { int iEvent = gce->pDest->iType; - if (si == NULL || !(iEvent & si->iLogPopupFlags)) + if (si == nullptr || !(iEvent & si->iLogPopupFlags)) return true; CTabBaseDlg *dat = si->dat; - TContainerData *pContainer = dat ? dat->m_pContainer : NULL; + TContainerData *pContainer = dat ? dat->m_pContainer : nullptr; wchar_t *bbStart, *bbEnd; if (g_Settings.bBBCodeInPopups) { @@ -160,7 +160,7 @@ BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce) char *szProto = dat ? dat->m_szProto : si->pszModule; if (nen_options.dwStatusMask != -1) { DWORD dwStatus = 0; - if (szProto != NULL) { + if (szProto != nullptr) { dwStatus = (DWORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0); if (!(dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE || ((1 << (dwStatus - ID_STATUS_ONLINE)) & nen_options.dwStatusMask))) // should never happen, but... return 0; @@ -241,7 +241,7 @@ void DoFlashAndSoundWorker(FLASH_PARAMS* p) dat->m_iFlashIcon = p->hNotifyIcon; } dat->m_bCanFlashTab = TRUE; - SetTimer(si->hWnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); + SetTimer(si->hWnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr); } } if (dat->m_pWnd) { @@ -299,7 +299,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (gce == 0 || si == 0 || gce->bIsMe || si->iType == GCW_SERVER) return FALSE; - CTabBaseDlg *dat = NULL; + CTabBaseDlg *dat = nullptr; FLASH_PARAMS *params = (FLASH_PARAMS*)mir_calloc(sizeof(FLASH_PARAMS)); params->hContact = si->hContact; params->bInactive = TRUE; @@ -323,7 +323,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight DoTrayIcon(si, gce); } - if (g_Settings.bCreateWindowOnHighlight && dat == NULL) + if (g_Settings.bCreateWindowOnHighlight && dat == nullptr) wParamForHighLight = 1; if (dat && g_Settings.bAnnoyingHighlight && params->bInactive && dat->m_pContainer->hwnd != GetForegroundWindow()) { @@ -484,7 +484,7 @@ wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2) if (!s2[k + 1]) return (wchar_t*)(s1 + i); - return NULL; + return nullptr; } /* @@ -522,12 +522,12 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO EnableMenuItem(*hMenu, ID_CLEARLOG, MF_ENABLED); EnableMenuItem(*hMenu, ID_COPYALL, MF_ENABLED); - ModifyMenu(*hMenu, 4, MF_GRAYED | MF_BYPOSITION, 4, NULL); + ModifyMenu(*hMenu, 4, MF_GRAYED | MF_BYPOSITION, 4, nullptr); if (!i) { EnableMenuItem(*hMenu, ID_COPYALL, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(*hMenu, ID_CLEARLOG, MF_BYCOMMAND | MF_GRAYED); if (pszWordText && pszWordText[0]) - ModifyMenu(*hMenu, 4, MF_ENABLED | MF_BYPOSITION, 4, NULL); + ModifyMenu(*hMenu, 4, MF_ENABLED | MF_BYPOSITION, 4, nullptr); } if (pszWordText && pszWordText[0]) { @@ -589,7 +589,7 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO InsertMenu(*hMenu, pos, MF_BYPOSITION, (UINT_PTR)20021, TranslateT("Edit highlight list...")); } - return TrackPopupMenu(*hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + return TrackPopupMenu(*hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); } void DestroyGCMenu(HMENU *hMenu, int iIndex) @@ -598,7 +598,7 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex) mii.cbSize = sizeof(mii); mii.fMask = MIIM_SUBMENU; while (GetMenuItemInfo(*hMenu, iIndex, TRUE, &mii)) { - if (mii.hSubMenu != NULL) + if (mii.hSubMenu != nullptr) DestroyMenu(mii.hSubMenu); RemoveMenu(*hMenu, iIndex, MF_BYPOSITION); } @@ -610,7 +610,7 @@ void DestroyGCMenu(HMENU *hMenu, int iIndex) */ void Chat_SetFilters(SESSION_INFO *si) { - if (si == NULL) + if (si == nullptr) return; DWORD dwFlags_default = M.GetDword(CHAT_MODULE, "FilterFlags", GC_EVENT_ALL); @@ -674,15 +674,15 @@ char GetIndicator(SESSION_INFO *si, LPCTSTR ptszNick, int *iNickIndex) bool IsHighlighted(SESSION_INFO *si, GCEVENT *gce) { if (!g_Settings.bHighlightEnabled || !gce || gce->bIsMe) - return FALSE; + return false; GCEVENT evTmp = *gce; int dwMask = 0; - if (gce->ptszText != NULL) + if (gce->ptszText != nullptr) dwMask |= CMUCHighlight::MATCH_TEXT; - if (gce->ptszNick != NULL) { + if (gce->ptszNick != nullptr) { dwMask |= CMUCHighlight::MATCH_NICKNAME; if (si && g_Settings.bLogClassicIndicators) { size_t len = mir_wstrlen(gce->ptszNick) + 1; diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index da5e408c66..90d1f524c2 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -37,7 +37,7 @@ int g_iWheelCarryover = 0; extern HMENU g_hMenu; -static HKL hkl = NULL; +static HKL hkl = nullptr; char szIndicators[] = { 0, '+', '%', '@', '!', '*' }; struct MESSAGESUBDATA @@ -60,10 +60,10 @@ static BOOL CheckCustomLink(HWND hwndDlg, POINT *ptClient, UINT uMsg, WPARAM wPa long res = 0, cnt = 0; long cpMin = 0, cpMax = 0; POINT ptEnd = { 0 }; - IRichEditOle *RichEditOle = NULL; - ITextDocument *TextDocument = NULL; - ITextRange *TextRange = NULL; - ITextFont *TextFont = NULL; + IRichEditOle *RichEditOle = nullptr; + ITextDocument *TextDocument = nullptr; + ITextRange *TextRange = nullptr; + ITextFont *TextFont = nullptr; BOOL bIsCustomLink = FALSE; POINT pt = *ptClient; @@ -131,7 +131,7 @@ static BOOL CheckCustomLink(HWND hwndDlg, POINT *ptClient, UINT uMsg, WPARAM wPa bool IsStringValidLink(wchar_t *pszText) { - if (pszText == NULL) + if (pszText == nullptr) return false; if (mir_wstrlen(pszText) < 5 || wcschr(pszText, '"')) @@ -140,7 +140,7 @@ bool IsStringValidLink(wchar_t *pszText) if (towlower(pszText[0]) == 'w' && towlower(pszText[1]) == 'w' && towlower(pszText[2]) == 'w' && pszText[3] == '.' && iswalnum(pszText[4])) return true; - return wcsstr(pszText, L"://") != NULL; + return wcsstr(pszText, L"://") != nullptr; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -149,7 +149,7 @@ bool IsStringValidLink(wchar_t *pszText) void CChatRoomDlg::UpdateWindowState(UINT msg) { - if (si == NULL) + if (si == nullptr) return; if (msg == WM_ACTIVATE) { @@ -237,7 +237,7 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) } BB_SetButtonsPos(); if (M.isAero()) - InvalidateRect(m_hwndParent, NULL, FALSE); + InvalidateRect(m_hwndParent, nullptr, FALSE); if (m_pContainer->dwFlags & CNT_SIDEBAR) m_pContainer->SideBar->setActiveItem(this); @@ -394,7 +394,7 @@ static bool TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) return false; bool isTopic = false, isRoom = false; - wchar_t *pszName = NULL; + wchar_t *pszName = nullptr; wchar_t *pszText = (wchar_t*)mir_calloc((iLen + 10) * sizeof(wchar_t)); gt.flags = GT_DEFAULT; @@ -404,7 +404,7 @@ static bool TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) if (start > 1 && pszText[start - 1] == ' ' && pszText[start - 2] == ':') start -= 2; - if (dat->szSearchResult != NULL) { + if (dat->szSearchResult != nullptr) { int cbResult = (int)mir_wstrlen(dat->szSearchResult); if (start >= cbResult && !wcsnicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) { start -= cbResult; @@ -428,23 +428,23 @@ LBL_SkipEnd: if (topicStart > 5 && wcsstr(&pszText[topicStart - 6], L"/topic") == &pszText[topicStart - 6]) isTopic = TRUE; } - if (dat->szSearchQuery == NULL) { + if (dat->szSearchQuery == nullptr) { dat->szSearchQuery = mir_wstrndup(pszText + start, end - start); dat->szSearchResult = mir_wstrdup(dat->szSearchQuery); - dat->lastSession = NULL; + dat->lastSession = nullptr; } if (isTopic) pszName = si->ptszTopic; else if (isRoom) { dat->lastSession = SM_FindSessionAutoComplete(si->pszModule, si, dat->lastSession, dat->szSearchQuery, dat->szSearchResult); - if (dat->lastSession != NULL) + if (dat->lastSession != nullptr) pszName = dat->lastSession->ptszName; } else pszName = pci->UM_FindUserAutoComplete(si->pUsers, dat->szSearchQuery, dat->szSearchResult); - replaceStrW(dat->szSearchResult, NULL); + replaceStrW(dat->szSearchResult, nullptr); - if (pszName != NULL) { + if (pszName != nullptr) { dat->szSearchResult = mir_wstrdup(pszName); if (end != start) { ptrW szReplace; @@ -464,7 +464,7 @@ LBL_SkipEnd: SendMessage(hwnd, EM_SETSEL, start, end); SendMessage(hwnd, EM_REPLACESEL, TRUE, (LPARAM)dat->szSearchQuery); } - replaceStrW(dat->szSearchQuery, NULL); + replaceStrW(dat->szSearchQuery, nullptr); return false; } @@ -524,7 +524,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, mwpd.pt = pt; NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd); - int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), NULL); + int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, GetParent(hwnd), nullptr); mwpd.selection = iSelection; mwpd.uType = MSG_WINDOWPOPUP_SELECTED; @@ -599,7 +599,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, if (isCtrl && !isAlt && !isShift) { MODULEINFO *mi = pci->MM_FindModule(mwdat->si->pszModule); - if (mi == NULL) + if (mi == nullptr) return 0; switch (wParam) { @@ -716,8 +716,8 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; if (PluginConfig.m_bSendOnDblEnter) { - if (dat->lastEnterTime + 2 < time(NULL)) { - dat->lastEnterTime = time(NULL); + if (dat->lastEnterTime + 2 < time(nullptr)) { + dat->lastEnterTime = time(nullptr); break; } @@ -744,7 +744,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); bool fCompleted = TabAutoComplete(hwnd, dat, mwdat->si); SendMessage(hwnd, WM_SETREDRAW, TRUE, 0); - RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE); + RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE); if (!fCompleted && !PluginConfig.m_bAllowTab) { if ((GetSendButtonState(mwdat->GetHwnd()) != PBS_DISABLED)) SetFocus(GetDlgItem(mwdat->GetHwnd(), IDOK)); @@ -755,9 +755,9 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (wParam != VK_RIGHT && wParam != VK_LEFT) { mir_free(dat->szSearchQuery); - dat->szSearchQuery = NULL; + dat->szSearchQuery = nullptr; mir_free(dat->szSearchResult); - dat->szSearchResult = NULL; + dat->szSearchResult = nullptr; } if (wParam == VK_F4 && isCtrl && !isAlt) { // ctrl-F4 (close tab) @@ -788,7 +788,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, WM_SETREDRAW, FALSE, 0); LOGFONTA lf; - LoadLogfont(MSGFONTID_MESSAGEAREA, &lf, NULL, FONTMODULE); + LoadLogfont(MSGFONTID_MESSAGEAREA, &lf, nullptr, FONTMODULE); SETTEXTEX ste; ste.flags = ST_DEFAULT; @@ -804,7 +804,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 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 0; @@ -824,7 +824,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, // If we cannot load the message from history, load the last edited text. SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)mwdat->m_enteredText); mir_free(mwdat->m_enteredText); - mwdat->m_enteredText = NULL; + mwdat->m_enteredText = nullptr; } GETTEXTLENGTHEX gtl = { 0 }; @@ -833,7 +833,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, int iLen = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 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 0; @@ -851,7 +851,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_RBUTTONUP: case WM_MBUTTONUP: COLORREF cr; - LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE); + LoadLogfont(MSGFONTID_MESSAGEAREA, nullptr, &cr, FONTMODULE); CHARFORMAT2 cf; cf.cbSize = sizeof(CHARFORMAT2); @@ -860,7 +860,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); { MODULEINFO *mi = pci->MM_FindModule(mwdat->si->pszModule); - if (mi == NULL) + if (mi == nullptr) break; if (mi->bColor) { @@ -1353,7 +1353,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, SendMessage(hwnd, LB_SETSEL, FALSE, -1); SendMessage(hwnd, LB_SETSEL, TRUE, i); dat->m_iSearchItem = i; - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return 0; } } @@ -1399,7 +1399,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, case WM_CONTEXTMENU: { SESSION_INFO *si = dat->si; - if (si == NULL) + if (si == nullptr) break; int height = 0; @@ -1494,14 +1494,14 @@ 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 = { 0 }; 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; } @@ -1598,7 +1598,7 @@ void CChatRoomDlg::OnInitDialog() // Typing support for GCW_PRIVMESS sessions if (si->iType == GCW_PRIVMESS) { m_nTypeMode = PROTOTYPE_SELFTYPING_OFF; - SetTimer(m_hwnd, TIMERID_TYPE, 1000, NULL); + SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr); } m_pPanel.setActive(false); @@ -1620,7 +1620,7 @@ void CChatRoomDlg::OnInitDialog() m_pPanel.loadHeight(); - if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && m_szProto != NULL) + if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && m_szProto != nullptr) UpdateTrayMenu(0, m_wStatus, m_szProto, m_wszStatus, m_hContact, FALSE); DM_ThemeChanged(); @@ -1629,7 +1629,7 @@ void CChatRoomDlg::OnInitDialog() GetMYUIN(); GetMyNick(); - HWND hwndBtn = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20), m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL); + HWND hwndBtn = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20), m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, nullptr); CustomizeButton(hwndBtn); SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, 1, 0); SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)m_pContainer, 0); @@ -1675,9 +1675,9 @@ void CChatRoomDlg::OnDestroy() if (pcli->pfnGetEvent(si->hContact, 0)) pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); si->wState &= ~STATE_TALK; - si->hWnd = NULL; - si->dat = NULL; - si = NULL; + si->hWnd = nullptr; + si->dat = nullptr; + si = nullptr; TABSRMM_FireEvent(m_hContact, m_hwnd, MSG_WINDOW_EVT_CLOSING, 0); @@ -1728,7 +1728,7 @@ void CChatRoomDlg::OnClick_OK(CCtrlButton*) return; MODULEINFO *mi = pci->MM_FindModule(si->pszModule); - if (mi == NULL) + if (mi == nullptr) return; ptrA pszRtf(Message_GetFromStream(m_message.GetHwnd())); @@ -1758,7 +1758,7 @@ void CChatRoomDlg::OnClick_OK(CCtrlButton*) bool fSound = true; if (ptszText[0] == '/' || si->iType == GCW_SERVER) fSound = false; - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, ptszText, 0); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_MESSAGE, nullptr, ptszText, 0); mi->idleTimeStamp = time(0); mi->lastIdleCheck = 0; pci->SM_BroadcastMessage(si->pszModule, GC_UPDATESTATUSBAR, 0, 1, TRUE); @@ -1805,7 +1805,7 @@ void CChatRoomDlg::OnClick_History(CCtrlButton *pButton) CallService("MSP/HTMLlog/ViewLog", (WPARAM)si->pszModule, (LPARAM)szName); } else if (pInfo) - ShellExecute(m_hwnd, NULL, pci->GetChatLogsFilename(si, 0), NULL, NULL, SW_SHOW); + ShellExecute(m_hwnd, nullptr, pci->GetChatLogsFilename(si, 0), nullptr, nullptr, SW_SHOW); } void CChatRoomDlg::OnClick_ShowNickList(CCtrlButton *pButton) @@ -1819,14 +1819,14 @@ void CChatRoomDlg::OnClick_ShowNickList(CCtrlButton *pButton) SendMessage(m_hwnd, WM_SIZE, 0, 0); if (CSkin::m_skinEnabled) - InvalidateRect(m_hwnd, NULL, TRUE); + InvalidateRect(m_hwnd, nullptr, TRUE); PostMessage(m_hwnd, GC_SCROLLTOBOTTOM, 0, 0); } void CChatRoomDlg::OnClick_ChanMgr(CCtrlButton *pButton) { if (pButton->Enabled()) - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_CHANMGR, NULL, NULL, 0); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_CHANMGR, nullptr, nullptr, 0); } void CChatRoomDlg::OnClick_BIU(CCtrlButton *pButton) @@ -1869,7 +1869,7 @@ void CChatRoomDlg::OnClick_Color(CCtrlButton *pButton) } else { COLORREF cr; - LoadLogfont(MSGFONTID_MESSAGEAREA, NULL, &cr, FONTMODULE); + LoadLogfont(MSGFONTID_MESSAGEAREA, nullptr, &cr, FONTMODULE); cf.dwMask = CFM_COLOR; cf.crTextColor = cr; m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf); @@ -1950,12 +1950,12 @@ void CChatRoomDlg::OnDblClick_List(CCtrlListBox*) PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); SetFocus(m_message.GetHwnd()); } - else pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); + else pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); } INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { - if (si == NULL && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) + if (si == nullptr && (uMsg == WM_ACTIVATE || uMsg == WM_SETFOCUS)) return 0; POINT pt, tmp, cur; @@ -1980,7 +1980,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case GC_SETWNDPROPS: - pInfo = si ? pci->MM_FindModule(si->pszModule) : NULL; + pInfo = si ? pci->MM_FindModule(si->pszModule) : nullptr; if (pInfo) { m_btnBold.Enable(pInfo->bBold); m_btnItalic.Enable(pInfo->bItalics); @@ -1996,7 +1996,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_btnOk.SendMsg(BUTTONSETASNORMAL, TRUE, 0); m_list.SetItemHeight(0, g_Settings.iNickListFontHeight); - InvalidateRect(m_list.GetHwnd(), NULL, TRUE); + InvalidateRect(m_list.GetHwnd(), nullptr, TRUE); m_btnFilter.SendMsg(BUTTONSETOVERLAYICON, (LPARAM)(si->bFilterEnabled ? PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled), 0); SendMessage(m_hwnd, WM_SIZE, 0, 0); @@ -2071,7 +2071,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (m_pContainer->hwndActive != m_hwnd || m_pContainer->hwndStatus == 0 || CMimAPI::m_shutDown || m_wszStatusBar[0]) break; - if (si->pszModule != NULL) { + if (si->pszModule != nullptr) { wchar_t szFinalStatusBarText[512]; //Mad: strange rare crash here... @@ -2156,7 +2156,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return 0; case GC_REDRAWWINDOW: - InvalidateRect(m_hwnd, NULL, TRUE); + InvalidateRect(m_hwnd, nullptr, TRUE); break; case GC_REDRAWLOG: @@ -2166,7 +2166,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (si->iEventCount > 60) { int index = 0; while (index < 59) { - if (pLog->next == NULL) + if (pLog->next == nullptr) break; pLog = pLog->next; if ((si->iType != GCW_CHATROOM && si->iType != GCW_PRIVMESS) || !si->bFilterEnabled || (si->iLogFilterFlags&pLog->iType) != 0) @@ -2255,7 +2255,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) int index = dis->itemID; USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, index); - if (ui == NULL) + if (ui == nullptr) return TRUE; int height = dis->rcItem.bottom - dis->rcItem.top; @@ -2291,7 +2291,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if (g_Settings.bShowContactStatus && g_Settings.bContactStatusFirst && ui->ContactStatus) { HICON icon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(icon); x_offset += 18; } @@ -2309,13 +2309,13 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) else x_offset += 8; } else { - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 5, hIcon, 10, 10, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 5, hIcon, 10, 10, 0, nullptr, DI_NORMAL); x_offset += 12; } if (g_Settings.bShowContactStatus && !g_Settings.bContactStatusFirst && ui->ContactStatus) { HICON icon = Skin_LoadProtoIcon(si->pszModule, ui->ContactStatus); - DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(dis->hDC, x_offset, dis->rcItem.top + offset - 8, icon, 16, 16, 0, nullptr, DI_NORMAL); IcoLib_ReleaseIcon(icon); x_offset += 18; } @@ -2452,9 +2452,9 @@ LABEL_SHOWWINDOW: GetClientRect(m_log.GetHwnd(), &rc); if ((pt.y + 2 >= MIN_PANELHEIGHT + 2) && (pt.y + 2 < 100) && (pt.y + 2 < rc.bottom - 30)) m_pPanel.setHeight(pt.y + 2); - RedrawWindow(m_hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); + RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); if (M.isAero()) - InvalidateRect(m_hwndParent, NULL, FALSE); + InvalidateRect(m_hwndParent, nullptr, FALSE); SendMessage(m_hwnd, WM_SIZE, DM_SPLITTERMOVED, 0); break; } @@ -2584,14 +2584,14 @@ LABEL_SHOWWINDOW: return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_FILTERTOGGLE: OnClick_Filter(&m_btnFilter); - InvalidateRect(m_btnFilter.GetHwnd(), NULL, TRUE); + InvalidateRect(m_btnFilter.GetHwnd(), nullptr, TRUE); return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_LISTTOGGLE: OnClick_ShowNickList(&m_btnNickList); return _dlgReturn(m_hwnd, 1); case TABSRMM_HK_MUC_SHOWSERVER: if (si->iType != GCW_SERVER) - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_MESSAGE, NULL, L"/servershow", 0); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_MESSAGE, nullptr, L"/servershow", 0); return _dlgReturn(m_hwnd, 1); } } @@ -2650,7 +2650,7 @@ LABEL_SHOWWINDOW: } HMENU hMenu = 0; - UINT uID = CreateGCMenu(m_hwnd, &hMenu, 1, pt, si, NULL, pszWord); + UINT uID = CreateGCMenu(m_hwnd, &hMenu, 1, pt, si, nullptr, pszWord); switch (uID) { case 0: PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); @@ -2684,7 +2684,7 @@ LABEL_SHOWWINDOW: default: PostMessage(m_hwnd, WM_MOUSEACTIVATE, 0, 0); - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_LOGMENU, NULL, NULL, (LPARAM)uID); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_LOGMENU, nullptr, nullptr, (LPARAM)uID); break; } @@ -2711,7 +2711,7 @@ LABEL_SHOWWINDOW: m_pContainer->MenuBar->Cancel(); TEXTRANGE tr; - tr.lpstrText = NULL; + tr.lpstrText = nullptr; tr.chrg = ((ENLINK*)lParam)->chrg; tr.lpstrText = (wchar_t*)mir_alloc(sizeof(wchar_t) * (tr.chrg.cpMax - tr.chrg.cpMin + 2)); SendMessage(((LPNMHDR)lParam)->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr); @@ -2739,11 +2739,11 @@ LABEL_SHOWWINDOW: break; case ID_MESS: - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, NULL, 0); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_PRIVMESS, ui, nullptr, 0); break; default: - pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, NULL, (LPARAM)uID); + pci->DoEventHookAsync(m_hwnd, si->ptszID, si->pszModule, GC_USER_NICKLISTMENU, ui, nullptr, (LPARAM)uID); break; } DestroyGCMenu(&hMenu, 1); @@ -2971,11 +2971,11 @@ LABEL_SHOWWINDOW: MsgWindowUpdateMenu(subMenu, MENU_TABCONTEXT); - int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL); + int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr); if (iSelection >= IDM_CONTAINERMENU) { char szIndex[10]; _itoa_s(iSelection - IDM_CONTAINERMENU, szIndex, 10); - ptrW wszContainer(db_get_wsa(NULL, "TAB_ContainersW", szIndex)); + ptrW wszContainer(db_get_wsa(0, "TAB_ContainersW", szIndex)); if (wszContainer != nullptr) SendMessage(m_hwnd, DM_CONTAINERSELECTED, 0, wszContainer); break; @@ -3157,10 +3157,10 @@ void ShowRoom(SESSION_INFO *si) return; if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) { - if ((pContainer = FindMatchingContainer(L"default")) == NULL) { + if ((pContainer = FindMatchingContainer(L"default")) == nullptr) { wchar_t szName[CONTAINER_NAMELEN + 1]; mir_snwprintf(szName, L"default"); - if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == NULL) + if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_CLONED, hContact)) == nullptr) return; } } @@ -3247,7 +3247,7 @@ void ShowRoom(SESSION_INFO *si) } else { SetFocus(hwndNew); - RedrawWindow(pContainer->hwnd, NULL, NULL, RDW_INVALIDATE); + RedrawWindow(pContainer->hwnd, nullptr, nullptr, RDW_INVALIDATE); UpdateWindow(pContainer->hwnd); if (GetForegroundWindow() != pContainer->hwnd) SetForegroundWindow(pContainer->hwnd); diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 7d259557f4..34ed805db0 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -41,7 +41,7 @@ CContactCache::CContactCache(MCONTACT hContact) m_iStatus = m_iOldStatus = ID_STATUS_OFFLINE; if (hContact) { - if ((cc = db_get_contact(hContact)) != NULL) { + if ((cc = db_get_contact(hContact)) != nullptr) { initPhaseTwo(); return; } @@ -142,7 +142,7 @@ void CContactCache::updateMeta() } else { m_hSub = 0; - m_szMetaProto = NULL; + m_szMetaProto = nullptr; m_iMetaStatus = ID_STATUS_OFFLINE; m_xStatus = 0; } @@ -158,7 +158,7 @@ bool CContactCache::updateUIN() if (m_isValid) { ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, getActiveContact(), getActiveProto())); - if (uid != NULL) + if (uid != nullptr) wcsncpy_s(m_szUIN, uid, _TRUNCATE); } @@ -241,11 +241,11 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM) } char *szFromStream = ::Message_GetFromStream(GetDlgItem(m_dat->GetHwnd(), IDC_MESSAGE), SF_RTFNOOBJS | SFF_PLAINRTF | SF_NCRFORNONASCII); - if (szFromStream != NULL) { + if (szFromStream != nullptr) { size_t iLength = 0, iStreamLength = 0; iLength = iStreamLength = (mir_strlen(szFromStream) + 1); - if (iLength > 0 && m_history != NULL) { // XXX: iLength > 1 ? + if (iLength > 0 && m_history != nullptr) { // XXX: iLength > 1 ? if ((m_iHistoryTop == m_iHistorySize) && oldTop == 0) { // shift the stack down... TInputHistory ihTemp = m_history[0]; m_iHistoryTop--; @@ -253,7 +253,7 @@ void CContactCache::saveHistory(WPARAM wParam, LPARAM) m_history[m_iHistoryTop] = ihTemp; } if (iLength > m_history[m_iHistoryTop].lLen) { - if (m_history[m_iHistoryTop].szText == NULL) { + if (m_history[m_iHistoryTop].szText == nullptr) { if (iLength < HISTORY_INITIAL_ALLOCSIZE) iLength = HISTORY_INITIAL_ALLOCSIZE; m_history[m_iHistoryTop].szText = (wchar_t*)mir_alloc(iLength); @@ -289,7 +289,7 @@ void CContactCache::inputHistoryEvent(WPARAM wParam) if (m_dat == nullptr) return; - if (m_history != NULL && m_history[0].szText != NULL) { // at least one entry needs to be alloced, otherwise we get a nice infinite loop ;) + if (m_history != nullptr && m_history[0].szText != nullptr) { // at least one entry needs to be alloced, otherwise we get a nice infinite loop ;) HWND hwndEdit = ::GetDlgItem(m_dat->GetHwnd(), IDC_MESSAGE); SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 }; @@ -311,14 +311,14 @@ void CContactCache::inputHistoryEvent(WPARAM wParam) m_iHistoryCurrent = m_iHistoryTop; } if (m_iHistoryCurrent == m_iHistoryTop) { - if (m_history[m_iHistorySize].szText != NULL) { // replace the temp buffer + if (m_history[m_iHistorySize].szText != nullptr) { // replace the temp buffer ::SetWindowText(hwndEdit, L""); ::SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistorySize].szText); ::SendMessage(hwndEdit, EM_SETSEL, -1, -1); } } else { - if (m_history[m_iHistoryCurrent].szText != NULL) { + if (m_history[m_iHistoryCurrent].szText != nullptr) { ::SetWindowText(hwndEdit, L""); ::SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_history[m_iHistoryCurrent].szText); ::SendMessage(hwndEdit, EM_SETSEL, -1, -1); @@ -371,7 +371,7 @@ void CContactCache::releaseAlloced() } mir_free(m_szStatusMsg); - m_szStatusMsg = NULL; + m_szStatusMsg = nullptr; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -450,7 +450,7 @@ void CContactCache::updateStatusMsg(const char *szKey) CContactCache* CContactCache::getContactCache(MCONTACT hContact) { CContactCache *cc = arContacts.find((CContactCache*)&hContact); - if (cc == NULL) { + if (cc == nullptr) { cc = new CContactCache(hContact); arContacts.insert(cc); } diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 5bdb93a08a..9c825c1ad4 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -34,7 +34,7 @@ #define CONTAINER_PREFIX "CNTW_" TContainerData *pFirstContainer = 0; // the linked list of struct ContainerWindowData -TContainerData *pLastActiveContainer = NULL; +TContainerData *pLastActiveContainer = nullptr; static TContainerData* TSAPI AppendToContainerList(TContainerData*); static TContainerData* TSAPI RemoveContainerFromList(TContainerData*); @@ -191,7 +191,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, CSkinItem *item_pressed = &SkinItems[ID_EXTBKTITLEBUTTONPRESSED]; for (int i = 0; i < 3; i++) { - RECT *pRect = NULL; + RECT *pRect = nullptr; switch (i) { case 0: @@ -346,7 +346,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, } else { LRESULT result = DefWindowProc(hwndDlg, msg, wParam, lParam); - RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN); return result; } } @@ -355,7 +355,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_SETCURSOR: if (CSkin::m_frameSkins && (HWND)wParam == hwndDlg) { DefWindowProc(hwndDlg, msg, wParam, lParam); - RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_NOCHILDREN); return 1; } break; @@ -392,7 +392,7 @@ static LRESULT CALLBACK ContainerWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, case WM_SETICON: if (CSkin::m_frameSkins) { DefWindowProc(hwndDlg, msg, wParam, lParam); - RedrawWindow(hwndDlg, NULL, NULL, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); return 0; } break; @@ -581,8 +581,8 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, // tab tooltips... if (!fHaveTipper || M.GetByte("d_tooltips", 0) == 0) { - pContainer->m_hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, NULL, g_hInst, (LPVOID)NULL); + pContainer->m_hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, nullptr, g_hInst, (LPVOID)nullptr); if (pContainer->m_hwndTip) { SetWindowPos(pContainer->m_hwndTip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); @@ -623,24 +623,24 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, if (pContainer->isCloned && pContainer->hContactFrom != 0 && !(pContainer->dwFlags & CNT_GLOBALSIZE)) { if (Utils_RestoreWindowPosition(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split")) { if (Utils_RestoreWindowPositionNoMove(hwndDlg, pContainer->hContactFrom, SRMSGMOD_T, "split")) - if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split")) - if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, "split")) + if (Utils_RestoreWindowPosition(hwndDlg, 0, SRMSGMOD_T, "split")) + if (Utils_RestoreWindowPositionNoMove(hwndDlg, 0, SRMSGMOD_T, "split")) SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE); } } else { if (pContainer->dwFlags & CNT_GLOBALSIZE) { - if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split")) - if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, "split")) + if (Utils_RestoreWindowPosition(hwndDlg, 0, SRMSGMOD_T, "split")) + if (Utils_RestoreWindowPositionNoMove(hwndDlg, 0, SRMSGMOD_T, "split")) SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE); } else { char szCName[CONTAINER_NAMELEN + 20]; mir_snprintf(szCName, "%s%d", CONTAINER_PREFIX, pContainer->iContainerIndex); - if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, szCName)) { - if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, szCName)) - if (Utils_RestoreWindowPosition(hwndDlg, NULL, SRMSGMOD_T, "split")) - if (Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, SRMSGMOD_T, "split")) + if (Utils_RestoreWindowPosition(hwndDlg, 0, SRMSGMOD_T, szCName)) { + if (Utils_RestoreWindowPositionNoMove(hwndDlg, 0, SRMSGMOD_T, szCName)) + if (Utils_RestoreWindowPosition(hwndDlg, 0, SRMSGMOD_T, "split")) + if (Utils_RestoreWindowPositionNoMove(hwndDlg, 0, SRMSGMOD_T, "split")) SetWindowPos(hwndDlg, 0, 50, 50, 450, 300, SWP_NOZORDER | SWP_NOACTIVATE); } } @@ -720,12 +720,12 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, pContainer->SideBar->scrollIntoView(); if (!M.isAero()) { // aero mode uses buffered paint, no forced redraw needed - RedrawWindow(hwndTab, NULL, NULL, RDW_INVALIDATE | (pContainer->bSizingLoop ? RDW_ERASE : 0)); - RedrawWindow(hwndDlg, NULL, NULL, (bSkinned ? RDW_FRAME : 0) | RDW_INVALIDATE | ((pContainer->bSizingLoop || wParam == SIZE_RESTORED) ? RDW_ERASE : 0)); + RedrawWindow(hwndTab, nullptr, nullptr, RDW_INVALIDATE | (pContainer->bSizingLoop ? RDW_ERASE : 0)); + RedrawWindow(hwndDlg, nullptr, nullptr, (bSkinned ? RDW_FRAME : 0) | RDW_INVALIDATE | ((pContainer->bSizingLoop || wParam == SIZE_RESTORED) ? RDW_ERASE : 0)); } if (pContainer->hwndStatus) - InvalidateRect(pContainer->hwndStatus, NULL, FALSE); + InvalidateRect(pContainer->hwndStatus, nullptr, FALSE); if ((CSkin::m_bClipBorder != 0 || CSkin::m_bRoundedCorner) && CSkin::m_frameSkins) { HRGN rgn; @@ -742,12 +742,12 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowRgn(hwndDlg, rgn, TRUE); } else if (CSkin::m_frameSkins) - SetWindowRgn(hwndDlg, NULL, TRUE); + SetWindowRgn(hwndDlg, nullptr, TRUE); } break; case WM_NOTIFY: - if (pContainer == NULL) + if (pContainer == nullptr) break; if (pContainer->MenuBar) { LRESULT processed = pContainer->MenuBar->processMsg(msg, wParam, lParam); @@ -786,7 +786,7 @@ panel_found: if (hContact) { int iSel = 0; HMENU hMenu = Menu_BuildContactMenu(hContact); - iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (iSel) Clist_MenuProcessCommand(LOWORD(iSel), MPCF_CONTACTMENU, hContact); DestroyMenu(hMenu); @@ -844,13 +844,13 @@ panel_found: if (dat) dat->MsgWindowUpdateMenu(subMenu, MENU_TABCONTEXT); - int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (iSelection >= IDM_CONTAINERMENU) { char szIndex[10]; itoa(iSelection - IDM_CONTAINERMENU, szIndex, 10); if (iSelection - IDM_CONTAINERMENU >= 0) { - ptrW tszName(db_get_wsa(NULL, CONTAINER_KEY, szIndex)); - if (tszName != NULL) + ptrW tszName(db_get_wsa(0, CONTAINER_KEY, szIndex)); + if (tszName != nullptr) SendMessage((HWND)tci.lParam, DM_CONTAINERSELECTED, 0, tszName); } return 1; @@ -897,7 +897,7 @@ panel_found: SendMessage(hwndDlg, WM_CLOSE, 0, 0); break; } - InvalidateRect(hwndTab, NULL, FALSE); + InvalidateRect(hwndTab, nullptr, FALSE); return 1; } break; @@ -1344,7 +1344,7 @@ panel_found: break; case WM_ACTIVATE: - if (pContainer == NULL) + if (pContainer == nullptr) break; if (LOWORD(wParam == WA_INACTIVE)) @@ -1365,7 +1365,7 @@ panel_found: } case WM_MOUSEACTIVATE: - if (pContainer != NULL) { + if (pContainer != nullptr) { TCITEM item; int curItem = 0; BOOL fTransAllowed = !bSkinned || PluginConfig.m_WinVerMajor >= 6; @@ -1410,7 +1410,7 @@ panel_found: ShowWindow(pContainer->hwndActive, SW_SHOW); SetFocus(pContainer->hwndActive); SendMessage(pContainer->hwndActive, WM_ACTIVATE, WA_ACTIVE, 0); - RedrawWindow(pContainer->hwndActive, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN); + RedrawWindow(pContainer->hwndActive, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN); } } else if (curItem >= 0) @@ -1436,7 +1436,7 @@ panel_found: if ((HWND)item.lParam != hwndCurrent) { pContainer->bDontSmartClose = TRUE; SendMessage((HWND)item.lParam, WM_CLOSE, 0, 1); - RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE); pContainer->bDontSmartClose = FALSE; } else SendMessage((HWND)item.lParam, WM_CLOSE, 0, 1); @@ -1492,7 +1492,7 @@ panel_found: char szCname[40]; wchar_t szTitleFormat[200]; { - wchar_t *szThemeName = NULL; + wchar_t *szThemeName = nullptr; DBVARIANT dbv = { 0 }; szTitleFormat[0] = 0; @@ -1507,15 +1507,15 @@ panel_found: } else { Utils::ReadPrivateContainerSettings(pContainer); - if (szThemeName == NULL) { + if (szThemeName == nullptr) { mir_snprintf(szCname, "%s%d_theme", CONTAINER_PREFIX, pContainer->iContainerIndex); - if (!db_get_ws(NULL, SRMSGMOD_T, szCname, &dbv)) + if (!db_get_ws(0, SRMSGMOD_T, szCname, &dbv)) szThemeName = dbv.ptszVal; } } Utils::SettingsToContainer(pContainer); - if (szThemeName != NULL) { + if (szThemeName != nullptr) { PathToAbsoluteW(szThemeName, pContainer->szAbsThemeFile, M.getDataPath()); wcsncpy_s(pContainer->szRelThemeFile, szThemeName, _TRUNCATE); db_free(&dbv); @@ -1532,7 +1532,7 @@ panel_found: GetWindowRect(hwndDlg, &rc); SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, (rc.bottom - rc.top) + 1, SWP_NOZORDER | SWP_NOACTIVATE); SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOZORDER | SWP_NOACTIVATE); - RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); if (pContainer->hwndStatus != 0 && pContainer->hwndActive != 0) PostMessage(pContainer->hwndActive, DM_STATUSBARCHANGED, 0, 0); @@ -1581,7 +1581,7 @@ panel_found: GetWindowRect(hwndDlg, &rc); if ((ws & WS_CAPTION) != (wsold & WS_CAPTION)) { SetWindowPos(hwndDlg, 0, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_NOACTIVATE | SWP_FRAMECHANGED | SWP_NOCOPYBITS); - RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); + RedrawWindow(hwndDlg, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW); if (pContainer->hwndActive != 0) { dat = (CTabBaseDlg*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); dat->DM_ScrollToBottom(0, 0); @@ -1601,7 +1601,7 @@ panel_found: ws &= ~(TCS_BOTTOM); if ((ws & (TCS_BOTTOM | TCS_MULTILINE)) != (wsold & (TCS_BOTTOM | TCS_MULTILINE))) { SetWindowLongPtr(hwndTab, GWL_STYLE, ws); - RedrawWindow(hwndTab, NULL, NULL, RDW_INVALIDATE); + RedrawWindow(hwndTab, nullptr, nullptr, RDW_INVALIDATE); } if (pContainer->dwFlags & CNT_NOSTATUSBAR) { @@ -1613,7 +1613,7 @@ panel_found: } } else if (pContainer->hwndStatus == 0) { - pContainer->hwndStatus = CreateWindowEx(0, L"TSStatusBarClass", NULL, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndDlg, NULL, g_hInst, NULL); + pContainer->hwndStatus = CreateWindowEx(0, L"TSStatusBarClass", nullptr, SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hwndDlg, nullptr, g_hInst, nullptr); if (sBarHeight && bSkinned) SendMessage(pContainer->hwndStatus, SB_SETMINHEIGHT, sBarHeight, 0); @@ -1935,11 +1935,11 @@ panel_found: TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT hContactFrom) { if (CMimAPI::m_shutDown) - return NULL; + return nullptr; TContainerData *pContainer = (TContainerData*)mir_calloc(sizeof(TContainerData)); - if (pContainer == NULL) - return NULL; + if (pContainer == nullptr) + return nullptr; wcsncpy(pContainer->szName, name, CONTAINER_NAMELEN + 1); AppendToContainerList(pContainer); @@ -1952,15 +1952,15 @@ TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT h do { char szCounter[10]; itoa(i, szCounter, 10); - ptrW tszName(db_get_wsa(NULL, CONTAINER_KEY, szCounter)); - if (tszName == NULL) { + ptrW tszName(db_get_wsa(0, CONTAINER_KEY, szCounter)); + if (tszName == nullptr) { if (iFirstFree != -1) { pContainer->iContainerIndex = iFirstFree; itoa(iFirstFree, szCounter, 10); } else pContainer->iContainerIndex = i; - db_set_ws(NULL, CONTAINER_KEY, szCounter, name); + db_set_ws(0, CONTAINER_KEY, szCounter, name); BuildContainerMenu(); break; } @@ -1984,7 +1984,7 @@ TContainerData* TSAPI CreateContainer(const wchar_t *name, int iTemp, MCONTACT h pContainer->dwFlags |= CNT_CREATE_CLONED; pContainer->hContactFrom = hContactFrom; } - pContainer->hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGCONTAINER), NULL, DlgProcContainer, (LPARAM)pContainer); + pContainer->hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSGCONTAINER), nullptr, DlgProcContainer, (LPARAM)pContainer); return pContainer; } @@ -2043,7 +2043,7 @@ void TSAPI CloseOtherTabs(HWND hwndTab, CTabBaseDlg &dat) { for (int idxt = 0; idxt < dat.m_pContainer->iChilds;) { HWND otherTab = GetHWNDFromTabIndex(hwndTab, idxt); - if (otherTab != NULL && otherTab != dat.GetHwnd()) + if (otherTab != nullptr && otherTab != dat.GetHwnd()) SendMessage(otherTab, WM_CLOSE, 1, 0); else ++idxt; @@ -2076,7 +2076,7 @@ static TContainerData* TSAPI AppendToContainerList(TContainerData *pContainer) { if (!pFirstContainer) { pFirstContainer = pContainer; - pFirstContainer->pNext = NULL; + pFirstContainer->pNext = nullptr; return pFirstContainer; } @@ -2084,33 +2084,33 @@ static TContainerData* TSAPI AppendToContainerList(TContainerData *pContainer) while (p->pNext != 0) p = p->pNext; p->pNext = pContainer; - pContainer->pNext = NULL; + pContainer->pNext = nullptr; return p; } TContainerData* TSAPI FindContainerByName(const wchar_t *name) { - if (name == NULL || mir_wstrlen(name) == 0) + if (name == nullptr || mir_wstrlen(name) == 0) return 0; if (M.GetByte("singlewinmode", 0)) // single window mode - always return 0 and force a new container - return NULL; + return nullptr; for (TContainerData *p = pFirstContainer; p; p = p->pNext) if (!wcsncmp(p->szName, name, CONTAINER_NAMELEN)) return p; // error, didn't find it. - return NULL; + return nullptr; } static TContainerData* TSAPI RemoveContainerFromList(TContainerData *pContainer) { if (pContainer == pFirstContainer) { - if (pContainer->pNext != NULL) + if (pContainer->pNext != nullptr) pFirstContainer = pContainer->pNext; else - pFirstContainer = NULL; + pFirstContainer = nullptr; if (pLastActiveContainer == pContainer) // make sure, we don't reference this container anymore pLastActiveContainer = pFirstContainer; @@ -2128,7 +2128,7 @@ static TContainerData* TSAPI RemoveContainerFromList(TContainerData *pContainer) return 0; } } - return NULL; + return nullptr; } // calls the TabCtrl_AdjustRect to calculate the "real" client area of the tab. @@ -2201,7 +2201,7 @@ int TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNa // use clist group names for containers... if (M.GetByte("useclistgroups", 0)) { ptrW tszGroup(db_get_wsa(hContact, "CList", "Group")); - if (tszGroup == NULL) { + if (tszGroup == nullptr) { wcsncpy_s(szName, iNameLen, L"default", _TRUNCATE); return 0; } @@ -2211,7 +2211,7 @@ int TSAPI GetContainerNameForContact(MCONTACT hContact, wchar_t *szName, int iNa } ptrW tszContainerName(db_get_wsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY)); - if (tszContainerName == NULL) { + if (tszContainerName == nullptr) { wcsncpy_s(szName, iNameLen, L"default", _TRUNCATE); return 0; } @@ -2224,11 +2224,11 @@ void TSAPI DeleteContainer(int iIndex) { char szIndex[10]; itoa(iIndex, szIndex, 10); - ptrW tszContainerName(db_get_wsa(NULL, CONTAINER_KEY, szIndex)); - if (tszContainerName == NULL) + ptrW tszContainerName(db_get_wsa(0, CONTAINER_KEY, szIndex)); + if (tszContainerName == nullptr) return; - db_set_ws(NULL, CONTAINER_KEY, szIndex, L"**mir_free**"); + db_set_ws(0, CONTAINER_KEY, szIndex, L"**mir_free**"); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ptrW tszValue(db_get_wsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY)); @@ -2238,17 +2238,17 @@ void TSAPI DeleteContainer(int iIndex) char szSetting[CONTAINER_NAMELEN + 30]; mir_snprintf(szSetting, "%s%d_Flags", CONTAINER_PREFIX, iIndex); - db_unset(NULL, SRMSGMOD_T, szSetting); + db_unset(0, SRMSGMOD_T, szSetting); mir_snprintf(szSetting, "%s%d_Trans", CONTAINER_PREFIX, iIndex); - db_unset(NULL, SRMSGMOD_T, szSetting); + db_unset(0, SRMSGMOD_T, szSetting); mir_snprintf(szSetting, "%s%dwidth", CONTAINER_PREFIX, iIndex); - db_unset(NULL, SRMSGMOD_T, szSetting); + db_unset(0, SRMSGMOD_T, szSetting); mir_snprintf(szSetting, "%s%dheight", CONTAINER_PREFIX, iIndex); - db_unset(NULL, SRMSGMOD_T, szSetting); + db_unset(0, SRMSGMOD_T, szSetting); mir_snprintf(szSetting, "%s%dx", CONTAINER_PREFIX, iIndex); - db_unset(NULL, SRMSGMOD_T, szSetting); + db_unset(0, SRMSGMOD_T, szSetting); mir_snprintf(szSetting, "%s%dy", CONTAINER_PREFIX, iIndex); - db_unset(NULL, SRMSGMOD_T, szSetting); + db_unset(0, SRMSGMOD_T, szSetting); } void TSAPI RenameContainer(int iIndex, const wchar_t *szNew) @@ -2258,11 +2258,11 @@ void TSAPI RenameContainer(int iIndex, const wchar_t *szNew) char szIndex[10]; itoa(iIndex, szIndex, 10); - ptrW tszContainerName(db_get_wsa(NULL, CONTAINER_KEY, szIndex)); - if (tszContainerName == NULL) + ptrW tszContainerName(db_get_wsa(0, CONTAINER_KEY, szIndex)); + if (tszContainerName == nullptr) return; - db_set_ws(NULL, CONTAINER_KEY, szIndex, szNew); + db_set_ws(0, CONTAINER_KEY, szIndex, szNew); for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { ptrW tszValue(db_get_wsa(hContact, SRMSGMOD_T, CONTAINER_SUBKEY)); @@ -2282,15 +2282,15 @@ HMENU TSAPI BuildContainerMenu() // no container attach menu, if we are using the "clist group mode" if (M.GetByte("useclistgroups", 0) || M.GetByte("singlewinmode", 0)) - return NULL; + return nullptr; HMENU hMenu = CreateMenu(); int i = 0; while (true) { char szCounter[10]; itoa(i, szCounter, 10); - ptrW tszName(db_get_wsa(NULL, CONTAINER_KEY, szCounter)); - if (tszName == NULL) + ptrW tszName(db_get_wsa(0, CONTAINER_KEY, szCounter)); + if (tszName == nullptr) break; if (wcsncmp(tszName, L"**mir_free**", CONTAINER_NAMELEN)) @@ -2364,7 +2364,7 @@ void TSAPI ReflashContainer(TContainerData *pContainer) void TSAPI BroadCastContainer(const TContainerData *pContainer, UINT message, WPARAM wParam, LPARAM lParam, BYTE bType) { - if (pContainer == NULL) + if (pContainer == nullptr) return; HWND hwndTab = GetDlgItem(pContainer->hwnd, IDC_MSGTABS); @@ -2390,7 +2390,7 @@ void TSAPI CloseAllContainers() { bool fOldHideSetting = PluginConfig.m_bHideOnClose; - while (pFirstContainer != NULL) { + while (pFirstContainer != nullptr) { if (!IsWindow(pFirstContainer->hwnd)) pFirstContainer = pFirstContainer->pNext; else { diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index bda98baadf..8c26532110 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -104,16 +104,16 @@ static struct _tagPages const wchar_t *szTitle, *szDesc; UINT uIds[10]; } o_pages[] = { - { LPGENW("General options"), NULL, IDC_O_NOTABS, IDC_O_STICKY, IDC_VERTICALMAX, IDC_AUTOSPLITTER, IDC_O_AUTOHIDE, IDC_AUTOCLOSETABTIME, IDC_AUTOCLOSETABSPIN, IDC_O_AUTOHIDESECONDS, 0, 0 }, - { LPGENW("Window layout"), NULL, IDC_CNTNOSTATUSBAR, IDC_HIDEMENUBAR, IDC_UIDSTATUSBAR, IDC_HIDETOOLBAR, IDC_INFOPANEL, IDC_BOTTOMTOOLBAR, 0, 0, 0, 0 }, + { LPGENW("General options"), nullptr, IDC_O_NOTABS, IDC_O_STICKY, IDC_VERTICALMAX, IDC_AUTOSPLITTER, IDC_O_AUTOHIDE, IDC_AUTOCLOSETABTIME, IDC_AUTOCLOSETABSPIN, IDC_O_AUTOHIDESECONDS, 0, 0 }, + { LPGENW("Window layout"), nullptr, IDC_CNTNOSTATUSBAR, IDC_HIDEMENUBAR, IDC_UIDSTATUSBAR, IDC_HIDETOOLBAR, IDC_INFOPANEL, IDC_BOTTOMTOOLBAR, 0, 0, 0, 0 }, { LPGENW("Tabs and switch bar"), LPGENW("Choose your options for the tabbed user interface. Not all options can be applied to open windows. You may need to close and re-open them."), IDC_TABMODE, IDC_O_TABMODE, IDC_O_SBARLAYOUT, IDC_SBARLAYOUT, IDC_FLASHICON, IDC_FLASHLABEL, IDC_SINGLEROWTAB, IDC_BUTTONTABS, IDC_CLOSEBUTTONONTABS, 0 }, { LPGENW("Notifications"), LPGENW("Select, when you want to see event notifications (popups) for this window. The settings apply to all tabs within this window."), IDC_O_DONTREPORT, IDC_DONTREPORTUNFOCUSED2, IDC_DONTREPORTFOCUSED2, IDC_ALWAYSPOPUPSINACTIVE, IDC_O_EXPLAINGLOBALNOTIFY, 0, 0, 0, 0, 0 }, - { LPGENW("Flashing"), NULL, IDC_O_FLASHDEFAULT, IDC_O_FLASHALWAYS, IDC_O_FLASHNEVER, 0, 0, 0, 0, 0, 0, 0 }, - { LPGENW("Title bar"), NULL, IDC_O_HIDETITLE, IDC_TITLEFORMAT, IDC_O_TITLEBARFORMAT, IDC_O_HELP_TITLEFORMAT, 0, 0, 0, 0, 0, 0 }, + { LPGENW("Flashing"), nullptr, IDC_O_FLASHDEFAULT, IDC_O_FLASHALWAYS, IDC_O_FLASHNEVER, 0, 0, 0, 0, 0, 0, 0 }, + { LPGENW("Title bar"), nullptr, IDC_O_HIDETITLE, IDC_TITLEFORMAT, IDC_O_TITLEBARFORMAT, IDC_O_HELP_TITLEFORMAT, 0, 0, 0, 0, 0, 0 }, { LPGENW("Window size and theme"), LPGENW("You can select a private theme (.tabsrmm file) for this container which will then override the default message log theme. You will have to close and re-open all message windows after changing this option."), IDC_THEME, IDC_SELECTTHEME, IDC_USEGLOBALSIZE, IDC_SAVESIZEASGLOBAL, IDC_LABEL_PRIVATETHEME, IDC_TSLABEL_EXPLAINTHEME, 0, 0, 0, 0 }, { LPGENW("Transparency"), LPGENW("This feature may be unavailable when using a container skin."), IDC_TRANSPARENCY, IDC_TRANSPARENCY_ACTIVE, IDC_TRANSPARENCY_INACTIVE, IDC_TSLABEL_ACTIVE, IDC_TSLABEL_INACTIVE, 0, 0, 0, 0, 0 }, - { LPGENW("Contact avatars"), NULL, IDC_O_STATIC_AVATAR, IDC_O_STATIC_OWNAVATAR, IDC_AVATARMODE, IDC_OWNAVATARMODE, IDC_AVATARSONTASKBAR, 0, 0, 0, 0, 0 }, - { LPGENW("Sound notifications"), NULL, IDC_O_ENABLESOUNDS, IDC_O_SOUNDSMINIMIZED, IDC_O_SOUNDSUNFOCUSED, IDC_O_SOUNDSINACTIVE, IDC_O_SOUNDSFOCUSED, 0, 0, 0, 0, 0 }, + { LPGENW("Contact avatars"), nullptr, IDC_O_STATIC_AVATAR, IDC_O_STATIC_OWNAVATAR, IDC_AVATARMODE, IDC_OWNAVATARMODE, IDC_AVATARSONTASKBAR, 0, 0, 0, 0, 0 }, + { LPGENW("Sound notifications"), nullptr, IDC_O_ENABLESOUNDS, IDC_O_SOUNDSMINIMIZED, IDC_O_SOUNDSUNFOCUSED, IDC_O_SOUNDSINACTIVE, IDC_O_SOUNDSFOCUSED, 0, 0, 0, 0, 0 }, }; static void ShowPage(HWND hwndDlg, int iPage, BOOL fShow) @@ -124,7 +124,7 @@ static void ShowPage(HWND hwndDlg, int iPage, BOOL fShow) } if (fShow) { SetDlgItemText(hwndDlg, IDC_TITLEBOX, TranslateW(o_pages[iPage].szTitle)); - if (o_pages[iPage].szDesc != NULL) + if (o_pages[iPage].szDesc != nullptr) SetDlgItemText(hwndDlg, IDC_DESC, TranslateW(o_pages[iPage].szDesc)); else SetDlgItemText(hwndDlg, IDC_DESC, L""); @@ -184,7 +184,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, SetDlgItemText(hwndDlg, IDC_TITLEFORMAT, pContainer->settings->szTitleFormat); SetDlgItemText(hwndDlg, IDC_THEME, pContainer->szRelThemeFile); for (int i = 0; i < NR_O_PAGES; i++) { - tvis.hParent = NULL; + tvis.hParent = nullptr; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_PARAM; tvis.item.pszText = TranslateW(o_pages[i].szTitle); diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index c316631617..7b65b63047 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -70,8 +70,8 @@ CMenuBar::CMenuBar(HWND hwndParent, const TContainerData *pContainer) m_MimIconRefCount++; - m_hwndToolbar = ::CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAME, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_LIST |/*CCS_NOPARENTALIGN|*/CCS_NODIVIDER | CCS_TOP, - 0, 0, 0, 0, hwndParent, NULL, g_hInst, NULL); + m_hwndToolbar = ::CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAME, nullptr, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TRANSPARENT | TBSTYLE_LIST |/*CCS_NOPARENTALIGN|*/CCS_NODIVIDER | CCS_TOP, + 0, 0, 0, 0, hwndParent, nullptr, g_hInst, nullptr); ::SendMessage(m_hwndToolbar, TB_BUTTONSTRUCTSIZE, (WPARAM)sizeof(TBBUTTON), 0); @@ -277,7 +277,7 @@ LONG_PTR CMenuBar::customDrawWorker(NMCUSTOMDRAW *nm) if (iIndex >= 0 && iIndex < NR_BUTTONS) szText = (wchar_t*)m_TbButtons[iIndex].iString; else - szText = NULL; + szText = nullptr; UINT uState = nmtb->nmcd.uItemState; @@ -673,7 +673,7 @@ RECT rcLastStatusBarClick; // remembers click (down event) point for status b LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { TContainerData *pContainer = (TContainerData*)GetWindowLongPtr(GetParent(hWnd), GWLP_USERDATA); - CSrmmWindow *dat = NULL; + CSrmmWindow *dat = nullptr; POINT pt; if (OldStatusBarproc == 0) { @@ -741,7 +741,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR HANDLE hbp = 0; HDC hdcMem; if (CMimAPI::m_haveBufferedPaint) { - hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, NULL, &hdcMem); + hbp = CMimAPI::m_pfnBeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, nullptr, &hdcMem); hbm = hbmOld = 0; } else { @@ -942,14 +942,14 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR break; case WM_TIMER: - if (pContainer == NULL || wParam != TIMERID_HOVER) + if (pContainer == nullptr || wParam != TIMERID_HOVER) break; KillTimer(hWnd, TIMERID_HOVER); GetCursorPos(&pt); if (pt.x != ptMouse.x || pt.y != ptMouse.y) break; dat = (CSrmmWindow*)GetWindowLongPtr(pContainer->hwndActive, GWLP_USERDATA); - if (dat != NULL) { + if (dat != nullptr) { RECT rc; SIZE size; wchar_t wBuf[512]; wBuf[0] = 0; @@ -961,7 +961,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (PtInRect(&rc, pt)) { unsigned int iconNum = (pt.x - rc.left) / (PluginConfig.m_smcxicon + 2); StatusIconData *sid = Srmm_GetNthIcon(dat->m_hContact, iconNum); - if (sid == NULL) + if (sid == nullptr) break; if (!mir_strcmp(sid->szModule, MSG_ICON_MODULE)) { @@ -1011,7 +1011,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR if (PtInRect(&rc, pt) && ((rc.right - rc.left) < size.cx)) { if (dat->m_bType == SESSIONTYPE_CHAT) { ptrW tszTopic(db_get_wsa(dat->m_hContact, dat->m_szProto, "Topic")); - if (tszTopic != NULL) { + if (tszTopic != nullptr) { tooltip_active = TRUE; CallService("mToolTip/ShowTipW", tszTopic, (LPARAM)&ti); } diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 6fdfc9b80c..8945b4d2dd 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -56,7 +56,7 @@ static void PU_CleanUp() { for (int i = arPopupList.getCount() - 1; i >= 0; i--) { PLUGIN_DATAT *p = arPopupList[i]; - if (p->hContact != NULL) + if (p->hContact != 0) continue; mir_free(p->eventData); @@ -93,7 +93,7 @@ int TSAPI NEN_ReadOptions(NEN_OPTIONS *options) options->iDelayMsg = (int)M.GetDword(MODULE, OPT_DELAY_MESSAGE, DEFAULT_DELAY); options->iDelayOthers = (int)M.GetDword(MODULE, OPT_DELAY_OTHERS, DEFAULT_DELAY); options->iDelayErr = (int)M.GetDword(MODULE, OPT_DELAY_ERR, DEFAULT_DELAY); - options->iDelayDefault = (int)DBGetContactSettingRangedWord(NULL, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX); + options->iDelayDefault = (int)DBGetContactSettingRangedWord(0, "Popup", "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX); options->bShowHeaders = (BYTE)M.GetByte(MODULE, OPT_SHOW_HEADERS, FALSE); options->bNoRSS = (BOOL)M.GetByte(MODULE, OPT_NORSS, FALSE); options->iDisable = (BYTE)M.GetByte(MODULE, OPT_DISABLE, 0); @@ -254,7 +254,7 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa g_Settings.iPopupTimeout = SendDlgItemMessage(hWnd, IDC_DELAY_MESSAGE_MUC_SPIN, UDM_GETPOS, 0, 0); if (IsDlgButtonChecked(hWnd, IDC_LIMITPREVIEW)) - options->iLimitPreview = GetDlgItemInt(hWnd, IDC_MESSAGEPREVIEWLIMIT, NULL, FALSE); + options->iLimitPreview = GetDlgItemInt(hWnd, IDC_MESSAGEPREVIEWLIMIT, nullptr, FALSE); else options->iLimitPreview = 0; Utils::enableDlgControl(hWnd, IDC_COLBACK_MESSAGE, !options->bDefaultColorMsg); @@ -305,10 +305,10 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa case PSN_APPLY: // scan the tree view and obtain the options... - TreeViewToDB(GetDlgItem(hWnd, IDC_EVENTOPTIONS), CTranslator::TREE_NEN, NULL, NULL); + TreeViewToDB(GetDlgItem(hWnd, IDC_EVENTOPTIONS), CTranslator::TREE_NEN, nullptr, nullptr); db_set_b(0, CHAT_MODULE, "PopupStyle", (BYTE)g_Settings.iPopupStyle); - db_set_w(NULL, CHAT_MODULE, "PopupTimeout", g_Settings.iPopupTimeout); + db_set_w(0, CHAT_MODULE, "PopupTimeout", g_Settings.iPopupTimeout); g_Settings.crPUBkgColour = SendDlgItemMessage(hWnd, IDC_COLBACK_MUC, CPM_GETCOLOUR, 0, 0); db_set_dw(0, CHAT_MODULE, "PopupColorBG", (DWORD)g_Settings.crPUBkgColour); @@ -361,7 +361,7 @@ static int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATAT* pdata) static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { PLUGIN_DATAT *pdata = (PLUGIN_DATAT*)PUGetPluginData(hWnd); - if (pdata == NULL) + if (pdata == nullptr) return FALSE; switch (message) { @@ -378,7 +378,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case UM_INITPOPUP: pdata->hWnd = hWnd; if (pdata->iSeconds > 0) - SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, NULL); + SetTimer(hWnd, TIMER_TO_ACTION, pdata->iSeconds * 1000, nullptr); break; case WM_MOUSEWHEEL: break; @@ -495,7 +495,7 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent) if (!pdata) return 1; - if (hEvent == NULL) + if (hEvent == 0) return 0; wchar_t szHeader[256]; @@ -647,7 +647,7 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve static int TSAPI PopupPreview(NEN_OPTIONS *pluginOptions) { - PopupShowT(pluginOptions, NULL, NULL, EVENTTYPE_MESSAGE, NULL); + PopupShowT(pluginOptions, 0, 0, EVENTTYPE_MESSAGE, nullptr); return 0; } @@ -655,7 +655,7 @@ static int TSAPI PopupPreview(NEN_OPTIONS *pluginOptions) // bForced is used to only update the status, nickname etc. and does NOT update the unread count void TSAPI UpdateTrayMenuState(CTabBaseDlg *dat, BOOL bForced) { - if (PluginConfig.g_hMenuTrayUnread == 0 || dat->m_hContact == NULL) + if (PluginConfig.g_hMenuTrayUnread == 0 || dat->m_hContact == 0) return; MENUITEMINFO mii = { 0 }; @@ -686,7 +686,7 @@ void TSAPI UpdateTrayMenuState(CTabBaseDlg *dat, BOOL bForced) // if we want tray support, add the contact to the list of unread sessions in the tray menu int TSAPI UpdateTrayMenu(const CTabBaseDlg *dat, WORD wStatus, const char *szProto, const wchar_t *szStatus, MCONTACT hContact, DWORD fromEvent) { - if (!PluginConfig.g_hMenuTrayUnread || hContact == 0 || szProto == NULL) + if (!PluginConfig.g_hMenuTrayUnread || hContact == 0 || szProto == nullptr) return 0; PROTOACCOUNT *acc = Proto_GetAccount(szProto); @@ -695,7 +695,7 @@ int TSAPI UpdateTrayMenu(const CTabBaseDlg *dat, WORD wStatus, const char *szPro return 0; WORD wMyStatus = (wStatus == 0) ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : wStatus; - const wchar_t *szMyStatus = (szStatus == NULL) ? pcli->pfnGetStatusModeDescription(wMyStatus, 0) : szStatus; + const wchar_t *szMyStatus = (szStatus == nullptr) ? pcli->pfnGetStatusModeDescription(wMyStatus, 0) : szStatus; MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(mii); @@ -704,7 +704,7 @@ int TSAPI UpdateTrayMenu(const CTabBaseDlg *dat, WORD wStatus, const char *szPro mii.hbmpItem = HBMMENU_CALLBACK; wchar_t szMenuEntry[80]; - const wchar_t *szNick = NULL; + const wchar_t *szNick = nullptr; if (dat != 0) { szNick = dat->m_cache->getNick(); GetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii); @@ -764,13 +764,13 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi */ if (nen_options.dwStatusMask != -1) { - if (szProto != NULL) { + if (szProto != nullptr) { DWORD dwStatus = (DWORD)CallProtoService(szProto, PS_GETSTATUS, 0, 0); if (!(dwStatus == 0 || dwStatus <= ID_STATUS_OFFLINE || ((1 << (dwStatus - ID_STATUS_ONLINE)) & nen_options.dwStatusMask))) // should never happen, but... return 0; } } - if (nen_options.bNoRSS && szProto != NULL && !strncmp(szProto, "RSS", 3)) + if (nen_options.bNoRSS && szProto != nullptr && !strncmp(szProto, "RSS", 3)) return 0; // filter out RSS popups if (windowOpen && pContainer != 0) { // message window is open, need to check the container config if we want to see a popup nonetheless diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index baadd99bf8..b2cf323b92 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -96,8 +96,8 @@ void CTabBaseDlg::DM_DismissTip(const POINT& pt) void CTabBaseDlg::DM_InitTip() { - m_hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, m_hwnd, NULL, g_hInst, (LPVOID)NULL); + m_hwndTip = CreateWindowEx(0, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_NOPREFIX | TTS_BALLOON, CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, m_hwnd, nullptr, g_hInst, (LPVOID)nullptr); memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); @@ -247,7 +247,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar GetWindowRect(GetDlgItem(m_hwnd, IDC_TIME), &rc); - iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, NULL); + iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); return MsgWindowMenuHandler(iSelection, MENU_LOGMENU); case IDC_PROTOMENU: @@ -270,7 +270,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar CheckMenuItem(submenu, ID_THISCONTACT_BBCODE, MF_BYCOMMAND | ((iLocalFormat > 0) ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(submenu, ID_THISCONTACT_OFF, MF_BYCOMMAND | ((iLocalFormat == -1) ? MF_CHECKED : MF_UNCHECKED)); - iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, NULL); + iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); switch (iSelection) { case ID_MODE_GLOBAL: m_dwFlagsEx &= ~(MWF_SHOW_SPLITTEROVERRIDE); @@ -341,7 +341,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar EnableMenuItem(submenu, ID_FAVORITES_ADDCONTACTTOFAVORITES, !m_cache->isFavorite() ? MF_ENABLED : MF_GRAYED); EnableMenuItem(submenu, ID_FAVORITES_REMOVECONTACTFROMFAVORITES, !m_cache->isFavorite() ? MF_GRAYED : MF_ENABLED); - iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, NULL); + iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); switch (iSelection) { case ID_FAVORITES_ADDCONTACTTOFAVORITES: @@ -370,7 +370,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar EnableMenuItem(submenu, ID_SENDMENU_SENDNUDGE, MF_BYCOMMAND | ((ProtoServiceExists(m_cache->getActiveProto(), PS_SEND_NUDGE) && ServiceExists(MS_NUDGE_SEND)) ? MF_ENABLED : MF_GRAYED)); if (lParam) - iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, NULL); + iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); else iSelection = HIWORD(wParam); @@ -489,7 +489,7 @@ LRESULT CTabBaseDlg::DM_MsgWindowCmdHandler(UINT cmd, WPARAM wParam, LPARAM lPar else GetWindowRect((HWND)lParam, &rc); - iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, NULL); + iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, m_hwnd, nullptr); if (iSelection) Clist_MenuProcessCommand(LOWORD(iSelection), MPCF_CONTACTMENU, m_hContact); @@ -542,7 +542,7 @@ void CTabBaseDlg::DM_InitRichEdit() COLORREF colour = fIsChat ? g_Settings.crLogBackground : m_pContainer->theme.bg; COLORREF inputcharcolor; - char *szStreamOut = NULL; + char *szStreamOut = nullptr; if (!fIsChat && GetWindowTextLength(hwndEdit) > 0) szStreamOut = Message_GetFromStream(hwndEdit); SetWindowText(hwndEdit, L""); @@ -628,7 +628,7 @@ void CTabBaseDlg::DM_InitRichEdit() SetWindowLongPtr(hwndLog, GWL_EXSTYLE, GetWindowLongPtr(hwndLog, GWL_EXSTYLE) &~(WS_EX_RIGHT | WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR)); } } - if (szStreamOut != NULL) { + if (szStreamOut != nullptr) { SETTEXTEX stx = { ST_DEFAULT, CP_UTF8 }; SendMessage(hwndEdit, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szStreamOut); mir_free(szStreamOut); @@ -723,7 +723,7 @@ void CTabBaseDlg::DM_ScrollToBottom(WPARAM wParam, LPARAM lParam) PostMessage(hwnd, WM_VSCROLL, MAKEWPARAM(SB_BOTTOM, 0), 0); if (lParam) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); } static void LoadKLThread(LPVOID _param) @@ -800,10 +800,10 @@ void CTabBaseDlg::DM_UpdateLastMessage() const mir_snwprintf(szBuf, L"UID: %s", m_cache->getUIN()); else if (m_lastMessage) { wchar_t date[64], time[64]; - TimeZone_PrintTimeStamp(NULL, m_lastMessage, L"d", date, _countof(date), 0); + TimeZone_PrintTimeStamp(nullptr, m_lastMessage, L"d", date, _countof(date), 0); if (m_pContainer->dwFlags & CNT_UINSTATUSBAR && mir_wstrlen(date) > 6) date[mir_wstrlen(date) - 5] = 0; - TimeZone_PrintTimeStamp(NULL, m_lastMessage, L"t", time, _countof(time), 0); + TimeZone_PrintTimeStamp(nullptr, m_lastMessage, L"t", time, _countof(time), 0); mir_snwprintf(szBuf, TranslateT("Last received: %s at %s"), date, time); } else szBuf[0] = 0; @@ -841,7 +841,7 @@ HWND CTabBaseDlg::DM_CreateClist() return 0; } - HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248, 184, 0, 30, 30, m_hwnd, (HMENU)IDC_CLIST, g_hInst, NULL); + HWND hwndClist = CreateWindowExA(0, "CListControl", "", WS_TABSTOP | WS_VISIBLE | WS_CHILD | 0x248, 184, 0, 30, 30, m_hwnd, (HMENU)IDC_CLIST, g_hInst, nullptr); SendMessage(hwndClist, WM_TIMER, 14, 0); HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_FINDCONTACT, m_hContact, 0); @@ -988,7 +988,7 @@ void CTabBaseDlg::DM_NotifyTyping(int mode) if (!db_get_b(hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) return; - if (szProto == NULL) // should not, but who knows... + if (szProto == nullptr) // should not, but who knows... return; // check status and capabilities of the protocol @@ -1046,7 +1046,7 @@ void CSrmmWindow::DM_OptionsApplied(WPARAM, LPARAM lParam) DM_InitRichEdit(); if (m_hwnd == m_pContainer->hwndActive) SendMessage(m_pContainer->hwnd, WM_SIZE, 0, 0); - InvalidateRect(m_message.GetHwnd(), NULL, FALSE); + InvalidateRect(m_message.GetHwnd(), nullptr, FALSE); if (!lParam) { if (IsIconic(m_pContainer->hwnd)) m_dwFlags |= MWF_DEFERREDREMAKELOG; @@ -1217,7 +1217,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); - if (m_hDbEventFirst == NULL) + if (m_hDbEventFirst == 0) m_hDbEventFirst = hDbEvent; bool bIsStatusChangeEvent = IsStatusEvent(dbei.eventType); @@ -1261,7 +1261,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) if (hDbEvent != m_hDbEventFirst) { if (!(m_dwFlagsEx & MWF_SHOW_SCROLLINGDISABLED)) - StreamInEvents(hDbEvent, 1, 1, NULL); + StreamInEvents(hDbEvent, 1, 1, nullptr); else { if (m_iNextQueuedEvent >= m_iEventQueueSize) { m_hQueuedEvents = (MEVENT*)mir_realloc(m_hQueuedEvents, (m_iEventQueueSize + 10) * sizeof(MEVENT)); @@ -1272,7 +1272,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) wchar_t szBuf[100]; mir_snwprintf(szBuf, TranslateT("Auto scrolling is disabled, %d message(s) queued (press F12 to enable it)"), m_iNextQueuedEvent); SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, szBuf); - RedrawWindow(GetDlgItem(m_hwnd, IDC_LOGFROZENTEXT), NULL, NULL, RDW_INVALIDATE); + RedrawWindow(GetDlgItem(m_hwnd, IDC_LOGFROZENTEXT), nullptr, nullptr, RDW_INVALIDATE); } } else SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); @@ -1291,7 +1291,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) m_iFlashIcon = PluginConfig.g_IconMsgEvent; break; } - SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); + SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr); m_bCanFlashTab = true; } @@ -1335,7 +1335,7 @@ void CTabBaseDlg::DM_EventAdded(WPARAM hContact, LPARAM lParam) void CTabBaseDlg::DM_HandleAutoSizeRequest(REQRESIZE* rr) { - if (rr == NULL || GetForegroundWindow() != m_pContainer->hwnd) + if (rr == nullptr || GetForegroundWindow() != m_pContainer->hwnd) return; if (!m_bIsAutosizingInput || m_iInputAreaHeight == -1) @@ -1396,7 +1396,7 @@ void CTabBaseDlg::DM_UpdateTitle(WPARAM, LPARAM lParam) m_dwFlagsEx = m_idle ? m_dwFlagsEx | MWF_SHOW_ISIDLE : m_dwFlagsEx & ~MWF_SHOW_ISIDLE; m_wStatus = m_cache->getStatus(); - wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_szProto == NULL ? ID_STATUS_OFFLINE : m_wStatus, 0), _TRUNCATE); + wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_szProto == nullptr ? ID_STATUS_OFFLINE : m_wStatus, 0), _TRUNCATE); if (lParam != 0) { wchar_t newcontactname[128]; newcontactname[0] = 0; @@ -1479,7 +1479,7 @@ static HANDLE hHookIconPressedEvt; static int OnSrmmIconChanged(WPARAM hContact, LPARAM) { - if (hContact == NULL) + if (hContact == 0) M.BroadcastMessage(DM_STATUSICONCHANGE, 0, 0); else { HWND hwnd = M.FindWindow(hContact); @@ -1501,23 +1501,23 @@ void CTabBaseDlg::DrawStatusIcons(HDC hDC, const RECT &rc, int gap) if (!mir_strcmp(sid->szModule, MSG_ICON_MODULE)) { if (sid->dwId == MSG_ICON_SOUND) { DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_SOUNDS], - PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); + PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); DrawIconEx(hDC, x, y, m_pContainer->dwFlags & CNT_NOSOUND ? PluginConfig.g_iconOverlayDisabled : PluginConfig.g_iconOverlayEnabled, - PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); + PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); } else if (sid->dwId == MSG_ICON_UTN) { if (m_bType == SESSIONTYPE_IM || si->iType == GCW_PRIVMESS) { - DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); + DrawIconEx(hDC, x, y, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); DrawIconEx(hDC, x, y, db_get_b(m_hContact, SRMSGMOD, SRMSGSET_TYPING, M.GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW)) ? - PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); + PluginConfig.g_iconOverlayEnabled : PluginConfig.g_iconOverlayDisabled, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); } else CSkin::DrawDimmedIcon(hDC, x, y, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING], 50); } else if (sid->dwId == MSG_ICON_SESSION) { - DrawIconEx(hDC, x, y, PluginConfig.g_sideBarIcons[0], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, NULL, DI_NORMAL); + DrawIconEx(hDC, x, y, PluginConfig.g_sideBarIcons[0], PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, 0, nullptr, DI_NORMAL); } } else { @@ -1527,10 +1527,10 @@ void CTabBaseDlg::DrawStatusIcons(HDC hDC, const RECT &rc, int gap) else hIcon = sid->hIcon; - if ((sid->flags & MBF_DISABLED) && sid->hIconDisabled == NULL) + if ((sid->flags & MBF_DISABLED) && sid->hIconDisabled == nullptr) CSkin::DrawDimmedIcon(hDC, x, y, PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, hIcon, 50); else - DrawIconEx(hDC, x, y, hIcon, 16, 16, 0, NULL, DI_NORMAL); + DrawIconEx(hDC, x, y, hIcon, 16, 16, 0, nullptr, DI_NORMAL); } x += PluginConfig.m_smcxicon + gap; @@ -1549,7 +1549,7 @@ void CTabBaseDlg::CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int co UINT iconNum = (pt.x - (rc.left + 0)) / (PluginConfig.m_smcxicon + gap); StatusIconData *sid = Srmm_GetNthIcon(m_hContact, iconNum); - if (sid == NULL) + if (sid == nullptr) return; if (!mir_strcmp(sid->szModule, MSG_ICON_MODULE)) { @@ -1557,17 +1557,17 @@ void CTabBaseDlg::CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int co if (GetKeyState(VK_SHIFT) & 0x8000) { for (TContainerData *p = pFirstContainer; p; p = p->pNext) { p->dwFlags = ((m_pContainer->dwFlags & CNT_NOSOUND) ? p->dwFlags | CNT_NOSOUND : p->dwFlags & ~CNT_NOSOUND); - InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); + InvalidateRect(m_pContainer->hwndStatus, nullptr, TRUE); } } else { m_pContainer->dwFlags ^= CNT_NOSOUND; - InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); + InvalidateRect(m_pContainer->hwndStatus, nullptr, TRUE); } } else if (sid->dwId == MSG_ICON_UTN && code != NM_RCLICK && (m_bType == SESSIONTYPE_IM || si->iType == GCW_PRIVMESS)) { SendMessage(m_pContainer->hwndActive, WM_COMMAND, IDC_SELFTYPING, 0); - InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); + InvalidateRect(m_pContainer->hwndStatus, nullptr, TRUE); } else if (sid->dwId == MSG_ICON_SESSION) { if (code == NM_CLICK) @@ -1583,7 +1583,7 @@ void CTabBaseDlg::CheckStatusIconClick(POINT pt, const RECT &rc, int gap, int co sicd.szModule = sid->szModule; sicd.flags = (code == NM_RCLICK ? MBCF_RIGHTBUTTON : 0); NotifyEventHooks(hHookIconPressedEvt, m_hContact, (LPARAM)&sicd); - InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); + InvalidateRect(m_pContainer->hwndStatus, nullptr, TRUE); } } @@ -1628,7 +1628,7 @@ void CTabBaseDlg::DM_ErrorDetected(int type, int flag) if (resent) { SendJob *job = sendQueue->getJobByIndex(m_iCurrentQueueError); - SetTimer(m_hwnd, TIMERID_MSGSEND + m_iCurrentQueueError, PluginConfig.m_MsgTimeout, NULL); + SetTimer(m_hwnd, TIMERID_MSGSEND + m_iCurrentQueueError, PluginConfig.m_MsgTimeout, nullptr); job->iStatus = SendQueue::SQ_INPROGRESS; m_iCurrentQueueError = -1; sendQueue->showErrorControls(this, FALSE); diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 21c8880da1..f7be82207b 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -74,8 +74,8 @@ void CGlobals::reloadSystemStartup() SkinAddNewSoundEx("SendMsg", LPGEN("Instant messages"), LPGEN("Outgoing")); SkinAddNewSoundEx("SendError", LPGEN("Instant messages"), LPGEN("Message send error")); - hCurSplitNS = LoadCursor(NULL, IDC_SIZENS); - hCurSplitWE = LoadCursor(NULL, IDC_SIZEWE); + hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS); + hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE); HDC hScrnDC = GetDC(0); m_DPIscaleX = GetDeviceCaps(hScrnDC, LOGPIXELSX) / 96.0; @@ -142,7 +142,7 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_bSendOnDblEnter = M.GetBool("SendOnDblEnter", false); m_bAutoLocaleSupport = M.GetBool("al", false); m_bAutoSwitchTabs = M.GetBool("autoswitchtabs", true); - m_iTabNameLimit = db_get_w(NULL, SRMSGMOD_T, "cut_at", 15); + m_iTabNameLimit = db_get_w(0, SRMSGMOD_T, "cut_at", 15); m_bCutContactNameOnTabs = M.GetBool("cuttitle", false); m_bStatusOnTabs = M.GetBool("tabstatus", true); m_bLogStatusChanges = M.GetBool("logstatuschanges", false); @@ -298,7 +298,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) db_set_b(0, SRMSGMOD_T, "avatarmode", 2); PluginConfig.g_hwndHotkeyHandler = CreateWindowEx(0, L"TSHK", L"", WS_POPUP, - 0, 0, 40, 40, 0, 0, g_hInst, NULL); + 0, 0, 40, 40, 0, 0, g_hInst, nullptr); ::CreateTrayMenus(TRUE); if (nen_options.bTraySupport) @@ -360,7 +360,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) CContactCache *c = CContactCache::getContactCache(hContact); const char *szProto = c->getProto(); - if (szProto == NULL) + if (szProto == nullptr) return 0; if (!c->isValid()) @@ -401,7 +401,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) PostMessage(hwnd, DM_UPDATEUIN, 0, 0); } - if (hwnd != NULL) { + if (hwnd != nullptr) { if (!strcmp(setting, "MirVer")) PostMessage(hwnd, DM_CLIENTCHANGED, 0, 0); if (fChanged || fExtendedStatusChange) @@ -525,7 +525,7 @@ void CGlobals::RestoreUnreadMessageAlerts(void) DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); if (!dbei.markedRead() && dbei.eventType == EVENTTYPE_MESSAGE) { - if (M.FindWindow(hContact) != NULL) + if (M.FindWindow(hContact) != nullptr) continue; arEvents.insert(new MSavedEvent(hContact, hDbEvent)); @@ -556,7 +556,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) return; CSrmmWindow *dat = c->getDat(); - if (dat == NULL || !c->isValid()) + if (dat == nullptr || !c->isValid()) return; MCONTACT hContact = c->getContact(); @@ -591,9 +591,9 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) dbei.cbBlob = (int)mir_strlen(szMsg) + 1; dbei.flags = DBEF_UTF | DBEF_READ; dbei.eventType = EVENTTYPE_STATUSCHANGE; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.szModule = (char*)c->getProto(); - dat->StreamInEvents(NULL, 1, 1, &dbei); + dat->StreamInEvents(0, 1, 1, &dbei); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index ed75b909ba..202e6e7423 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -108,7 +108,7 @@ void TSAPI HandleMenuEntryFromhContact(MCONTACT hContact) } SESSION_INFO *si = SM_FindSessionByHCONTACT(hContact); - if (si != NULL) { + if (si != nullptr) { // session does exist, but no window is open for it if (si->hWnd) { TContainerData *pContainer = 0; @@ -157,13 +157,13 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated"); ShowWindow(hwndDlg, SW_HIDE); hSvcHotkeyProcessor = CreateServiceFunction(MS_TABMSG_HOTKEYPROCESS, HotkeyProcessor); - SetTimer(hwndDlg, TIMERID_SENDLATER, TIMEOUT_SENDLATER, NULL); + SetTimer(hwndDlg, TIMERID_SENDLATER, TIMEOUT_SENDLATER, nullptr); break; case WM_HOTKEY: { CLISTEVENT *cli = pcli->pfnGetEvent(-1, 0); - if (cli != NULL) { + if (cli != nullptr) { if (strncmp(cli->pszService, "SRMsg/TypingMessage", mir_strlen(cli->pszService))) { CallService(cli->pszService, 0, (LPARAM)cli); break; @@ -197,7 +197,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP HWND hWnd = M.FindWindow((MCONTACT)dis->itemID); DWORD idle = 0; - if (hWnd == NULL) { + if (hWnd == nullptr) { SESSION_INFO *si = SM_FindSessionByHCONTACT((MCONTACT)dis->itemID); hWnd = si ? si->hWnd : 0; } @@ -211,7 +211,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dis->itemData > 0) hIcon = (dis->itemData & 0x10000000) ? pci->hIcons[ICON_HIGHLIGHT] : PluginConfig.g_IconMsgEvent; - else if (dat != NULL) { + else if (dat != nullptr) { hIcon = dat->GetMyContactIcon(0); idle = dat->m_idle; } @@ -234,10 +234,10 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (wParam == 100) SetForegroundWindow(hwndDlg); if (GetMenuItemCount(PluginConfig.g_hMenuTrayUnread) > 0) { - BOOL iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + BOOL iSelection = TrackPopupMenu(PluginConfig.g_hMenuTrayUnread, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); HandleMenuEntryFromhContact((MCONTACT)iSelection); } - else TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + else TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 8), TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (wParam == 100) PostMessage(hwndDlg, WM_NULL, 0, 0); @@ -264,7 +264,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP } } while (--i >= 0); - if (uid == 0 && pLastActiveContainer != NULL) { // no session found, restore last active container + if (uid == 0 && pLastActiveContainer != nullptr) { // no session found, restore last active container if (IsIconic(pLastActiveContainer->hwnd) || !IsWindowVisible(pLastActiveContainer->hwnd)) { SendMessage(pLastActiveContainer->hwnd, WM_SYSCOMMAND, SC_RESTORE, 0); SetForegroundWindow(pLastActiveContainer->hwnd); @@ -298,7 +298,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckMenuItem(submenu, ID_TRAYCONTEXT_DON, MF_BYCOMMAND | (nen_options.iNoAutoPopup ? MF_CHECKED : MF_UNCHECKED)); EnableMenuItem(submenu, ID_TRAYCONTEXT_HIDEALLMESSAGECONTAINERS, MF_BYCOMMAND | (nen_options.bTraySupport) ? MF_ENABLED : MF_GRAYED); CheckMenuItem(submenu, ID_TRAYCONTEXT_SHOWTHETRAYICON, MF_BYCOMMAND | (nen_options.bTraySupport ? MF_CHECKED : MF_UNCHECKED)); - BOOL iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + BOOL iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (iSelection) { MENUITEMINFO mii = { 0 }; mii.cbSize = sizeof(mii); @@ -352,7 +352,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // wParam is the hContact // lParam the event handle case DM_HANDLECLISTEVENT: - // if lParam == NULL, don't consider clist events, just open the message tab + // if lParam == nullptr, don't consider clist events, just open the message tab if (lParam == 0) HandleMenuEntryFromhContact(wParam); else { @@ -442,8 +442,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP } if (pCont->SideBar) if (pCont->SideBar->isActive()) // the container for the sidebar buttons - RedrawWindow(GetDlgItem(pCont->hwnd, 5000), NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); - RedrawWindow(pCont->hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); + RedrawWindow(GetDlgItem(pCont->hwnd, 5000), nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(pCont->hwnd, nullptr, nullptr, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN); } } M.BroadcastMessage(WM_DWMCOMPOSITIONCHANGED, 0, 0); @@ -528,7 +528,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP DeleteObject(pCont->cachedHBM); DeleteDC(pCont->cachedDC); pCont->cachedDC = 0; - RedrawWindow(pCont->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME); + RedrawWindow(pCont->hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME); } break; diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index a07f688019..d5f75c4ce1 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -171,7 +171,7 @@ void CInfoPanel::showHide() const if (!m_active && m_dat->m_hwndPanelPic) { ::DestroyWindow(m_dat->m_hwndPanelPic); - m_dat->m_hwndPanelPic = NULL; + m_dat->m_hwndPanelPic = nullptr; } m_dat->m_iRealAvatarHeight = 0; @@ -184,29 +184,29 @@ void CInfoPanel::showHide() const if (m_active) { if (m_dat->m_hwndContactPic) { ::DestroyWindow(m_dat->m_hwndContactPic); - m_dat->m_hwndContactPic = NULL; + m_dat->m_hwndContactPic = nullptr; } m_dat->GetAvatarVisibility(); Configure(); - InvalidateRect(hwndDlg, NULL, FALSE); + InvalidateRect(hwndDlg, nullptr, FALSE); } Utils::showDlgControl(hwndDlg, IDC_PANELSPLITTER, m_active ? SW_SHOW : SW_HIDE); ::SendMessage(hwndDlg, WM_SIZE, 0, 0); - ::InvalidateRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), NULL, TRUE); + ::InvalidateRect(GetDlgItem(hwndDlg, IDC_CONTACTPIC), nullptr, TRUE); } else { Utils::showDlgControl(hwndDlg, IDC_PANELSPLITTER, m_active ? SW_SHOW : SW_HIDE); if (m_active) { Configure(); - ::InvalidateRect(hwndDlg, NULL, FALSE); + ::InvalidateRect(hwndDlg, nullptr, FALSE); } ::SendMessage(hwndDlg, WM_SIZE, 0, 0); } ::SetAeroMargins(m_dat->m_pContainer); if (M.isAero()) - ::InvalidateRect(GetParent(hwndDlg), NULL, FALSE); + ::InvalidateRect(GetParent(hwndDlg), nullptr, FALSE); m_dat->DM_ScrollToBottom(0, 1); } @@ -376,7 +376,7 @@ void CInfoPanel::renderContent(const HDC hdc) void CInfoPanel::RenderIPNickname(const HDC hdc, RECT &rcItem) { - const wchar_t *szStatusMsg = NULL; + const wchar_t *szStatusMsg = nullptr; const wchar_t *szTextToShow = 0; bool fShowUin = false; COLORREF clr = 0; @@ -486,7 +486,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) wchar_t szBuf[256]; if (m_dat->m_idle) { - time_t diff = time(NULL) - m_dat->m_idle; + time_t diff = time(nullptr) - m_dat->m_idle; int i_hrs = diff / 3600; int i_mins = (diff - i_hrs * 3600) / 60; mir_snwprintf(szBuf, TranslateT("%s Idle: %dh,%02dm"), tszUin, i_hrs, i_mins); @@ -779,7 +779,7 @@ void CInfoPanel::handleClick(const POINT& pt) } HMENU m = constructContextualMenu(); if (m) { - LRESULT r = ::TrackPopupMenu(m, TPM_RETURNCMD, pt.x, pt.y, 0, m_dat->GetHwnd(), NULL); + LRESULT r = ::TrackPopupMenu(m, TPM_RETURNCMD, pt.x, pt.y, 0, m_dat->GetHwnd(), nullptr); ::DestroyMenu(m); if (S_OK != cmdHandler(r)) @@ -1210,8 +1210,8 @@ INT_PTR CALLBACK CInfoPanel::ConfigDlgProc(HWND hwnd, UINT msg, WPARAM wParam, L if (m_height != lOldHeight) { ::SendMessage(m_dat->GetHwnd(), WM_SIZE, 0, 0); ::SetAeroMargins(m_dat->m_pContainer); - ::RedrawWindow(m_dat->GetHwnd(), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); - ::RedrawWindow(GetParent(m_dat->GetHwnd()), NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW); + ::RedrawWindow(m_dat->GetHwnd(), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); + ::RedrawWindow(GetParent(m_dat->GetHwnd()), nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW); } } break; @@ -1309,7 +1309,7 @@ CTip::CTip(const HWND hwndParent, const MCONTACT hContact, const wchar_t *pszTex 0, 0, 40, 40, 0, 0, g_hInst, this); m_hRich = ::CreateWindowEx(0, L"RICHEDIT50W", L"", WS_CHILD | ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_READONLY | WS_VSCROLL | WS_TABSTOP, - 0, 0, 40, 40, m_hwnd, reinterpret_cast(1000), g_hInst, NULL); + 0, 0, 40, 40, m_hwnd, reinterpret_cast(1000), g_hInst, nullptr); ::SendMessage(m_hRich, EM_AUTOURLDETECT, TRUE, 0); ::SendMessage(m_hRich, EM_SETEVENTMASK, 0, ENM_LINK); @@ -1359,7 +1359,7 @@ void CTip::show(const RECT& rc, POINT& pt, const HICON hIcon, const wchar_t *szT smadd.Protocolname = const_cast(c->getActiveProto()); smadd.hContact = c->getActiveContact(); smadd.flags = 0; - smadd.rangeToReplace = NULL; + smadd.rangeToReplace = nullptr; smadd.disableRedraw = TRUE; CallService(MS_SMILEYADD_REPLACESMILEYS, TABSRMM_SMILEYADD_BKGCOLORMODE, (LPARAM)&smadd); } @@ -1411,7 +1411,7 @@ void CTip::registerClass() wc.cbSize = sizeof(wc); wc.lpszClassName = L"RichEditTipClass"; wc.lpfnWndProc = CTip::WndProcStub; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(CTip *); wc.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC; RegisterClassEx(&wc); diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 2ef1e245bc..f80288b3bf 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -250,10 +250,10 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) else foundWin = 0; - TContainerData *pContainer = NULL; + TContainerData *pContainer = nullptr; if (hwnd) { SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pContainer); - if (pContainer == NULL) // should never happen + if (pContainer == nullptr) // should never happen return 0; } @@ -301,7 +301,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) wchar_t szTip[256]; mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); if (fShowOnClist && M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0)) - Clist_TrayNotifyW(NULL, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); + Clist_TrayNotifyW(nullptr, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); if (fShowOnClist) { pcli->pfnRemoveEvent(hContact, 1); @@ -337,9 +337,9 @@ int CMimAPI::ProtoAck(WPARAM, LPARAM lParam) for (int j = 0; j < SendQueue::NR_SENDJOBS; j++) { SendJob &p = jobs[j]; if (pAck->hProcess == p.hSendId && pAck->hContact == p.hContact) { - CSrmmWindow *dat = p.hOwnerWnd ? (CSrmmWindow*)GetWindowLongPtr(p.hOwnerWnd, GWLP_USERDATA) : NULL; - if (dat == NULL) { - sendQueue->ackMessage(NULL, (WPARAM)MAKELONG(j, i), lParam); + CSrmmWindow *dat = p.hOwnerWnd ? (CSrmmWindow*)GetWindowLongPtr(p.hOwnerWnd, GWLP_USERDATA) : nullptr; + if (dat == nullptr) { + sendQueue->ackMessage(nullptr, (WPARAM)MAKELONG(j, i), lParam); return 0; } if (dat->m_hContact == p.hContact || dat->m_hContact == hMeta) { @@ -358,8 +358,8 @@ int CMimAPI::ProtoAck(WPARAM, LPARAM lParam) int CMimAPI::PrebuildContactMenu(WPARAM hContact, LPARAM) { - if (hContact == NULL) - return NULL; + if (hContact == 0) + return 0; bool bEnabled = false; char *szProto = GetContactProto(hContact); @@ -410,7 +410,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) db_event_get(hDbEvent, &dbei); HWND hwnd = M.FindWindow(hContact); - if (hwnd == NULL) + if (hwnd == nullptr) hwnd = M.FindWindow(db_event_getContact(hDbEvent)); BOOL isCustomEvent = IsCustomEvent(dbei.eventType); @@ -429,7 +429,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) if (hwnd) { TContainerData *pTargetContainer = 0; SendMessage(hwnd, DM_QUERYCONTAINER, 0, (LPARAM)&pTargetContainer); - if (pTargetContainer == NULL || !PluginConfig.m_bHideOnClose || IsWindowVisible(pTargetContainer->hwnd)) + if (pTargetContainer == nullptr || !PluginConfig.m_bHideOnClose || IsWindowVisible(pTargetContainer->hwnd)) return 0; WINDOWPLACEMENT wp = { 0 }; @@ -447,7 +447,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) } TContainerData *pContainer = FindContainerByName(szName); - if (pContainer != NULL) { + if (pContainer != nullptr) { if (bAutoContainer) { ShowWindow(pTargetContainer->hwnd, SW_SHOWMINNOACTIVE); return 0; @@ -499,7 +499,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) if (bAllowAutoCreate && (bAutoPopup || bAutoCreate)) { if (bAutoPopup) { TContainerData *pContainer = FindContainerByName(szName); - if (pContainer == NULL) + if (pContainer == nullptr) pContainer = CreateContainer(szName, FALSE, hContact); if (pContainer) CreateNewTabForContact(pContainer, hContact, true, true, false); @@ -508,9 +508,9 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) bool bActivate = false, bPopup = M.GetByte("cpopup", 0) != 0; TContainerData *pContainer = FindContainerByName(szName); - if (pContainer != NULL) { + if (pContainer != nullptr) { if (M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) { - if ((pContainer = FindMatchingContainer(L"default")) != NULL) { + if ((pContainer = FindMatchingContainer(L"default")) != nullptr) { CreateNewTabForContact(pContainer, hContact, bActivate, bPopup, true, hDbEvent); return 0; } @@ -521,7 +521,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) } } if (bAutoContainer) { - if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact)) != NULL) { // 2 means create minimized, don't popup... + if ((pContainer = CreateContainer(szName, CNT_CREATEFLAG_MINIMIZED, hContact)) != nullptr) { // 2 means create minimized, don't popup... CreateNewTabForContact(pContainer, hContact, bActivate, bPopup, true, hDbEvent); SendMessageW(pContainer->hwnd, WM_SIZE, 0, 0); } @@ -533,7 +533,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) // the contact list for flashing nowindowcreate: if (!(dbei.flags & DBEF_READ)) { - UpdateTrayMenu(0, 0, dbei.szModule, NULL, hContact, 1); + UpdateTrayMenu(0, 0, dbei.szModule, nullptr, hContact, 1); if (!nen_options.bTraySupport) { wchar_t toolTip[256], *contactName; diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index a36dd3177b..c34353961c 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -44,7 +44,7 @@ static wchar_t* getMenuEntry(int i) { char MEntry[256]; mir_snprintf(MEntry, "MenuEntry_%u", i); - return db_get_wsa(NULL, "tabmodplus", MEntry); + return db_get_wsa(0, "tabmodplus", MEntry); } static int RegisterCustomButton(WPARAM, LPARAM) @@ -96,7 +96,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) AppendMenu(hMenu, MF_STRING, menunum + 1, pwszText); } - int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, NULL); + int res = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbcd->pt.x, cbcd->pt.y, 0, cbcd->hwndFrom, nullptr); if (res != 0) { bufSize = textlenght + mir_wstrlen(arMenuLines[res-1]) + 2; pwszFormatedText.Format(arMenuLines[res-1], pszText); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 98676fe553..e1329cb6b8 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -121,7 +121,7 @@ static void ShowPopupMenu(CTabBaseDlg *dat, int idFrom, HWND hwndFrom, POINT pt) NotifyEventHooks(PluginConfig.m_event_MsgPopup, 0, (LPARAM)&mwpd); } - int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); + int iSelection = TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, nullptr); if (idFrom == IDC_LOG || idFrom == IDC_MESSAGE) { // Second notification @@ -363,7 +363,7 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) } BB_SetButtonsPos(); if (M.isAero()) - InvalidateRect(m_hwndParent, NULL, FALSE); + InvalidateRect(m_hwndParent, nullptr, FALSE); if (m_pContainer->dwFlags & CNT_SIDEBAR) m_pContainer->SideBar->setActiveItem(this); @@ -518,7 +518,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar bool isCtrl, isShift, isAlt; HWND hwndParent = GetParent(hwnd); CSrmmWindow *mwdat = (CSrmmWindow*)GetWindowLongPtr(hwndParent, GWLP_USERDATA); - if (mwdat == NULL) + if (mwdat == nullptr) return 0; // prevent the rich edit from switching text direction or keyboard layout when @@ -630,8 +630,8 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar if (PluginConfig.m_bSendOnDblEnter) { LONG_PTR lastEnterTime = GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (lastEnterTime + 2 < time(NULL)) { - lastEnterTime = time(NULL); + if (lastEnterTime + 2 < time(nullptr)) { + lastEnterTime = time(nullptr); SetWindowLongPtr(hwnd, GWLP_USERDATA, lastEnterTime); break; } @@ -844,7 +844,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM dat->DM_ScrollToBottom(0, 1); if (dat->m_bType == SESSIONTYPE_IM && hwnd == GetDlgItem(hwndParent, IDC_PANELSPLITTER)) { SendMessage(hwndParent, WM_SIZE, 0, 0); - RedrawWindow(hwndParent, NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW); + RedrawWindow(hwndParent, nullptr, nullptr, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW); } else if (hwnd == GetDlgItem(hwndParent, IDC_SPLITTERY)) { if (hwndCapture != hwnd) @@ -860,7 +860,7 @@ LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (dat->m_bIsAutosizingInput) selection = ID_SPLITTERCONTEXT_SETPOSITIONFORTHISSESSION; else - selection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 12), TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, NULL); + selection = TrackPopupMenu(GetSubMenu(PluginConfig.g_hMenuContext, 12), TPM_RETURNCMD, pt.x, pt.y, 0, hwndParent, nullptr); switch (selection) { case ID_SPLITTERCONTEXT_SAVEFORTHISCONTACTONLY: @@ -979,9 +979,9 @@ void CSrmmWindow::OnInitDialog() } m_hDbEventFirst = 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); - wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_szProto == NULL ? ID_STATUS_OFFLINE : m_wStatus, 0), _TRUNCATE); + wcsncpy_s(m_wszStatus, pcli->pfnGetStatusModeDescription(m_szProto == nullptr ? ID_STATUS_OFFLINE : m_wStatus, 0), _TRUNCATE); } else m_wStatus = ID_STATUS_OFFLINE; @@ -992,8 +992,8 @@ void CSrmmWindow::OnInitDialog() GetClientIcon(); CustomizeButton(CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 6, DPISCALEY_S(20), - m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, NULL)); - m_hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, L"Static", L"", SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, m_hwnd, (HMENU)6000, NULL, NULL); + m_hwnd, (HMENU)IDC_TOGGLESIDEBAR, g_hInst, nullptr)); + m_hwndPanelPicParent = CreateWindowEx(WS_EX_TOPMOST, L"Static", L"", SS_OWNERDRAW | WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, m_hwnd, (HMENU)6000, nullptr, nullptr); mir_subclassWindow(m_hwndPanelPicParent, CInfoPanel::avatarParentSubclass); m_bShowUIElements = (m_pContainer->dwFlags & CNT_HIDETOOLBAR) == 0; @@ -1011,7 +1011,7 @@ void CSrmmWindow::OnInitDialog() if (m_maxHistory) m_hHistoryEvents = (MEVENT*)mir_alloc(m_maxHistory * sizeof(MEVENT)); else - m_hHistoryEvents = NULL; + m_hHistoryEvents = nullptr; if (!m_bIsMeta) SendMessage(m_hwnd, DM_UPDATEWINICON, 0, 0); @@ -1020,7 +1020,7 @@ void CSrmmWindow::OnInitDialog() m_iMultiSplit = (int)M.GetDword(SRMSGMOD, "multisplit", 150); m_nTypeMode = PROTOTYPE_SELFTYPING_OFF; - SetTimer(m_hwnd, TIMERID_TYPE, 1000, NULL); + SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr); m_iLastEventType = 0xffffffff; // load log option flags... @@ -1109,7 +1109,7 @@ void CSrmmWindow::OnInitDialog() m_log.SendMsg(EM_SETLANGOPTIONS, 0, m_log.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOFONTSIZEADJUST); // add us to the tray list (if it exists) - if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && m_szProto != NULL) + if (PluginConfig.g_hMenuTrayUnread != 0 && m_hContact != 0 && m_szProto != nullptr) UpdateTrayMenu(0, m_wStatus, m_szProto, m_wszStatus, m_hContact, FALSE); m_log.SendMsg(EM_AUTOURLDETECT, TRUE, 0); @@ -1175,7 +1175,7 @@ void CSrmmWindow::OnInitDialog() if (m_pContainer->dwFlags & CNT_CREATE_MINIMIZED || !m_bActivate || m_pContainer->dwFlags & CNT_DEFERREDTABSELECT) { m_iFlashIcon = PluginConfig.g_IconMsgEvent; - SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, NULL); + SetTimer(m_hwnd, TIMERID_FLASHWND, TIMEOUT_FLASHWND, nullptr); m_bCanFlashTab = true; DBEVENTINFO dbei = { 0 }; @@ -1347,7 +1347,7 @@ void CSrmmWindow::ReplayQueue() { for (int i = 0; i < m_iNextQueuedEvent; i++) if (m_hQueuedEvents[i] != 0) - StreamInEvents(m_hQueuedEvents[i], 1, 1, NULL); + StreamInEvents(m_hQueuedEvents[i], 1, 1, nullptr); m_iNextQueuedEvent = 0; SetDlgItemText(m_hwnd, IDC_LOGFROZENTEXT, m_bNotOnList ? TranslateT("Contact not on list. You may add it...") : @@ -1855,7 +1855,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) HWND hwndEdit = m_message.GetHwnd(); SetWindowPos(hwndEdit, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE); SendMessage(m_hwnd, WM_SIZE, 0, 0); - RedrawWindow(hwndEdit, NULL, NULL, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE); + RedrawWindow(hwndEdit, nullptr, nullptr, RDW_INVALIDATE | RDW_FRAME | RDW_UPDATENOW | RDW_ERASE); DM_ScrollToBottom(0, 0); Utils::showDlgControl(m_hwnd, IDC_MULTISPLITTER, (m_sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE); Utils::showDlgControl(m_hwnd, IDC_CLIST, (m_sendMode & SMODE_MULTIPLE) ? SW_SHOW : SW_HIDE); @@ -2051,8 +2051,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) { HCURSOR hCur = GetCursor(); m_pContainer->MenuBar->Cancel(); - 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; } @@ -2073,7 +2073,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) cr.cpMin = cr.cpMax; if (isCtrl) { SETTEXTEX stx = { ST_KEEPUNDO | ST_SELECTION, CP_UTF8 }; - char *streamOut = NULL; + char *streamOut = nullptr; if (isAlt) streamOut = Message_GetFromStream(m_log.GetHwnd(), SF_RTFNOOBJS | SFF_PLAINRTF | SFF_SELECTION); else @@ -2103,8 +2103,8 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_pPanel.trackMouse(pt); HCURSOR 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; } } @@ -2273,9 +2273,9 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) if ((pnt.y + 2 >= MIN_PANELHEIGHT + 2) && (pnt.y + 2 < 100) && (pnt.y + 2 < rc.bottom - 30)) m_pPanel.setHeight(pnt.y + 2, true); - RedrawWindow(m_hwnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); + RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE); if (M.isAero()) - InvalidateRect(GetParent(m_hwnd), NULL, FALSE); + InvalidateRect(GetParent(m_hwnd), nullptr, FALSE); } break; @@ -2309,16 +2309,16 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_szMicroLf[0] = 0; m_lastEventTime = 0; m_iLastEventType = -1; - StreamInEvents(m_hDbEventFirst, -1, 0, NULL); + StreamInEvents(m_hDbEventFirst, -1, 0, nullptr); return 0; case DM_APPENDMCEVENT: - if (m_hContact == db_mc_getMeta(wParam) && m_hDbEventFirst == NULL) { + if (m_hContact == db_mc_getMeta(wParam) && m_hDbEventFirst == 0) { m_hDbEventFirst = lParam; SendMessage(m_hwnd, DM_REMAKELOG, 0, 0); } else if (m_hContact == wParam && db_mc_isSub(wParam) && db_event_getContact(lParam) != wParam) - StreamInEvents(lParam, 1, 1, NULL); + StreamInEvents(lParam, 1, 1, nullptr); return 0; case DM_SCROLLIEVIEW: @@ -2480,7 +2480,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) GetCursorPos(&pt); MsgWindowUpdateMenu(submenu, menuID); - int iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL); + int iSelection = TrackPopupMenu(submenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr); MsgWindowMenuHandler(iSelection, menuID); break; } @@ -2488,14 +2488,14 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) HMENU subMenu = GetSubMenu(PluginConfig.g_hMenuContext, 0); MsgWindowUpdateMenu(subMenu, MENU_TABCONTEXT); - int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, NULL); + int iSelection = TrackPopupMenu(subMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwnd, nullptr); if (iSelection >= IDM_CONTAINERMENU) { char szIndex[10]; char *szKey = "TAB_ContainersW"; mir_snprintf(szIndex, "%d", iSelection - IDM_CONTAINERMENU); if (iSelection - IDM_CONTAINERMENU >= 0) { - ptrW val(db_get_wsa(NULL, szKey, szIndex)); + ptrW val(db_get_wsa(0, szKey, szIndex)); if (val) SendMessage(m_hwnd, DM_CONTAINERSELECTED, 0, (LPARAM)val); } @@ -2570,7 +2570,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) break; ptrA streamOut(Message_GetFromStream(m_message.GetHwnd(), final_sendformat ? 0 : SF_TEXT)); - if (streamOut == NULL) + if (streamOut == nullptr) break; CMStringW decoded(ptrW(mir_utf8decodeW(streamOut))); @@ -2602,7 +2602,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) SendMessage(hwndEdit, WM_SETREDRAW, TRUE, 0); SendMessage(hwndEdit, EM_SETSEL, -1, -1); - InvalidateRect(hwndEdit, NULL, FALSE); + InvalidateRect(hwndEdit, nullptr, FALSE); if (memRequired > m_iSendBufferSize) { m_sendBuffer = (char *)mir_realloc(m_sendBuffer, memRequired); @@ -2672,7 +2672,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) selected = (wchar_t*)CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event); } - if (selected != NULL) { + if (selected != nullptr) { ptrW szQuoted(QuoteText(selected)); m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted); break; @@ -2685,7 +2685,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) hDBEvent = m_hDbEventLast; quote_from_last: - if (hDBEvent == NULL) + if (hDBEvent == 0) break; m_log.SendMsg(EM_EXGETSEL, 0, (LPARAM)&sel); @@ -2722,7 +2722,7 @@ quote_from_last: MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + (int)mir_strlen((char *)szText)); bNeedsFree = true; } - if (szConverted != NULL) { + if (szConverted != nullptr) { ptrW szQuoted(QuoteText(szConverted)); m_message.SendMsg(EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)szQuoted); } @@ -2845,7 +2845,7 @@ quote_from_last: case DM_CLIENTCHANGED: GetClientIcon(); if (m_hClientIcon && m_pPanel.isActive()) - InvalidateRect(m_hwnd, NULL, TRUE); + InvalidateRect(m_hwnd, nullptr, TRUE); return 0; case DM_UPDATEUIN: @@ -2868,7 +2868,7 @@ quote_from_last: if (m_pContainer->hwndStatus) { SendMessage(m_pContainer->hwnd, WM_SIZE, 0, 0); SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, (WPARAM)(SBT_OWNERDRAW) | 2, 0); - InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); + InvalidateRect(m_pContainer->hwndStatus, nullptr, TRUE); } return 0; @@ -2893,7 +2893,7 @@ quote_from_last: BOOL not_sending = GetKeyState(VK_CONTROL) & 0x8000; if (!not_sending) { const char *szProto = m_cache->getActiveProto(); - if (szProto == NULL) + if (szProto == nullptr) break; int pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0); @@ -2908,11 +2908,11 @@ quote_from_last: } } - 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)); Utils::AddToFileList(&ppFiles, &totalCount, szFilename); @@ -3026,7 +3026,7 @@ quote_from_last: break; case DM_FORCEREDRAW: - RedrawWindow(m_hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW); + RedrawWindow(m_hwnd, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW); return 0; case DM_CHECKINFOTIP: diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 7aa63e741f..57245bb915 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -73,7 +73,7 @@ bool TSAPI IsCustomEvent(int eventType) void TSAPI RearrangeTab(HWND hwndDlg, const CTabBaseDlg *dat, int iMode, BOOL fSavePos) { - if (dat == NULL || !IsWindow(hwndDlg)) + if (dat == nullptr || !IsWindow(hwndDlg)) return; HWND hwndTab = GetParent(hwndDlg); @@ -111,9 +111,9 @@ static UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM, LPARAM lP case WM_NOTIFY: OPENFILENAMEA *ofn = (OPENFILENAMEA *)GetWindowLongPtr(hwnd, GWLP_USERDATA); HWND hwndParent = GetParent(hwnd); - HWND hwndLv = FindWindowEx(hwndParent, NULL, L"SHELLDLL_DefView", NULL); + HWND hwndLv = FindWindowEx(hwndParent, nullptr, L"SHELLDLL_DefView", nullptr); - if (hwndLv != NULL && *((DWORD *)(ofn->lCustData))) { + if (hwndLv != nullptr && *((DWORD *)(ofn->lCustData))) { SendMessage(hwndLv, WM_COMMAND, SHVIEW_THUMBNAIL, 0); *((DWORD *)(ofn->lCustData)) = 0; } @@ -130,7 +130,7 @@ static UINT_PTR CALLBACK OpenFileSubclass(HWND hwnd, UINT msg, WPARAM, LPARAM lP static void SaveAvatarToFile(CTabBaseDlg *dat, HBITMAP hbm, int isOwnPic) { wchar_t szFinalFilename[MAX_PATH]; - time_t t = time(NULL); + time_t t = time(nullptr); struct tm *lt = localtime(&t); DWORD setView = 1; @@ -257,7 +257,7 @@ int CTabBaseDlg::MsgWindowUpdateMenu(HMENU submenu, int menuID) EnableMenuItem(submenu, ID_TABMENU_CLEARSAVEDTABPOSITION, (M.GetDword(m_hContact, "tabindex", -1) != -1) ? MF_ENABLED : MF_GRAYED); } else if (menuID == MENU_PICMENU) { - wchar_t *szText = NULL; + wchar_t *szText = nullptr; char avOverride = (char)M.GetByte(m_hContact, "hideavatar", -1); HMENU visMenu = GetSubMenu(submenu, 0); BOOL picValid = bInfoPanel ? (m_hOwnPic != 0) : (m_ace && m_ace->hbmPic && m_ace->hbmPic != PluginConfig.g_hbmUnknown); @@ -325,7 +325,7 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId) db_unset(m_hContact, SRMSGMOD_T, "tabindex"); break; case ID_TABMENU_LEAVECHATROOM: - if (m_bType == SESSIONTYPE_CHAT && m_hContact != NULL) { + if (m_bType == SESSIONTYPE_CHAT && m_hContact != 0) { char *szProto = GetContactProto(m_hContact); if (szProto) CallProtoService(szProto, PS_LEAVECHAT, m_hContact, 0); @@ -386,7 +386,7 @@ int CTabBaseDlg::MsgWindowMenuHandler(int selection, int menuId) else if (menuId == MENU_LOGMENU) { switch (selection) { case ID_MESSAGELOGSETTINGS_GLOBAL: - Options_Open(NULL, L"Message sessions", L"Message log"); + Options_Open(nullptr, L"Message sessions", L"Message log"); return 1; case ID_MESSAGELOGSETTINGS_FORTHISCONTACT: @@ -435,7 +435,7 @@ void CTabBaseDlg::UpdateReadChars() const mir_snwprintf(buf, L"%s%s %d/%d", szBuf, m_lcID, m_iOpenJobs, len); SendMessage(m_pContainer->hwndStatus, SB_SETTEXT, 1, (LPARAM)buf); if (PluginConfig.m_visualMessageSizeIndicator) - InvalidateRect(m_pContainer->hwndStatus, NULL, FALSE); + InvalidateRect(m_pContainer->hwndStatus, nullptr, FALSE); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -466,7 +466,7 @@ void CTabBaseDlg::UpdateStatusBar() const else SendMessage(m_pContainer->hwndStatus, SB_SETICON, 0, 0); } UpdateReadChars(); - InvalidateRect(m_pContainer->hwndStatus, NULL, TRUE); + InvalidateRect(m_pContainer->hwndStatus, nullptr, TRUE); SendMessage(m_pContainer->hwndStatus, WM_USER + 101, 0, (LPARAM)this); } } @@ -535,7 +535,7 @@ bool CTabBaseDlg::GetAvatarVisibility() if (!bOwnAvatarMode) { m_bShowAvatar = (m_hOwnPic && m_hOwnPic != PluginConfig.g_hbmUnknown); if (!m_hwndContactPic) - m_hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)0, NULL, NULL); + m_hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)0, nullptr, nullptr); } switch (bAvatarMode) { @@ -546,13 +546,13 @@ bool CTabBaseDlg::GetAvatarVisibility() m_bShowInfoAvatar = true; case 1: HBITMAP hbm = ((m_ace && !(m_ace->dwFlags & AVS_HIDEONCLIST)) ? m_ace->hbmPic : 0); - if (hbm == NULL && !bAvatarMode) { + if (hbm == nullptr && !bAvatarMode) { m_bShowInfoAvatar = false; break; } if (!m_hwndPanelPic) { - m_hwndPanelPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, m_hwndPanelPicParent, (HMENU)7000, NULL, NULL); + m_hwndPanelPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, m_hwndPanelPicParent, (HMENU)7000, nullptr, nullptr); if (m_hwndPanelPic) SendMessage(m_hwndPanelPic, AVATAR_SETAEROCOMPATDRAWING, 0, TRUE); } @@ -578,7 +578,7 @@ bool CTabBaseDlg::GetAvatarVisibility() m_bShowAvatar = true; LBL_Check: if (!m_hwndContactPic) - m_hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)0, NULL, NULL); + m_hwndContactPic = CreateWindowEx(WS_EX_TOPMOST, AVATAR_CONTROL_CLASS, L"", WS_VISIBLE | WS_CHILD, 1, 1, 1, 1, GetDlgItem(m_hwnd, IDC_CONTACTPIC), (HMENU)0, nullptr, nullptr); break; case 2: // globally OFF m_bShowAvatar = false; @@ -689,12 +689,12 @@ void CTabBaseDlg::AdjustBottomAvatarDisplay() m_dynaSplitter = m_iSplitterY - DPISCALEY_S(34); DM_RecalcPictureSize(); Utils::showDlgControl(m_hwnd, IDC_CONTACTPIC, m_bShowAvatar ? SW_SHOW : SW_HIDE); - InvalidateRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), nullptr, TRUE); } else { Utils::showDlgControl(m_hwnd, IDC_CONTACTPIC, m_bShowAvatar ? SW_SHOW : SW_HIDE); m_pic.cy = m_pic.cx = DPISCALEY_S(60); - InvalidateRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), NULL, TRUE); + InvalidateRect(GetDlgItem(m_hwnd, IDC_CONTACTPIC), nullptr, TRUE); } } @@ -706,7 +706,7 @@ void CTabBaseDlg::ShowPicture(bool showNewPic) if (showNewPic) { if (m_pPanel.isActive() && m_pContainer->avatarMode != 3) { if (!m_hwndPanelPic) { - InvalidateRect(m_hwnd, NULL, TRUE); + InvalidateRect(m_hwnd, nullptr, TRUE); UpdateWindow(m_hwnd); SendMessage(m_hwnd, WM_SIZE, 0, 0); } @@ -769,7 +769,7 @@ static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, static DWORD dwRead; char **ppText = (char **)dwCookie; - if (*ppText == NULL) { + if (*ppText == nullptr) { *ppText = (char *)mir_alloc(cb + 2); memcpy(*ppText, pbBuff, cb); *pcb = cb; @@ -790,7 +790,7 @@ static DWORD CALLBACK Message_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, char* TSAPI Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags) { if (hwndRtf == 0) - return NULL; + return nullptr; DWORD dwFlags = (CP_UTF8 << 16) | SF_USECODEPAGE; if (dwPassedFlags == 0) @@ -798,7 +798,7 @@ char* TSAPI Message_GetFromStream(HWND hwndRtf, DWORD dwPassedFlags) else dwFlags |= dwPassedFlags; - char *pszText = NULL; + char *pszText = nullptr; EDITSTREAM stream = { 0 }; stream.pfnCallback = Message_StreamCallback; stream.dwCookie = (DWORD_PTR)&pszText; // pass pointer to pointer @@ -1011,8 +1011,8 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText, int iNumColors, COLORREF *pCol void CTabBaseDlg::GetMYUIN() { - ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, NULL, m_cache->getActiveProto())); - if (uid != NULL) + ptrW uid(Contact_GetInfo(CNF_DISPLAYUID, 0, m_cache->getActiveProto())); + if (uid != nullptr) wcsncpy_s(m_myUin, uid, _TRUNCATE); else m_myUin[0] = 0; @@ -1108,14 +1108,14 @@ void CTabBaseDlg::FindFirstEvent() if (m_bActualHistory) i = m_cache->getSessionMsgCount(); else - i = db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); + i = db_get_w(0, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT); for (; i > 0; i--) { - 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; m_hDbEventFirst = hPrevEvent; @@ -1128,18 +1128,18 @@ void CTabBaseDlg::FindFirstEvent() case LOADHISTORY_TIME: DBEVENTINFO dbei = {}; - if (m_hDbEventFirst == NULL) - dbei.timestamp = time(NULL); + if (m_hDbEventFirst == 0) + dbei.timestamp = time(nullptr); else db_event_get(m_hDbEventFirst, &dbei); - DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); + DWORD firstTime = dbei.timestamp - 60 * db_get_w(0, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); for (;;) { - 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; db_event_get(hPrevEvent, &dbei); @@ -1227,7 +1227,7 @@ void CTabBaseDlg::GetSendFormat() void CTabBaseDlg::GetLocaleID(const wchar_t *szKLName) { - wchar_t szLI[256], *stopped = NULL; + wchar_t szLI[256], *stopped = nullptr; WORD wCtype2[3]; BOOL fLocaleNotSet; BYTE szTest[4] = { 0xe4, 0xf6, 0xfc, 0 }; @@ -1297,7 +1297,7 @@ void CTabBaseDlg::LoadContactAvatar() BITMAP bm; if (m_ace && m_ace->hbmPic) GetObject(m_ace->hbmPic, sizeof(bm), &bm); - else if (m_ace == NULL) + else if (m_ace == nullptr) GetObject(PluginConfig.g_hbmUnknown, sizeof(bm), &bm); else return; @@ -1407,7 +1407,7 @@ int CTabBaseDlg::MsgWindowDrawHandler(WPARAM, LPARAM lParam) HBITMAP hbmAvatar = m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown; if ((dis->hwndItem == GetDlgItem(m_hwnd, IDC_CONTACTPIC) && m_bShowAvatar) || (dis->hwndItem == m_hwnd && m_pPanel.isActive())) { - if (hbmAvatar == NULL) + if (hbmAvatar == nullptr) return TRUE; int top, cx, cy; @@ -1573,7 +1573,7 @@ void TSAPI LoadThemeDefaults(TContainerData *pContainer) } pContainer->theme.logFonts = logfonts; pContainer->theme.fontColors = fontcolors; - pContainer->theme.rtfFonts = NULL; + pContainer->theme.rtfFonts = nullptr; pContainer->ltr_templates = <R_Active; pContainer->rtl_templates = &RTL_Active; pContainer->theme.dwFlags = (M.GetDword("mwflags", MWF_LOG_DEFAULT) & MWF_LOG_ALL); @@ -1589,11 +1589,11 @@ void TSAPI LoadOverrideTheme(TContainerData *pContainer) LoadThemeDefaults(pContainer); return; } - if (pContainer->ltr_templates == NULL) { + if (pContainer->ltr_templates == nullptr) { pContainer->ltr_templates = (TTemplateSet *)mir_alloc(sizeof(TTemplateSet)); memcpy(pContainer->ltr_templates, <R_Active, sizeof(TTemplateSet)); } - if (pContainer->rtl_templates == NULL) { + if (pContainer->rtl_templates == nullptr) { pContainer->rtl_templates = (TTemplateSet *)mir_alloc(sizeof(TTemplateSet)); memcpy(pContainer->rtl_templates, &RTL_Active, sizeof(TTemplateSet)); } @@ -1620,10 +1620,10 @@ HICON CTabBaseDlg::GetXStatusIcon() const { BYTE xStatus = m_cache->getXStatusId(); if (xStatus == 0) - return NULL; + return nullptr; if (!ProtoServiceExists(m_cache->getActiveProto(), PS_GETCUSTOMSTATUSICON)) - return NULL; + return nullptr; return (HICON)(CallProtoService(m_cache->getActiveProto(), PS_GETCUSTOMSTATUSICON, xStatus, 0)); } @@ -1672,8 +1672,8 @@ void CTabBaseDlg::GetClientIcon() void CTabBaseDlg::GetMyNick() { - ptrW tszNick(Contact_GetInfo(CNF_NICK, NULL, m_cache->getActiveProto())); - if (tszNick != NULL) { + ptrW tszNick(Contact_GetInfo(CNF_NICK, 0, m_cache->getActiveProto())); + if (tszNick != nullptr) { if (mir_wstrlen(tszNick) == 0 || !mir_wstrcmp(tszNick, TranslateT("'(Unknown contact)'"))) wcsncpy_s(m_wszMyNickname, (m_myUin[0] ? m_myUin : TranslateT("'(Unknown contact)'")), _TRUNCATE); else @@ -1684,7 +1684,7 @@ void CTabBaseDlg::GetMyNick() HICON CTabBaseDlg::GetMyContactIcon(LPCSTR szSetting) { - int bUseMeta = (szSetting == NULL) ? false : M.GetByte(szSetting, mir_strcmp(szSetting, "MetaiconTab") == 0); + int bUseMeta = (szSetting == nullptr) ? false : M.GetByte(szSetting, mir_strcmp(szSetting, "MetaiconTab") == 0); if (bUseMeta) return Skin_LoadProtoIcon(m_cache->getProto(), m_cache->getStatus()); return Skin_LoadProtoIcon(m_cache->getActiveProto(), m_cache->getActiveStatus()); @@ -1782,7 +1782,7 @@ void CTabBaseDlg::SendHBitmapAsFile(HBITMAP hbmp) const filename[0] = 0; // prompt for a new name else { mir_wstrcpy(filename + tempdirlen, mirandatempdir); - if ((GetFileAttributes(filename) == INVALID_FILE_ATTRIBUTES || ((GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY) == 0)) && CreateDirectory(filename, NULL) == 0) + if ((GetFileAttributes(filename) == INVALID_FILE_ATTRIBUTES || ((GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY) == 0)) && CreateDirectory(filename, nullptr) == 0) filename[0] = 0; else { tempdirlen = mir_wstrlen(filename); @@ -1832,7 +1832,7 @@ void CTabBaseDlg::SendHBitmapAsFile(HBITMAP hbmp) const CallService(MS_IMG_SAVE, (WPARAM)&ii, IMGL_WCHAR); int totalCount = 0; - wchar_t **ppFiles = NULL; + wchar_t **ppFiles = nullptr; Utils::AddToFileList(&ppFiles, &totalCount, filename); wchar_t* _t = mir_wstrdup(filename); diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 979fab9ca3..e0c563f554 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -45,7 +45,7 @@ struct TCpTable cpTable[] = { { 1257, LPGENW("Baltic") }, { 1258, LPGENW("Vietnamese") }, { 1361, LPGENW("Korean (Johab)") }, - { (UINT)-1, NULL } + { (UINT)-1, nullptr } }; wchar_t* weekDays[7] = { LPGENW("Sunday"), LPGENW("Monday"), LPGENW("Tuesday"), LPGENW("Wednesday"), LPGENW("Thursday"), LPGENW("Friday"), LPGENW("Saturday") }; @@ -59,8 +59,8 @@ wchar_t* months[12] = static time_t today; int g_groupBreak = TRUE; -static wchar_t *szMyName = NULL; -static wchar_t *szYourName = NULL; +static wchar_t *szMyName = nullptr; +static wchar_t *szYourName = nullptr; static int logPixelSY; static wchar_t szToday[22], szYesterday[22]; @@ -121,9 +121,9 @@ static void TrimMessage(wchar_t *msg) void TSAPI CacheLogFonts() { - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); memset(logfonts, 0, (sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2))); for (int i = 0; i < MSGDLGFONTCOUNT; i++) { @@ -227,7 +227,7 @@ TLogIcon::TLogIcon(HICON hIcon, COLORREF backgroundColor) HBITMAP hoBmp = (HBITMAP)SelectObject(m_hdcMem, m_hBmp); FillRect(m_hdcMem, &rc, m_hBkgBrush); - DrawIconEx(m_hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL); + DrawIconEx(m_hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, nullptr, DI_NORMAL); SelectObject(m_hdcMem, hoBmp); } @@ -235,7 +235,7 @@ TLogIcon::~TLogIcon() { DeleteDC(m_hdcMem); DeleteObject(m_hBmp); - ReleaseDC(NULL, m_hdc); + ReleaseDC(nullptr, m_hdc); DeleteObject(m_hBkgBrush); } @@ -245,7 +245,7 @@ static int TSAPI GetColorIndex(char *rtffont) { char *p; - if ((p = strstr(rtffont, "\\cf")) != NULL) + if ((p = strstr(rtffont, "\\cf")) != nullptr) return atoi(p + 3); return 0; } @@ -340,7 +340,7 @@ static void Build_RTF_Header(CMStringA &str, CTabBaseDlg *dat) for (i = 0; i < MSGDLGFONTCOUNT; i++) str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(fontColors[i]), GetGValue(fontColors[i]), GetBValue(fontColors[i])); - COLORREF colour = (GetSysColorBrush(COLOR_HOTLIGHT) == NULL) ? RGB(0, 0, 255) : GetSysColor(COLOR_HOTLIGHT); + COLORREF colour = (GetSysColorBrush(COLOR_HOTLIGHT) == nullptr) ? RGB(0, 0, 255) : GetSysColor(COLOR_HOTLIGHT); str.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(colour), GetGValue(colour), GetBValue(colour)); // OnO: Create incoming and outcoming colours @@ -445,7 +445,7 @@ int DbEventIsForMsgWindow(DBEVENTINFO *dbei) static char* Template_CreateRTFFromDbEvent(CTabBaseDlg *dat, MCONTACT hContact, MEVENT hDbEvent, LogStreamData *streamData) { - HANDLE hTimeZone = NULL; + HANDLE hTimeZone = nullptr; BOOL skipToNext = FALSE, skipFont = FALSE; struct tm event_time = { 0 }; BOOL isBold = FALSE, isItalic = FALSE, isUnderline = FALSE; @@ -457,24 +457,24 @@ static char* Template_CreateRTFFromDbEvent(CTabBaseDlg *dat, MCONTACT hContact, else { dbei.cbBlob = db_event_getBlobSize(hDbEvent); if (dbei.cbBlob == -1) - return NULL; + return nullptr; dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); db_event_get(hDbEvent, &dbei); if (!DbEventIsShown(&dbei)) { mir_free(dbei.pBlob); - return NULL; + return nullptr; } } if (dbei.eventType == EVENTTYPE_MESSAGE && !dbei.markedRead()) dat->m_cache->updateStats(TSessionStats::SET_LAST_RCV, mir_strlen((char *)dbei.pBlob)); - wchar_t *formatted = NULL; + wchar_t *formatted = nullptr; wchar_t *msg = DbEvent_GetTextW(&dbei, CP_UTF8); if (!msg) { mir_free(dbei.pBlob); - return NULL; + return nullptr; } TrimMessage(msg); formatted = const_cast(Utils::FormatRaw(dat, msg, dwFormattingParams, FALSE)); @@ -545,7 +545,7 @@ static char* Template_CreateRTFFromDbEvent(CTabBaseDlg *dat, MCONTACT hContact, // templated code starts here if (dwEffectiveFlags & MWF_LOG_SHOWTIME) { - hTimeZone = ((dat->m_dwFlags & MWF_LOG_LOCALTIME) && !isSent) ? dat->m_hTimeZone : NULL; + hTimeZone = ((dat->m_dwFlags & MWF_LOG_LOCALTIME) && !isSent) ? dat->m_hTimeZone : nullptr; time_t local_time = TimeZone_UtcToLocal(hTimeZone, dbei.timestamp); event_time = *gmtime(&local_time); } @@ -1027,7 +1027,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG { LogStreamData *dat = (LogStreamData*)dwCookie; - if (dat->buffer == NULL) { + if (dat->buffer == nullptr) { dat->bufferOffset = 0; switch (dat->stage) { case STREAMSTAGE_HEADER: @@ -1046,7 +1046,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG dat->hDbEvent = db_event_next(dat->hContact, dat->hDbEvent); if (--dat->eventsToInsert == 0) break; - } while (dat->buffer == NULL && dat->hDbEvent); + } while (dat->buffer == nullptr && dat->hDbEvent); if (dat->buffer) break; @@ -1070,7 +1070,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG memcpy(pbBuff, dat->buffer + dat->bufferOffset, *pcb); dat->bufferOffset += *pcb; if (dat->bufferOffset == dat->bufferLen) - replaceStr(dat->buffer, NULL); + replaceStr(dat->buffer, nullptr); return 0; } @@ -1181,7 +1181,7 @@ static void ReplaceIcons(HWND hwndDlg, CTabBaseDlg *dat, LONG startAt, int fAppe if (startAt > 0) smadd.rangeToReplace = &sel; else - smadd.rangeToReplace = NULL; + smadd.rangeToReplace = nullptr; smadd.disableRedraw = TRUE; CallService(MS_SMILEYADD_REPLACESMILEYS, TABSRMM_SMILEYADD_BKGCOLORMODE, (LPARAM)&smadd); } @@ -1212,19 +1212,19 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D HWND hwndrtf = m_hwndIEView ? m_hwndIWebBrowserControl : m_log.GetHwnd(); rtfFonts = m_pContainer->theme.rtfFonts ? m_pContainer->theme.rtfFonts : &(rtfFontsGlobal[0][0]); - time_t now = time(NULL); + time_t now = time(nullptr); struct tm tm_now = *localtime(&now); struct tm tm_today = tm_now; tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0; today = mktime(&tm_today); - if (m_hwndIEView != NULL || m_hwndHPP != NULL) { + if (m_hwndIEView != nullptr || m_hwndHPP != nullptr) { const char *pszService; IEVIEWEVENT event = { 0 }; event.cbSize = sizeof(IEVIEWEVENT); event.hContact = m_hContact; - if (m_hwndIEView != NULL) { + if (m_hwndIEView != nullptr) { event.pszProto = m_szProto; event.hwnd = m_hwndIEView; pszService = MS_IEVIEW_EVENT; @@ -1243,7 +1243,7 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D } IEVIEWEVENTDATA evData = { 0 }; - if (dbei_s != NULL && hDbEventFirst == 0) { + if (dbei_s != nullptr && hDbEventFirst == 0) { evData.cbSize = sizeof(evData); event.iType = IEE_LOG_MEM_EVENTS; if (dbei_s->flags & DBEF_SENT) @@ -1357,7 +1357,7 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D ReplaceIcons(m_hwnd, this, startAt, fAppend, isSent); m_clr_added = FALSE; - if (m_hwndIEView == NULL && m_hwndHPP == NULL) { + if (m_hwndIEView == nullptr && m_hwndHPP == nullptr) { int len = GetWindowTextLength(hwndrtf); SendMessage(hwndrtf, EM_SETSEL, len - 1, len - 1); } @@ -1365,7 +1365,7 @@ void CTabBaseDlg::StreamInEvents(MEVENT hDbEventFirst, int count, int fAppend, D DM_ScrollToBottom(0, 0); SendMessage(hwndrtf, WM_SETREDRAW, TRUE, 0); - InvalidateRect(hwndrtf, NULL, FALSE); + InvalidateRect(hwndrtf, nullptr, FALSE); EnableWindow(GetDlgItem(m_hwnd, IDC_QUOTE), m_hDbEventLast != 0); mir_free(streamData.buffer); } diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index e6063362da..18f478eff2 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -292,7 +292,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_THEMEEXPORT: { const wchar_t *szFilename = GetThemeFileName(1); - if (szFilename != NULL) + if (szFilename != nullptr) WriteThemeToINI(szFilename, 0); } break; @@ -311,7 +311,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L const wchar_t* szFilename = GetThemeFileName(0); DWORD dwFlags = THEME_READ_FONTS; - if (szFilename != NULL) { + if (szFilename != nullptr) { int result = MessageBox(0, TranslateT("Do you want to also read message templates from the theme?\nCaution: This will overwrite the stored template set which may affect the look of your message window significantly.\nSelect Cancel to not load anything at all."), TranslateT("Load theme"), MB_YESNOCANCEL); if (result == IDCANCEL) @@ -394,7 +394,7 @@ void TreeViewInit(HWND hwndTree, UINT id, DWORD dwFlags, BOOL bFromMem) ImageList_Destroy(TreeView_SetImageList(hwndTree, CreateStateImageList(), TVSIL_NORMAL)); // fill the list box, create groups first, then add items - for (int i = 0; lvGroups[i].szName != NULL; i++) { + for (int i = 0; lvGroups[i].szName != nullptr; i++) { tvi.hParent = 0; tvi.hInsertAfter = TVI_LAST; tvi.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE; @@ -405,7 +405,7 @@ void TreeViewInit(HWND hwndTree, UINT id, DWORD dwFlags, BOOL bFromMem) lvGroups[i].handle = (LRESULT)TreeView_InsertItem(hwndTree, &tvi); } - for (int i = 0; lvItems[i].szName != NULL; i++) { + for (int i = 0; lvItems[i].szName != nullptr; i++) { tvi.hParent = (HTREEITEM)lvGroups[lvItems[i].uGroup].handle; tvi.hInsertAfter = TVI_LAST; tvi.item.pszText = TranslateW(lvItems[i].szName); @@ -446,7 +446,7 @@ void TreeViewSetFromDB(HWND hwndTree, UINT id, DWORD dwFlags) TVITEM item = { 0 }; TOptionListItem *lvItems = CTranslator::getTree(id); - for (int i = 0; lvItems[i].szName != NULL; i++) { + for (int i = 0; lvItems[i].szName != nullptr; i++) { item.mask = TVIF_HANDLE | TVIF_IMAGE; item.hItem = (HTREEITEM)lvItems[i].handle; if (lvItems[i].uType == LOI_TYPE_FLAG) @@ -462,22 +462,22 @@ void TreeViewToDB(HWND hwndTree, UINT id, char *DBPath, DWORD *dwFlags) TVITEM item = { 0 }; TOptionListItem *lvItems = CTranslator::getTree(id); - for (int i = 0; lvItems[i].szName != NULL; i++) { + for (int i = 0; lvItems[i].szName != nullptr; i++) { item.mask = TVIF_HANDLE | TVIF_IMAGE; item.hItem = (HTREEITEM)lvItems[i].handle; TreeView_GetItem(hwndTree, &item); switch (lvItems[i].uType) { case LOI_TYPE_FLAG: - if (dwFlags != NULL) + if (dwFlags != nullptr) (*dwFlags) |= (item.iImage == IMG_CHECK) ? lvItems[i].lParam : 0; - if (DBPath == NULL) { + if (DBPath == nullptr) { UINT *tm = (UINT*)lvItems[i].lParam; (*tm) = (item.iImage == IMG_CHECK) ? ((*tm) | lvItems[i].id) : ((*tm) & ~lvItems[i].id); } break; case LOI_TYPE_SETTING: - if (DBPath != NULL) { + if (DBPath != nullptr) { db_set_b(0, DBPath, (char *)lvItems[i].lParam, (BYTE)((item.iImage == IMG_CHECK) ? 1 : 0)); } else { @@ -554,8 +554,8 @@ BOOL TreeViewHandleClick(HWND hwndDlg, HWND hwndTree, WPARAM, LPARAM lParam) item.iSelectedImage = item.iImage; SendMessage(hwndTree, TVM_SETITEM, 0, (LPARAM)&item); if (item.mask & TVIF_STATE) { - RedrawWindow(hwndTree, NULL, NULL, RDW_INVALIDATE | RDW_NOFRAME | RDW_ERASENOW | RDW_ALLCHILDREN); - InvalidateRect(hwndTree, NULL, TRUE); + RedrawWindow(hwndTree, nullptr, nullptr, RDW_INVALIDATE | RDW_NOFRAME | RDW_ERASENOW | RDW_ALLCHILDREN); + InvalidateRect(hwndTree, nullptr, TRUE); } else { SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); @@ -619,7 +619,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_b(0, SRMSGMOD_T, "dontscaleavatars", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_PRESERVEAVATARSIZE) ? 1 : 0)); // scan the tree view and obtain the options... - TreeViewToDB(GetDlgItem(hwndDlg, IDC_WINDOWOPTIONS), CTranslator::TREE_MSG, SRMSGMOD_T, NULL); + TreeViewToDB(GetDlgItem(hwndDlg, IDC_WINDOWOPTIONS), CTranslator::TREE_MSG, SRMSGMOD_T, nullptr); PluginConfig.reloadSettings(); M.BroadcastMessage(DM_OPTIONSAPPLIED, 1, 0); return TRUE; @@ -669,9 +669,9 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, TreeViewInit(GetDlgItem(hwndDlg, IDC_LOGOPTIONS), CTranslator::TREE_LOG, dwFlags, FALSE); SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); + SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(0, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(24 * 60, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); + SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(0, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); SetDlgItemInt(hwndDlg, IDC_INDENTAMOUNT, M.GetDword("IndentAmount", 20), FALSE); SendDlgItemMessage(hwndDlg, IDC_INDENTSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 0)); @@ -796,8 +796,8 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME); else db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD); - db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0)); - db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, SRMSGMOD, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0)); db_set_dw(0, SRMSGMOD_T, "IndentAmount", (DWORD)GetDlgItemInt(hwndDlg, IDC_INDENTAMOUNT, &translated, FALSE)); db_set_dw(0, SRMSGMOD_T, "RightIndent", (DWORD)GetDlgItemInt(hwndDlg, IDC_RIGHTINDENT, &translated, FALSE)); @@ -999,7 +999,7 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar CheckDlgButton(hwndDlg, IDC_CUT_TABTITLE, M.GetByte("cuttitle", 0) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_SETRANGE, 0, MAKELONG(20, 5)); - SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_SETPOS, 0, (WPARAM)db_get_w(NULL, SRMSGMOD_T, "cut_at", 15)); + SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_SETPOS, 0, (WPARAM)db_get_w(0, SRMSGMOD_T, "cut_at", 15)); Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAX, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE) != 0); Utils::enableDlgControl(hwndDlg, IDC_CUT_TITLEMAXSPIN, IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE) != 0); @@ -1047,10 +1047,10 @@ static INT_PTR CALLBACK DlgProcTabbedOptions(HWND hwndDlg, UINT msg, WPARAM wPar switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: db_set_b(0, SRMSGMOD_T, "cuttitle", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CUT_TABTITLE)); - db_set_w(NULL, SRMSGMOD_T, "cut_at", (WORD)SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, SRMSGMOD_T, "cut_at", (WORD)SendDlgItemMessage(hwndDlg, IDC_CUT_TITLEMAXSPIN, UDM_GETPOS, 0, 0)); // scan the tree view and obtain the options... - TreeViewToDB(GetDlgItem(hwndDlg, IDC_TABMSGOPTIONS), CTranslator::TREE_TAB, SRMSGMOD_T, NULL); + TreeViewToDB(GetDlgItem(hwndDlg, IDC_TABMSGOPTIONS), CTranslator::TREE_TAB, SRMSGMOD_T, nullptr); PluginConfig.m_EscapeCloses = (int)SendDlgItemMessage(hwndDlg, IDC_ESCMODE, CB_GETCURSEL, 0, 0); db_set_b(0, SRMSGMOD_T, "escmode", (BYTE)PluginConfig.m_EscapeCloses); @@ -1183,9 +1183,9 @@ INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l default: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - TreeViewToDB(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), CTranslator::TREE_MODPLUS, SRMSGMOD_T, NULL); + TreeViewToDB(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), CTranslator::TREE_MODPLUS, SRMSGMOD_T, nullptr); - int msgTimeout = 1000 * GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, FALSE); + int msgTimeout = 1000 * GetDlgItemInt(hwndDlg, IDC_SECONDS, nullptr, FALSE); PluginConfig.m_MsgTimeout = msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout : SRMSGSET_MSGTIMEOUT_MIN; db_set_dw(0, SRMSGMOD, SRMSGSET_MSGTIMEOUT, PluginConfig.m_MsgTimeout); @@ -1204,7 +1204,7 @@ INT_PTR CALLBACK PlusOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else if (LOWORD(wParam) == IDC_PLUS_REVERT) { // revert to defaults... TOptionListItem *lvItems = CTranslator::getTree(CTranslator::TREE_MODPLUS); - for (int i = 0; lvItems[i].szName != NULL; i++) + for (int i = 0; lvItems[i].szName != nullptr; i++) if (lvItems[i].uType == LOI_TYPE_SETTING) db_set_b(0, SRMSGMOD_T, (char *)lvItems[i].lParam, (BYTE)lvItems[i].id); TreeViewSetFromDB(GetDlgItem(hwndDlg, IDC_PLUS_CHECKTREE), CTranslator::TREE_MODPLUS, 0); @@ -1380,7 +1380,7 @@ DWORD OptCheckBox_LoadValue(struct OptCheckBox *cb) case DBVT_BYTE: return M.GetByte(cb->dbModule, cb->dbSetting, cb->defValue); case DBVT_WORD: - return db_get_w(NULL, cb->dbModule, cb->dbSetting, cb->defValue); + return db_get_w(0, cb->dbModule, cb->dbSetting, cb->defValue); case DBVT_DWORD: return M.GetDword(cb->dbModule, cb->dbSetting, cb->defValue); } @@ -1422,7 +1422,7 @@ void OptCheckBox_Save(HWND hwnd, OptCheckBox *cb) db_set_b(0, cb->dbModule, cb->dbSetting, (BYTE)value); break; case DBVT_WORD: - db_set_w(NULL, cb->dbModule, cb->dbSetting, (WORD)value); + db_set_w(0, cb->dbModule, cb->dbSetting, (WORD)value); break; case DBVT_DWORD: db_set_dw(0, cb->dbModule, cb->dbSetting, (DWORD)value); @@ -1502,9 +1502,9 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR } SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); + SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, db_get_w(0, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(24 * 60, 0)); - SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); + SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, db_get_w(0, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_SETRANGE, 0, MAKELONG(1000, 5)); SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_SETPOS, 0, maxhist); @@ -1571,8 +1571,8 @@ static INT_PTR CALLBACK DlgProcTabSrmmModernOptions(HWND hwndDlg, UINT msg, WPAR db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME); else db_set_b(0, SRMSGMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD); - db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0)); - db_set_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, SRMSGMOD, SRMSGSET_LOADCOUNT, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0)); + db_set_w(0, SRMSGMOD, SRMSGSET_LOADTIME, (WORD)SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0)); if (IsDlgButtonChecked(hwndDlg, IDC_ALWAYSTRIM)) db_set_dw(0, SRMSGMOD_T, "maxhist", (DWORD)SendDlgItemMessage(hwndDlg, IDC_TRIMSPIN, UDM_GETPOS, 0, 0)); @@ -1619,7 +1619,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.lpzHelpUrl = "http://wiki.miranda-ng.org/index.php?title=Plugin:TabSRMM"; diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 31bc0d300f..0e95268fc6 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -55,7 +55,7 @@ int IEViewOptionsChanged(WPARAM, LPARAM) int SmileyAddOptionsChanged(WPARAM, LPARAM) { M.BroadcastMessage(DM_SMILEYOPTIONSCHANGED, 0, 0); - pci->SM_BroadcastMessage(NULL, DM_SMILEYOPTIONSCHANGED, 0, 0, FALSE); + pci->SM_BroadcastMessage(nullptr, DM_SMILEYOPTIONSCHANGED, 0, 0, FALSE); return 0; } @@ -78,11 +78,11 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) { MessageWindowInputData *mwid = (MessageWindowInputData*)wParam; - if (mwid == NULL || (mwid->cbSize != sizeof(MessageWindowInputData)) || (mwid->hContact == NULL) || (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)) + if (mwid == nullptr || (mwid->cbSize != sizeof(MessageWindowInputData)) || (mwid->hContact == 0) || (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)) return 1; MessageWindowData *mwd = (MessageWindowData*)lParam; - if (mwd == NULL || (mwd->cbSize != sizeof(MessageWindowData))) + if (mwd == nullptr || (mwd->cbSize != sizeof(MessageWindowData))) return 1; HWND hwnd = M.FindWindow(mwid->hContact); @@ -97,7 +97,7 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) else { SESSION_INFO *si = SM_FindSessionByHCONTACT(mwid->hContact); - if (si != NULL && si->hWnd != 0) { + if (si != nullptr && si->hWnd != 0) { mwd->uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; mwd->hwndWindow = si->hWnd; mwd->local = GetParent(GetParent(si->hWnd)); @@ -203,8 +203,8 @@ INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) break; TContainerData *pNewContainer = FindContainerByName(szNewName); - if (pNewContainer == NULL) - if ((pNewContainer = CreateContainer(szNewName, FALSE, m_hContact)) == NULL) + if (pNewContainer == nullptr) + if ((pNewContainer = CreateContainer(szNewName, FALSE, m_hContact)) == nullptr) break; db_set_ws(m_hContact, SRMSGMOD_T, "containerW", szNewName); @@ -288,7 +288,7 @@ static void SetStatusTextWorker(CTabBaseDlg *dat, StatusTextData *st) dat->m_sbCustom = nullptr; } - if (st != NULL && st->cbSize == sizeof(StatusTextData)) + if (st != nullptr && st->cbSize == sizeof(StatusTextData)) dat->m_sbCustom = new StatusTextData(*st); dat->UpdateStatusBar(); @@ -297,9 +297,9 @@ static void SetStatusTextWorker(CTabBaseDlg *dat, StatusTextData *st) static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam) { SESSION_INFO *si = SM_FindSessionByHCONTACT(hContact); - if (si == NULL) { + if (si == nullptr) { HWND hwnd = M.FindWindow(hContact); - if (hwnd != NULL) + if (hwnd != nullptr) SetStatusTextWorker((CTabBaseDlg*)GetWindowLongPtr(hwnd, GWLP_USERDATA), (StatusTextData*)lParam); if (hContact = db_mc_getMeta(hContact)) @@ -396,14 +396,14 @@ static INT_PTR ReloadSettings(WPARAM, LPARAM lParam) INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam) { HWND hwnd = 0; - TContainerData *pContainer = NULL; + TContainerData *pContainer = nullptr; if (wParam) hwnd = M.FindWindow(wParam); else if (lParam) hwnd = (HWND)lParam; else - return NULL; + return 0; if (!hwnd) return 0; @@ -444,7 +444,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) wchar_t szName[CONTAINER_NAMELEN + 1]; GetContainerNameForContact(hContact, szName, CONTAINER_NAMELEN); TContainerData *pContainer = FindContainerByName(szName); - if (pContainer == NULL) + if (pContainer == nullptr) pContainer = CreateContainer(szName, FALSE, hContact); if (pContainer) CreateNewTabForContact(pContainer, hContact, true, true, false, 0); @@ -472,7 +472,7 @@ INT_PTR SendMessageCommand_Worker(MCONTACT hContact, LPCSTR pszMsg, bool isWchar // does the MCONTACT's protocol support IM messages? char *szProto = GetContactProto(hContact); - if (szProto == NULL) + if (szProto == nullptr) return 0; // unknown contact if (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) return 0; @@ -494,7 +494,7 @@ INT_PTR SendMessageCommand_Worker(MCONTACT hContact, LPCSTR pszMsg, bool isWchar GetContainerNameForContact(hContact, szName, CONTAINER_NAMELEN); TContainerData *pContainer = FindContainerByName(szName); - if (pContainer == NULL) + if (pContainer == nullptr) pContainer = CreateContainer(szName, FALSE, hContact); if (pContainer) CreateNewTabForContact(pContainer, hContact, true, true, false, 0, isWchar, pszMsg); @@ -535,7 +535,7 @@ int SplitmsgShutdown(void) if (g_hIconDLL) { FreeLibrary(g_hIconDLL); - g_hIconDLL = NULL; + g_hIconDLL = nullptr; } ImageList_RemoveAll(PluginConfig.g_hImageList); @@ -632,8 +632,8 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, // if we have a max # of tabs/container set and want to open something in the default container... if (hContact != 0 && M.GetByte("limittabs", 0) && !wcsncmp(pContainer->szName, L"default", 6)) - if ((pContainer = FindMatchingContainer(L"default")) == NULL) - if ((pContainer = CreateContainer(L"default", CNT_CREATEFLAG_CLONED, hContact)) == NULL) + if ((pContainer = FindMatchingContainer(L"default")) == nullptr) + if ((pContainer = CreateContainer(L"default", CNT_CREATEFLAG_CLONED, hContact)) == nullptr) return 0; char *szProto = GetContactProto(hContact); @@ -653,7 +653,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, } else wcsncpy_s(newcontactname, L"_U_", _TRUNCATE); - wchar_t *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); + wchar_t *szStatus = pcli->pfnGetStatusModeDescription(szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); if (M.GetByte("tabstatus", 1)) mir_snwprintf(tabtitle, L"%s (%s) ", newcontactname, szStatus); @@ -736,15 +736,15 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, if (bActivateTab) { ActivateExistingTab(pContainer, hwndNew); SetFocus(hwndNew); - RedrawWindow(pContainer->hwnd, NULL, NULL, RDW_ERASENOW); + RedrawWindow(pContainer->hwnd, nullptr, nullptr, RDW_ERASENOW); UpdateWindow(pContainer->hwnd); if (GetForegroundWindow() != pContainer->hwnd && bPopupContainer == TRUE) SetForegroundWindow(pContainer->hwnd); } else if (!IsIconic(pContainer->hwnd) && IsWindowVisible(pContainer->hwnd)) { SendMessage(pContainer->hwndActive, WM_SIZE, 0, 0); - RedrawWindow(pContainer->hwndActive, NULL, NULL, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_UPDATENOW); - RedrawWindow(pContainer->hwndActive, NULL, NULL, RDW_ERASENOW | RDW_UPDATENOW); + RedrawWindow(pContainer->hwndActive, nullptr, nullptr, RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_UPDATENOW); + RedrawWindow(pContainer->hwndActive, nullptr, nullptr, RDW_ERASENOW | RDW_UPDATENOW); } if (PluginConfig.m_bHideOnClose&&!IsWindowVisible(pContainer->hwnd)) { @@ -788,7 +788,7 @@ TContainerData* TSAPI FindMatchingContainer(const wchar_t *szName) if (!wcsncmp(p->szName, L"default", 6) && p->iChilds < iMaxTabs) return p; - return NULL; + return nullptr; } return FindContainerByName(szName); } @@ -803,7 +803,7 @@ void TSAPI CreateImageList(BOOL bInitial) // an icon on each tab. This is a blank and empty icon if (bInitial) { PluginConfig.g_hImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 2, 0); - HICON hIcon = CreateIcon(g_hInst, 16, 16, 1, 4, NULL, NULL); + HICON hIcon = CreateIcon(g_hInst, 16, 16, 1, 4, nullptr, nullptr); ImageList_AddIcon(PluginConfig.g_hImageList, hIcon); DestroyIcon(hIcon); } @@ -822,11 +822,11 @@ void TSAPI CreateImageList(BOOL bInitial) int TABSRMM_FireEvent(MCONTACT hContact, HWND hwnd, unsigned int type, unsigned int subType) { - if (hContact == NULL || hwnd == NULL) + if (hContact == 0 || hwnd == nullptr) return 0; CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (dat == NULL) + if (dat == nullptr) return 0; BYTE bType = dat->m_bType; @@ -1173,14 +1173,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; } @@ -1190,7 +1190,7 @@ STDMETHODIMP_(ULONG) CREOleCallback::Release() if (--refCount == 0) { if (pictStg) { pictStg->Release(); - pictStg = NULL; + pictStg = nullptr; } } return refCount; @@ -1230,7 +1230,7 @@ STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg) { wchar_t sztName[64]; mir_snwprintf(sztName, L"s%u", nextStgId++); - if (pictStg == NULL) + if (pictStg == nullptr) return STG_E_MEDIUMFULL; return pictStg->CreateStorage(sztName, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, lplpstg); } diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5cc3372cc7..9ba81facec 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -729,7 +729,7 @@ struct TIconDescW 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/plugins/TabSRMM/src/muchighlight.cpp b/plugins/TabSRMM/src/muchighlight.cpp index 167fb5a9e5..ec41786ff3 100644 --- a/plugins/TabSRMM/src/muchighlight.cpp +++ b/plugins/TabSRMM/src/muchighlight.cpp @@ -120,7 +120,7 @@ bool CMUCHighlight::match(const GCEVENT *pgce, const SESSION_INFO *psi, DWORD dw if ((m_dwFlags & MATCH_TEXT) && (dwFlags & MATCH_TEXT) && (m_fHighlightMe || m_iTextPatterns > 0) && psi != 0) { wchar_t *p = pci->RemoveFormatting(pgce->ptszText); p = NEWWSTR_ALLOCA(p); - if (p == NULL) + if (p == nullptr) return false; CharLower(p); diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index a6a08e79e5..be4401888a 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -179,7 +179,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L TContainerData *pContainer = 0; do { mir_snprintf(szValue, "%d", iCounter); - if (db_get_ws(NULL, szKey, szValue, &dbv)) + if (db_get_ws(0, szKey, szValue, &dbv)) break; // end of list if (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_WCHAR) { if (wcsncmp(dbv.ptszVal, L"**mir_free**", CONTAINER_NAMELEN)) { diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 8887fd1123..16c3c78c6c 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -441,7 +441,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT; dbei.szModule = GetContactProto((p->hContact)); - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.cbBlob = (int)mir_strlen(p->sendBuffer) + 1; dbei.flags |= DBEF_UTF; dbei.pBlob = (PBYTE)(p->sendBuffer); @@ -708,7 +708,7 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ::EnableMenuItem(hSubMenu, ID_QUEUEMANAGER_COPYMESSAGETOCLIPBOARD, MF_ENABLED); m_fIsInteractive = true; - int selection = ::TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwndDlg, NULL); + int selection = ::TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, m_hwndDlg, nullptr); if (selection == ID_QUEUEMANAGER_CANCELALLMULTISENDJOBS) { for (int i = 0; i < m_sendLaterJobList.getCount(); i++) { CSendLaterJob *p = m_sendLaterJobList[i]; diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 81a4949897..776d53ee27 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -79,7 +79,7 @@ int SendQueue::addTo(CTabBaseDlg *dat, size_t iLen, int dwFlags) // this entry is used, check if it's orphaned and can be removed... if (m_jobs[i].hOwnerWnd && IsWindow(m_jobs[i].hOwnerWnd)) // window exists, do not reuse it continue; - if (time(NULL) - m_jobs[i].dwTime < 120) // non-acked entry, but not old enough, don't re-use it + if (time(nullptr) - m_jobs[i].dwTime < 120) // non-acked entry, but not old enough, don't re-use it continue; clearJob(i); iFound = i; @@ -99,7 +99,7 @@ entry_found: memcpy(job.szSendBuffer, dat->m_sendBuffer, iLen); job.dwFlags = dwFlags; - job.dwTime = time(NULL); + job.dwTime = time(nullptr); HWND hwndDlg = dat->GetHwnd(); @@ -235,7 +235,7 @@ int SendQueue::sendQueued(CTabBaseDlg *dat, const int iEntry) return 0; } - if (dat->m_hContact == NULL) + if (dat->m_hContact == 0) return 0; //never happens dat->m_nMax = (int)dat->m_cache->getMaxMessageLength(); // refresh length info @@ -289,7 +289,7 @@ int SendQueue::sendQueued(CTabBaseDlg *dat, const int iEntry) ack.result = ACKRESULT_SUCCESS; SendMessage(hwndDlg, HM_EVENTSENT, (WPARAM)MAKELONG(iEntry, 0), (LPARAM)&ack); } - else SetTimer(hwndDlg, TIMERID_MSGSEND + iEntry, PluginConfig.m_MsgTimeout, NULL); + else SetTimer(hwndDlg, TIMERID_MSGSEND + iEntry, PluginConfig.m_MsgTimeout, nullptr); } dat->m_iOpenJobs++; @@ -354,14 +354,14 @@ void SendQueue::logError(CTabBaseDlg *dat, int iSendJobIndex, const wchar_t *szE } else { iMsgLen = 0; - dbei.pBlob = NULL; + dbei.pBlob = nullptr; } dbei.flags = DBEF_UTF; dbei.cbBlob = (int)iMsgLen; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.szModule = (char *)szErrMsg; - dat->StreamInEvents(NULL, 1, 1, &dbei); + dat->StreamInEvents(0, 1, 1, &dbei); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -413,7 +413,7 @@ void SendQueue::showErrorControls(CTabBaseDlg *dat, const int showCmd) const void SendQueue::recallFailed(const CTabBaseDlg *dat, int iEntry) const { - if (dat == NULL) + if (dat == nullptr) return; int iLen = GetWindowTextLength(GetDlgItem(dat->GetHwnd(), IDC_MESSAGE)); @@ -493,7 +493,7 @@ int SendQueue::RTL_Detect(const WCHAR *pszwText) size_t iLen = mir_wstrlen(pszwText); WORD *infoTypeC2 = (WORD*)mir_calloc(sizeof(WORD) * (iLen + 2)); - if (infoTypeC2 == NULL) + if (infoTypeC2 == nullptr) return 0; GetStringTypeW(CT_CTYPE2, pszwText, (int)iLen, infoTypeC2); @@ -557,7 +557,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT; dbei.szModule = GetContactProto(job.hContact); - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.cbBlob = (int)mir_strlen(job.szSendBuffer) + 1; if (dat) @@ -584,7 +584,7 @@ int SendQueue::ackMessage(CTabBaseDlg *dat, WPARAM wParam, LPARAM lParam) M.BroadcastMessage(DM_APPENDMCEVENT, job.hContact, LPARAM(hNewEvent)); - job.hSendId = NULL; + job.hSendId = nullptr; job.iAcksNeeded--; if (job.iAcksNeeded == 0) { // everything sent @@ -648,11 +648,11 @@ int SendQueue::doSendLater(int iJobIndex, CTabBaseDlg *dat, MCONTACT hContact, b dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = GetContactProto(dat->m_hContact); - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.cbBlob = (int)mir_strlen(utfText) + 1; dbei.pBlob = (PBYTE)(char*)utfText; dat->StreamInEvents(0, 1, 1, &dbei); - if (dat->m_hDbEventFirst == NULL) + if (dat->m_hDbEventFirst == 0) SendMessage(dat->GetHwnd(), DM_REMAKELOG, 0, 0); dat->m_cache->saveHistory(0, 0); dat->EnableSendButton(false); diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index e0e3b5ea16..655b571baf 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -35,8 +35,8 @@ TSideBarLayout CSideBar::m_layouts[CSideBar::NR_LAYOUTS] = { SIDEBARLAYOUT_DYNHEIGHT | SIDEBARLAYOUT_VERTICALORIENTATION, CSideBar::m_DefaultContentRenderer, CSideBar::m_DefaultBackgroundRenderer, - NULL, - NULL, + nullptr, + nullptr, SIDEBARLAYOUT_VERTICAL }, { @@ -45,8 +45,8 @@ TSideBarLayout CSideBar::m_layouts[CSideBar::NR_LAYOUTS] = { 0, CSideBar::m_DefaultContentRenderer, CSideBar::m_DefaultBackgroundRenderer, - NULL, - NULL, + nullptr, + nullptr, SIDEBARLAYOUT_NORMAL }, { @@ -55,8 +55,8 @@ TSideBarLayout CSideBar::m_layouts[CSideBar::NR_LAYOUTS] = { SIDEBARLAYOUT_NOCLOSEBUTTONS, CSideBar::m_AdvancedContentRenderer, CSideBar::m_DefaultBackgroundRenderer, - NULL, - NULL, + nullptr, + nullptr, SIDEBARLAYOUT_NORMAL }, { @@ -66,7 +66,7 @@ TSideBarLayout CSideBar::m_layouts[CSideBar::NR_LAYOUTS] = { CSideBar::m_AdvancedContentRenderer, CSideBar::m_DefaultBackgroundRenderer, CSideBar::m_measureAdvancedVertical, - NULL, + nullptr, SIDEBARLAYOUT_VERTICAL } }; @@ -95,7 +95,7 @@ void CSideBarButton::_create() m_sz.cx = m_sz.cy = 0; m_hwnd = ::CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, - 0, 0, 40, 40, m_sideBar->getScrollWnd(), reinterpret_cast(m_id), g_hInst, NULL); + 0, 0, 40, 40, m_sideBar->getScrollWnd(), reinterpret_cast(m_id), g_hInst, nullptr); if (m_hwnd) { CustomizeButton(m_hwnd); ::SendMessage(m_hwnd, BUTTONSETASSIDEBARBUTTON, (WPARAM)this, 0); @@ -260,7 +260,7 @@ void CSideBarButton::renderIconAndNick(const HDC hdc, const RECT *rcItem) const if (m_dat->m_dwFlagsEx & MWF_SHOW_ISIDLE && PluginConfig.m_bIdleDetect) CSkin::DrawDimmedIcon(hdc, ix, iy, iSize, iSize, hIcon, 180); else - ::DrawIconEx(hdc, ix, iy, hIcon, iSize, iSize, 0, NULL, DI_NORMAL | DI_COMPAT); + ::DrawIconEx(hdc, ix, iy, hIcon, iSize, iSize, 0, nullptr, DI_NORMAL | DI_COMPAT); } rc.left += (iSize + 7); @@ -490,7 +490,7 @@ void CSideBar::removeAll() void CSideBar::populateAll() { HWND hwndTab = ::GetDlgItem(m_pContainer->hwnd, IDC_MSGTABS); - if (hwndTab == NULL) + if (hwndTab == nullptr) return; int iItems = (int)TabCtrl_GetItemCount(hwndTab); @@ -506,11 +506,11 @@ void CSideBar::populateAll() continue; CSrmmWindow *dat = (CSrmmWindow*)::GetWindowLongPtr((HWND)item.lParam, GWLP_USERDATA); - if (dat == NULL) + if (dat == nullptr) continue; CSideBarButton *b_item = findSession(dat); - if (b_item == NULL) + if (b_item == nullptr) addSession(dat, i); else { b_item->setLayout(m_currentLayout); @@ -568,7 +568,7 @@ HRESULT CSideBar::removeSession(CTabBaseDlg *dat) if (dat) { CSideBarButton *item = findSession(dat); - if (item != NULL) { + if (item != nullptr) { m_iTopButtons--; if (m_dwFlags & SIDEBARLAYOUT_DYNHEIGHT) { SIZE sz = item->getSize(); @@ -655,7 +655,7 @@ void CSideBar::updateSession(CTabBaseDlg *dat) return; CSideBarButton *item = findSession(dat); - if (item == NULL) + if (item == nullptr) return; if (m_dwFlags & SIDEBARLAYOUT_DYNHEIGHT) { @@ -665,11 +665,11 @@ void CSideBar::updateSession(CTabBaseDlg *dat) m_topHeight += (sz.cy + 1); if (sz.cy != oldHeight) { Invalidate(); - ::InvalidateRect(item->getHwnd(), NULL, TRUE); + ::InvalidateRect(item->getHwnd(), nullptr, TRUE); } - else ::InvalidateRect(item->getHwnd(), NULL, FALSE); + else ::InvalidateRect(item->getHwnd(), nullptr, FALSE); } - else ::InvalidateRect(item->getHwnd(), NULL, FALSE); + else ::InvalidateRect(item->getHwnd(), nullptr, FALSE); } /** @@ -684,7 +684,7 @@ void CSideBar::updateSession(CTabBaseDlg *dat) const CSideBarButton* CSideBar::setActiveItem(const CTabBaseDlg *dat) { CSideBarButton *item = findSession(dat); - if (item != NULL) + if (item != nullptr) return setActiveItem(item); return 0; @@ -746,14 +746,14 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) if (p.isTopAligned()) { if (m_totalItemHeight <= m_firstVisibleOffset) { // partially visible - if (!fOnlyCalc && NULL != hwnd) /* Wine fix. */ + if (!fOnlyCalc && nullptr != hwnd) /* Wine fix. */ hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, -(m_firstVisibleOffset - m_totalItemHeight), m_elementWidth, height, SWP_SHOWWINDOW | dwFlags); spaceUsed += ((height + 1) - (m_firstVisibleOffset - m_totalItemHeight)); m_totalItemHeight += (height + 1); } else { - if (!fOnlyCalc && NULL != hwnd) /* Wine fix. */ + if (!fOnlyCalc && nullptr != hwnd) /* Wine fix. */ hdwp = ::DeferWindowPos(hdwp, hwnd, 0, 2, spaceUsed, m_elementWidth, height, SWP_SHOWWINDOW | dwFlags); spaceUsed += (height + 1); m_totalItemHeight += (height + 1); @@ -777,8 +777,8 @@ void CSideBar::Layout(const RECT *rc, bool fOnlyCalc) m_elementWidth + 4, 14, dwFlags | SWP_SHOWWINDOW); ::EnableWindow(m_up->getHwnd(), topEnabled); ::EnableWindow(m_down->getHwnd(), bottomEnabled); - ::InvalidateRect(m_up->getHwnd(), NULL, FALSE); - ::InvalidateRect(m_down->getHwnd(), NULL, FALSE); + ::InvalidateRect(m_up->getHwnd(), nullptr, FALSE); + ::InvalidateRect(m_down->getHwnd(), nullptr, FALSE); } } @@ -807,8 +807,8 @@ void CSideBar::showAll(int showCmd) CSideBarButton* CSideBar::findSession(const CTabBaseDlg *dat) { - if (dat == NULL) - return NULL; + if (dat == nullptr) + return nullptr; for (int i = 0; i < m_buttonlist.getCount(); i++) { CSideBarButton &p = m_buttonlist[i]; @@ -816,7 +816,7 @@ CSideBarButton* CSideBar::findSession(const CTabBaseDlg *dat) return &p; } - return NULL; + return nullptr; } /** @@ -830,8 +830,8 @@ CSideBarButton* CSideBar::findSession(const CTabBaseDlg *dat) CSideBarButton* CSideBar::findSession(const MCONTACT hContact) { - if (hContact == NULL) - return NULL; + if (hContact == 0) + return nullptr; for (int i = 0; i < m_buttonlist.getCount(); i++) { CSideBarButton &p = m_buttonlist[i]; @@ -839,7 +839,7 @@ CSideBarButton* CSideBar::findSession(const MCONTACT hContact) return &p; } - return NULL; + return nullptr; } void CSideBar::processScrollerButtons(UINT commandID) @@ -869,7 +869,7 @@ void CSideBar::invalidateButton(CTabBaseDlg *dat) { if (m_isActive && m_isVisible) { CSideBarButton *item = findSession(dat); - if (item != NULL) + if (item != nullptr) RedrawWindow(item->m_buttonControl->hwnd, 0, 0, RDW_INVALIDATE | RDW_UPDATENOW); } } diff --git a/plugins/TabSRMM/src/sidebar.h b/plugins/TabSRMM/src/sidebar.h index 7cfbfa8470..505fc26847 100644 --- a/plugins/TabSRMM/src/sidebar.h +++ b/plugins/TabSRMM/src/sidebar.h @@ -156,8 +156,8 @@ public: CSideBarButton *oldItem = m_activeItem; m_activeItem = const_cast(newItem); if (oldItem) - ::InvalidateRect(oldItem->getHwnd(), NULL, FALSE); - ::InvalidateRect(m_activeItem->getHwnd(), NULL, FALSE); + ::InvalidateRect(oldItem->getHwnd(), nullptr, FALSE); + ::InvalidateRect(m_activeItem->getHwnd(), nullptr, FALSE); scrollIntoView(m_activeItem); return(oldItem); } diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index fe8ffe3553..0c71228430 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -154,6 +154,6 @@ int _DebugPopup(MCONTACT hContact, const wchar_t *fmt, ...) mir_snwprintf(szTitle, TranslateT("TabSRMM message (%s)"), (hContact != 0) ? pcli->pfnGetContactDisplayName(hContact, 0) : TranslateT("Global")); - Clist_TrayNotifyW(NULL, szTitle, debug, NIIF_INFO, 1000 * 4); + Clist_TrayNotifyW(nullptr, szTitle, debug, NIIF_INFO, 1000 * 4); return 0; } diff --git a/plugins/TabSRMM/src/tabctrl.cpp b/plugins/TabSRMM/src/tabctrl.cpp index f9da0a08a4..0de6d200fe 100644 --- a/plugins/TabSRMM/src/tabctrl.cpp +++ b/plugins/TabSRMM/src/tabctrl.cpp @@ -100,21 +100,23 @@ static UINT FindLeftDownItem(HWND hwnd) ///////////////////////////////////////////////////////////////////////////////////////// // tab control color definitions, including the database setting key names -static struct colOptions +struct colOptions { UINT defclr; char *szKey; char *szSkinnedKey; -} tabcolors[] = { - COLOR_BTNTEXT, "tab_txt_normal", "S_tab_txt_normal", - COLOR_BTNTEXT, "tab_txt_active", "S_tab_txt_active", - COLOR_HOTLIGHT, "tab_txt_hottrack", "S_tab_txt_hottrack", - COLOR_HOTLIGHT, "tab_txt_unread", "S_tab_txt_unread", - COLOR_3DFACE, "tab_bg_normal", "tab_bg_normal", - COLOR_3DFACE, "tab_bg_active", "tab_bg_active", - COLOR_3DFACE, "tab_bg_hottrack", "tab_bg_hottrack", - COLOR_3DFACE, "tab_bg_unread", "tab_bg_unread", - 0, 0, NULL, NULL +} +static tabcolors[] = +{ + { COLOR_BTNTEXT, "tab_txt_normal", "S_tab_txt_normal" }, + { COLOR_BTNTEXT, "tab_txt_active", "S_tab_txt_active" }, + { COLOR_HOTLIGHT, "tab_txt_hottrack", "S_tab_txt_hottrack" }, + { COLOR_HOTLIGHT, "tab_txt_unread", "S_tab_txt_unread" }, + { COLOR_3DFACE, "tab_bg_normal", "tab_bg_normal" }, + { COLOR_3DFACE, "tab_bg_active", "tab_bg_active" }, + { COLOR_3DFACE, "tab_bg_hottrack", "tab_bg_hottrack" }, + { COLOR_3DFACE, "tab_bg_unread", "tab_bg_unread" }, + { 0, 0, nullptr } }; ///////////////////////////////////////////////////////////////////////////////////////// @@ -162,7 +164,7 @@ void TSAPI FillTabBackground(const HDC hdc, int iStateId, const CTabBaseDlg *dat static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, int nItem, CSrmmWindow *dat) { - if (dat == NULL) + if (dat == nullptr) return; InflateRect(rcItem, -2, -2); @@ -200,7 +202,7 @@ static void DrawItem(TabControlData *tabdat, HDC dc, RECT *rcItem, int nHint, in if (dat->m_dwFlagsEx & MWF_SHOW_ISIDLE && PluginConfig.m_bIdleDetect) CSkin::DrawDimmedIcon(dc, ix, iy, iSize, iSize, hIcon, 180); else - DrawIconEx(dc, ix, iy, hIcon, iSize, iSize, 0, NULL, DI_NORMAL | DI_COMPAT); + DrawIconEx(dc, ix, iy, hIcon, iSize, iSize, 0, nullptr, DI_NORMAL | DI_COMPAT); } rcItem->left += (iSize + 2 + tabdat->m_xpad); @@ -417,7 +419,7 @@ static HRESULT DrawThemesPartWithAero(const TabControlData *tabdat, HDC hDC, int tabdat->helperGlowItem->Render(hDC, prcBox, true); } else if (tabdat->hTheme != 0) { - hResult = DrawThemeBackground(tabdat->hTheme, hDC, iPartId, iStateId, prcBox, NULL); + hResult = DrawThemeBackground(tabdat->hTheme, hDC, iPartId, iStateId, prcBox, nullptr); } return hResult; @@ -431,7 +433,7 @@ static HRESULT DrawThemesPart(const TabControlData *tabdat, HDC hDC, int iPartId HRESULT hResult = 0; if (tabdat->hTheme != 0) - hResult = DrawThemeBackground(tabdat->hTheme, hDC, iPartId, iStateId, prcBox, NULL); + hResult = DrawThemeBackground(tabdat->hTheme, hDC, iPartId, iStateId, prcBox, nullptr); return hResult; } @@ -446,7 +448,7 @@ static void DrawThemesXpTabItem(HDC pDC, RECT *rcItem, UINT uiFlag, TabControlDa BOOL bSel = (uiFlag & 2) ? TRUE : FALSE; BOOL bHot = (uiFlag & 4) ? TRUE : FALSE; BOOL bBottom = (uiFlag & 8) ? TRUE : FALSE; // mirror - LPBYTE pcImg = NULL; + LPBYTE pcImg = nullptr; int nStart = 0, nLenSub = 0; SIZE szBmp; @@ -589,10 +591,10 @@ static POINT ptMouseT = { 0 }; static void PaintWorker(HWND hwnd, TabControlData *tabdat) { - if (tabdat == NULL || tabdat->pContainer == NULL) + if (tabdat == nullptr || tabdat->pContainer == nullptr) return; - if (GetUpdateRect(hwnd, NULL, TRUE) == 0) + if (GetUpdateRect(hwnd, nullptr, TRUE) == 0) return; RECT rectTemp, rctPage, rctActive, rcItem, rctClip, rctOrig; @@ -606,7 +608,7 @@ static void PaintWorker(HWND hwnd, TabControlData *tabdat) GetCursorPos(&pt); int hotItem = GetTabItemFromMouse(hwnd, &pt); if (tabdat->iHoveredTabIndex != hotItem) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); tabdat->iHoveredTabIndex = hotItem; TCITEM tci = {}; @@ -932,7 +934,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara POINT pt; TabControlData *tabdat = (TabControlData *)GetWindowLongPtr(hwnd, GWLP_USERDATA); if (tabdat) { - if (tabdat->pContainer == NULL) + if (tabdat->pContainer == nullptr) tabdat->pContainer = (TContainerData*)GetWindowLongPtr(GetParent(hwnd), GWLP_USERDATA); tabdat->dwStyle = GetWindowLongPtr(hwnd, GWL_STYLE); } @@ -978,14 +980,14 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara // it is sufficient to search it once. So this message is called, whenever // a new tab is inserted HWND hwndChild; - if ((hwndChild = FindWindowEx(hwnd, 0, L"msctls_updown32", NULL)) != 0) + if ((hwndChild = FindWindowEx(hwnd, 0, L"msctls_updown32", nullptr)) != 0) DestroyWindow(hwndChild); return 0; case EM_VALIDATEBOTTOM: if ((tabdat->dwStyle & TCS_BOTTOM) && tabdat->m_VisualStyles != 0 && PluginConfig.tabConfig.m_bottomAdjust != 0) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); break; case EM_REFRESHWITHOUTCLIP: @@ -993,7 +995,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara return 0; tabdat->bRefreshWithoutClip = TRUE; - RedrawWindow(hwnd, NULL, NULL, RDW_UPDATENOW | RDW_NOCHILDREN | RDW_INVALIDATE); + RedrawWindow(hwnd, nullptr, nullptr, RDW_UPDATENOW | RDW_NOCHILDREN | RDW_INVALIDATE); tabdat->bRefreshWithoutClip = FALSE; return 0; @@ -1037,7 +1039,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara case WM_SETCURSOR: GetCursorPos(&pt); - InvalidateRect(hwnd, NULL, FALSE); /* wine: fix for erase/paint tab on mouse enter/leave tab. */ + InvalidateRect(hwnd, nullptr, FALSE); /* wine: fix for erase/paint tab on mouse enter/leave tab. */ SendMessage(GetParent(hwnd), msg, wParam, lParam); if (abs(pt.x - ptMouseT.x) < 4 && abs(pt.y - ptMouseT.y) < 4) return 1; @@ -1109,7 +1111,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara int i = GetTabItemFromMouse(hwnd, &pt); if (i != -1) { TCITEM tc; - CSrmmWindow *dat = NULL; + CSrmmWindow *dat = nullptr; tc.mask = TCIF_PARAM; TabCtrl_GetItem(hwnd, i, &tc); @@ -1189,12 +1191,12 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara int iOld = tabdat->iHoveredTabIndex; tabdat->iHoveredTabIndex = GetTabItemFromMouse(hwnd, &pt); if (tabdat->iHoveredTabIndex != iOld) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); if (tabdat->fCloseButton && tabdat->iHoveredTabIndex != -1) { iOld = tabdat->iHoveredCloseIcon; tabdat->iHoveredCloseIcon = TabCtrl_TestForCloseButton(tabdat, hwnd, &pt); if (tabdat->iHoveredCloseIcon != iOld) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); } } break; @@ -1203,7 +1205,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara { LRESULT res = CallWindowProc(OldTabControlClassProc, hwnd, msg, wParam, lParam); if (res != HTCLIENT) - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); return (res); } break; @@ -1222,7 +1224,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara if (i != -1 && i != tabdat->iBeginIndex) RearrangeTab(tabdat->hwndDrag, tabdat->dragDat, MAKELONG(i, 0xffff), tabdat->fSavePos); tabdat->hwndDrag = (HWND)-1; - tabdat->dragDat = NULL; + tabdat->dragDat = nullptr; if (tabdat->himlDrag) { ImageList_RemoveAll(tabdat->himlDrag); ImageList_Destroy(tabdat->himlDrag); @@ -1247,7 +1249,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara return 0; case WM_TIMER: - InvalidateRect(hwnd, NULL, FALSE); /* wine: fix for erase/paint tab on mouse enter/leave tab. */ + InvalidateRect(hwnd, nullptr, FALSE); /* wine: fix for erase/paint tab on mouse enter/leave tab. */ if (wParam == TIMERID_HOVER_T && M.GetByte("d_tooltips", 0)) { KillTimer(hwnd, TIMERID_HOVER_T); @@ -1288,7 +1290,7 @@ static LRESULT CALLBACK TabControlSubclassProc(HWND hwnd, UINT msg, WPARAM wPara SendMessage(GetParent(hwnd), DM_SELECTTAB, DM_SELECT_PREV, 0); else if (amount < 0) SendMessage(GetParent(hwnd), DM_SELECTTAB, DM_SELECT_NEXT, 0); - InvalidateRect(hwnd, NULL, FALSE); + InvalidateRect(hwnd, nullptr, FALSE); } break; @@ -1320,7 +1322,7 @@ void TSAPI ReloadTabConfig() SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &nclim, 0); PluginConfig.tabConfig.m_hMenuFont = CreateFontIndirect(&nclim.lfMessageFont); - for (int i = 0; tabcolors[i].szKey != NULL; i++) + for (int i = 0; tabcolors[i].szKey != nullptr; i++) PluginConfig.tabConfig.colors[i] = M.GetDword(CSkin::m_skinEnabled ? tabcolors[i].szSkinnedKey : tabcolors[i].szKey, GetSysColor(tabcolors[i].defclr)); PluginConfig.tabConfig.m_brushes[0] = CreateSolidBrush(PluginConfig.tabConfig.colors[4]); @@ -1408,8 +1410,8 @@ INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY: BOOL translated; - db_set_b(0, SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE))); - db_set_b(0, SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE))); + db_set_b(0, SRMSGMOD_T, "y-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_TABPADDING, nullptr, FALSE))); + db_set_b(0, SRMSGMOD_T, "x-pad", (BYTE)(GetDlgItemInt(hwndDlg, IDC_HTABPADDING, nullptr, FALSE))); db_set_b(0, SRMSGMOD_T, "tborder", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDER, &translated, FALSE)); db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_left" : "tborder_outer_left", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTER, &translated, FALSE)); db_set_b(0, SRMSGMOD_T, CSkin::m_skinEnabled ? "S_tborder_outer_right" : "tborder_outer_right", (BYTE)GetDlgItemInt(hwndDlg, IDC_TABBORDEROUTERRIGHT, &translated, FALSE)); @@ -1425,8 +1427,8 @@ INT_PTR CALLBACK DlgProcTabConfig(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM for (TContainerData *p = pFirstContainer; p; p = p->pNext) { HWND hwndTab = GetDlgItem(p->hwnd, IDC_MSGTABS); - TabCtrl_SetPadding(hwndTab, GetDlgItemInt(hwndDlg, IDC_HTABPADDING, NULL, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, NULL, FALSE)); - RedrawWindow(hwndTab, NULL, NULL, RDW_INVALIDATE | RDW_ERASE); + TabCtrl_SetPadding(hwndTab, GetDlgItemInt(hwndDlg, IDC_HTABPADDING, nullptr, FALSE), GetDlgItemInt(hwndDlg, IDC_TABPADDING, nullptr, FALSE)); + RedrawWindow(hwndTab, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE); } return TRUE; } @@ -1467,28 +1469,28 @@ int TSAPI RegisterTabCtrlClass(void) wc.lpszClassName = L"TSTabCtrlClass"; wc.lpfnWndProc = TabControlSubclassProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(TabControlData*); wc.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC; RegisterClassEx(&wc); wc.lpszClassName = L"TSStatusBarClass"; wc.lpfnWndProc = StatusBarSubclassProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(void*); wc.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_PARENTDC; RegisterClassEx(&wc); wc.lpszClassName = L"TS_SideBarClass"; wc.lpfnWndProc = CSideBar::wndProcStub; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(void*); wc.style = CS_GLOBALCLASS;// | CS_DBLCLKS; // | CS_PARENTDC; RegisterClassEx(&wc); wc.lpszClassName = L"TSHK"; wc.lpfnWndProc = HotkeyHandlerDlgProc; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.cbWndExtra = sizeof(void*); wc.style = CS_GLOBALCLASS;// | CS_DBLCLKS; // | CS_PARENTDC; RegisterClassEx(&wc); diff --git a/plugins/TabSRMM/src/taskbar.cpp b/plugins/TabSRMM/src/taskbar.cpp index 16a3c67145..1073cb0271 100644 --- a/plugins/TabSRMM/src/taskbar.cpp +++ b/plugins/TabSRMM/src/taskbar.cpp @@ -72,7 +72,7 @@ CTaskbarInteract* Win7Taskbar = 0; bool CTaskbarInteract::setOverlayIcon(HWND hwndDlg, LPARAM lParam) const { if (m_pTaskbarInterface && m_isEnabled && m_fHaveLargeicons) { - m_pTaskbarInterface->SetOverlayIcon(hwndDlg, (HICON)lParam, NULL); + m_pTaskbarInterface->SetOverlayIcon(hwndDlg, (HICON)lParam, nullptr); return true; } return false; @@ -120,7 +120,7 @@ bool CTaskbarInteract::haveLargeIcons() void CTaskbarInteract::clearOverlayIcon(HWND hwndDlg) const { if (m_pTaskbarInterface && m_isEnabled) - m_pTaskbarInterface->SetOverlayIcon(hwndDlg, NULL, NULL); + m_pTaskbarInterface->SetOverlayIcon(hwndDlg, nullptr, nullptr); } LONG CTaskbarInteract::updateMetrics() @@ -231,7 +231,7 @@ CProxyWindow::CProxyWindow(CTabBaseDlg *dat) m_thumb = 0; m_hwndProxy = ::CreateWindowEx(/*WS_EX_TOOLWINDOW | */WS_EX_NOACTIVATE, PROXYCLASSNAME, L"", - WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION, -32000, -32000, 10, 10, NULL, NULL, g_hInst, (LPVOID)this); + WS_POPUP | WS_BORDER | WS_SYSMENU | WS_CAPTION, -32000, -32000, 10, 10, nullptr, nullptr, g_hInst, (LPVOID)this); #if defined(__LOGDEBUG_) _DebugTraceW(L"create proxy object for: %s", m_dat->cache->getNick()); @@ -314,7 +314,7 @@ void CProxyWindow::sendThumb(LONG width, LONG height) */ void CProxyWindow::sendPreview() { - if (m_dat->m_pContainer == NULL) + if (m_dat->m_pContainer == nullptr) return; CSrmmWindow *dat_active = reinterpret_cast(::GetWindowLongPtr(m_dat->m_pContainer->hwndActive, GWLP_USERDATA)); @@ -866,7 +866,7 @@ void CThumbMUC::renderContent() m_rcIcon.top += m_sz.cy; } if (si->iType != GCW_SERVER) { - wchar_t* _p = NULL; + wchar_t* _p = nullptr; if (si->ptszStatusbarText) _p = wcschr(si->ptszStatusbarText, ']'); if (_p) { diff --git a/plugins/TabSRMM/src/taskbar.h b/plugins/TabSRMM/src/taskbar.h index 8c7c3e4719..11c6fec623 100644 --- a/plugins/TabSRMM/src/taskbar.h +++ b/plugins/TabSRMM/src/taskbar.h @@ -145,7 +145,7 @@ public: m_isEnabled = IsWinVer7Plus() ? true : false; if (m_isEnabled) { - ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_ALL, IID_ITaskbarList3, (void**)&m_pTaskbarInterface); + ::CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&m_pTaskbarInterface); updateMetrics(); if (0 == m_pTaskbarInterface) m_isEnabled = false; @@ -157,7 +157,7 @@ public: WNDCLASSEX wcex = { sizeof(wcex) }; wcex.lpfnWndProc = CProxyWindow::stubWndProc; wcex.hInstance = g_hInst; - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = LoadCursor(nullptr, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcex.lpszClassName = PROXYCLASSNAME; ::RegisterClassEx(&wcex); diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 39cc6288d7..9703d09e17 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -96,12 +96,12 @@ void LoadDefaultTemplates() if (M.GetByte(RTLTEMPLATES_MODULE, "setup", 0) < 2) { for (int i = 0; i <= TMPL_ERRMSG; i++) - db_set_ws(NULL, RTLTEMPLATES_MODULE, TemplateNames[i], RTL_Default.szTemplates[i]); + db_set_ws(0, RTLTEMPLATES_MODULE, TemplateNames[i], RTL_Default.szTemplates[i]); db_set_b(0, RTLTEMPLATES_MODULE, "setup", 2); } if (M.GetByte(TEMPLATES_MODULE, "setup", 0) < 2) { for (int i = 0; i <= TMPL_ERRMSG; i++) - db_set_ws(NULL, TEMPLATES_MODULE, TemplateNames[i], LTR_Default.szTemplates[i]); + db_set_ws(0, TEMPLATES_MODULE, TemplateNames[i], LTR_Default.szTemplates[i]); db_set_b(0, TEMPLATES_MODULE, "setup", 2); } LoadTemplatesFrom(<R_Active, 0, 0); @@ -121,7 +121,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP teInfo = (TemplateEditorInfo *)dat->m_pContainer; tSet = teInfo->rtl ? dat->m_pContainer->rtl_templates : dat->m_pContainer->ltr_templates; } - else tSet = NULL; + else tSet = nullptr; switch (msg) { case WM_INITDIALOG: @@ -242,7 +242,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, FALSE); Utils::enableDlgControl(hwndDlg, IDC_REVERT, TRUE); } - InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), nullptr, FALSE); } break; @@ -258,7 +258,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE); Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE); Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE); - InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), nullptr, FALSE); db_set_ws(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit], newTemplate); SendDlgItemMessage(hwndDlg, IDC_EDITTEMPLATE, EM_SETREADONLY, TRUE, 0); } @@ -270,7 +270,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP teInfo->selchanging = TRUE; SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]); SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE)); - InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), nullptr, FALSE); Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE); Utils::enableDlgControl(hwndDlg, IDC_FORGET, FALSE); Utils::enableDlgControl(hwndDlg, IDC_TEMPLATELIST, TRUE); @@ -287,7 +287,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit]); db_unset(teInfo->hContact, teInfo->rtl ? RTLTEMPLATES_MODULE : TEMPLATES_MODULE, TemplateNames[teInfo->inEdit]); SetFocus(GetDlgItem(hwndDlg, IDC_EDITTEMPLATE)); - InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), NULL, FALSE); + InvalidateRect(GetDlgItem(hwndDlg, IDC_TEMPLATELIST), nullptr, FALSE); teInfo->selchanging = FALSE; Utils::enableDlgControl(hwndDlg, IDC_SAVETEMPLATE, FALSE); Utils::enableDlgControl(hwndDlg, IDC_REVERT, FALSE); @@ -343,7 +343,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP DBEVENTINFO dbei = {}; dbei.szModule = dat->m_szProto; - dbei.timestamp = time(NULL); + dbei.timestamp = time(nullptr); dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE; dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType; if (dbei.eventType == EVENTTYPE_ERRMSG) @@ -352,7 +352,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP dbei.cbBlob = (int)mir_strlen((char *)dbei.pBlob) + 1; dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0; dbei.flags |= (teInfo->rtl ? DBEF_RTL : 0); - dat->m_lastEventTime = (iIndex == 4 || iIndex == 5) ? time(NULL) - 1 : 0; + dat->m_lastEventTime = (iIndex == 4 || iIndex == 5) ? time(nullptr) - 1 : 0; dat->m_iLastEventType = MAKELONG(dbei.flags, dbei.eventType); SetDlgItemText(hwndDlg, IDC_PREVIEW, L""); dat->m_dwFlags = MWF_LOG_ALL; diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index cc6f3bb5c1..c0ffbdb78c 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -104,7 +104,7 @@ static void TSAPI LoadLogfontFromINI(int i, char *szKey, LOGFONTA *lf, COLORREF *colour = GetPrivateProfileIntA(szKey, "Color", 0, szIniFilename); if (lf) { - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); if (i == H_MSGFONTID_DIVIDERS) lf->lfHeight = 5; else { @@ -115,7 +115,7 @@ static void TSAPI LoadLogfontFromINI(int i, char *szKey, LOGFONTA *lf, COLORREF lf->lfHeight = bSize; } - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); lf->lfWidth = 0; lf->lfEscapement = 0; @@ -163,7 +163,7 @@ static struct _tagFontBlocks { FONTMODULE, 0, MSGDLGFONTCOUNT, "Font%d", "StdFonts", FONTMODULE, 100, IPFONTCOUNT, "IPFont%d", "MiscFonts", CHATFONT_MODULE, 0, CHATFONTCOUNT, "ChatFont%d", CHATFONT_MODULE, - NULL, 0, 0, NULL + nullptr, 0, 0, nullptr }; int TSAPI CheckThemeVersion(const wchar_t *szIniFilename) @@ -194,7 +194,7 @@ void TSAPI WriteThemeToINI(const wchar_t *szIniFilenameT, CSrmmWindow *dat) for (i = 0; i < fontBlocks[n].iCount; i++) { mir_snprintf(szTemp, "Font%d", firstIndex + i); mir_snprintf(szAppname, fontBlocks[n].szIniTemp, firstIndex + i); - if (!db_get_s(NULL, szModule, szTemp, &dbv)) { + if (!db_get_s(0, szModule, szTemp, &dbv)) { WritePrivateProfileStringA(szAppname, "Face", dbv.pszVal, szIniFilename); db_free(&dbv); } @@ -258,7 +258,7 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, if ((version = GetPrivateProfileIntA("TabSRMM Theme", "Version", 0, szIniFilename)) == 0) // no version number.. assume 1 version = 1; - HDC hdc = GetDC(NULL); + HDC hdc = GetDC(nullptr); if (dat == 0) { while (fontBlocks[n].szModule && (dwFlags & THEME_READ_FONTS)) { char *szModule = fontBlocks[n].szModule; @@ -278,7 +278,7 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, if (GetPrivateProfileStringA(szAppname, "Face", "Verdana", szBuf, sizeof(szBuf), szIniFilename) != 0) { if (i == MSGFONTID_SYMBOLS_IN || i == MSGFONTID_SYMBOLS_OUT) strncpy_s(szBuf, "Arial", _TRUNCATE); - db_set_s(NULL, szModule, szTemp, szBuf); + db_set_s(0, szModule, szTemp, szBuf); } mir_snprintf(szTemp, "Font%dCol", firstIndex + i); @@ -302,7 +302,7 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, n++; } def = SRMSGDEFSET_BKGCOLOUR; - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); if (dwFlags & THEME_READ_FONTS) { COLORREF defclr; @@ -341,7 +341,7 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, } else { int SY = GetDeviceCaps(hdc, LOGPIXELSY); - ReleaseDC(NULL, hdc); + ReleaseDC(nullptr, hdc); if (!noAdvanced) { for (i = 0; i < MSGDLGFONTCOUNT; i++) { mir_snprintf(szTemp, "Font%d", i); @@ -382,7 +382,7 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, if (mir_strcmp(szTemplateBuffer, "[undef]")) { if (dat == 0) - db_set_utf(NULL, TEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer); + db_set_utf(0, TEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer); decoded = mir_utf8decodeW(szTemplateBuffer); if (dat == 0) wcsncpy_s(LTR_Active.szTemplates[i], decoded, _TRUNCATE); @@ -395,7 +395,7 @@ void TSAPI ReadThemeFromINI(const wchar_t *szIniFilenameT, TContainerData *dat, if (mir_strcmp(szTemplateBuffer, "[undef]")) { if (dat == 0) - db_set_utf(NULL, RTLTEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer); + db_set_utf(0, RTLTEMPLATES_MODULE, TemplateNames[i], szTemplateBuffer); decoded = mir_utf8decodeW(szTemplateBuffer); if (dat == 0) wcsncpy_s(RTL_Active.szTemplates[i], decoded, _TRUNCATE); @@ -439,12 +439,12 @@ const wchar_t* TSAPI GetThemeFileName(int iMode) if (GetOpenFileName(&ofn)) return szFilename; else - return NULL; + return nullptr; } else { if (GetSaveFileName(&ofn)) return szFilename; else - return NULL; + return nullptr; } } diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index f3300ab7aa..b42d334f86 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -318,7 +318,7 @@ static DWORD __inline argb_from_cola(COLORREF col, UINT32 alpha) void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_dest, BYTE clr_dest_trans, BYTE bGradient, BYTE bCorner, DWORD dwRadius, CImageItem *imageItem) { - if (rc == NULL) + if (rc == nullptr) return; LONG realHeight = (rc->bottom - rc->top); @@ -397,8 +397,8 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de return; void *pvBits; - HBITMAP hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); - if (hbitmap == NULL || pvBits == NULL) { + HBITMAP hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0); + if (hbitmap == nullptr || pvBits == nullptr) { DeleteDC(hdc); return; } @@ -473,8 +473,8 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de } // TL+BL CORNER - hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); - if (hbitmap == 0 || pvBits == NULL) { + hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0); + if (hbitmap == 0 || pvBits == nullptr) { DeleteObject(BrMask); DeleteDC(hdc); return; @@ -513,7 +513,7 @@ void TSAPI DrawAlpha(HDC hDC, PRECT rc, DWORD clr_base, int alpha, DWORD clr_de DeleteObject(hbitmap); // TR+BR CORNER - hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, NULL, 0x0); + hbitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, &pvBits, nullptr, 0x0); holdbitmap = (HBITMAP)SelectObject(hdc, hbitmap); RoundRect(hdc, -1 - ulBitmapWidth, -1, ulBitmapWidth + 1, (realHeight + 1), dwRadius, dwRadius); @@ -747,7 +747,7 @@ static struct L"Global", L"TabTextActive", "S_tab_txt_active", 5, 0, L"Global", L"TabTextUnread", "S_tab_txt_unread", 5, 0, L"Global", L"TabTextHottrack", "S_tab_txt_hottrack", 5, 0, - NULL, NULL, NULL, 0, 0 + nullptr, nullptr, nullptr, 0, 0 }; void CImageItem::Create(const wchar_t *szImageFile) @@ -817,7 +817,7 @@ wchar_t* CImageItem::Read(const wchar_t *szFilename) szFinalName = new wchar_t[MAX_PATH]; //strncpy(m_szName, &m_szName[1], sizeof(m_szName)); //m_szName[sizeof(m_szName) - 1] = 0; - _wsplitpath(szFilename, szDrive, szPath, NULL, NULL); + _wsplitpath(szFilename, szDrive, szPath, nullptr, nullptr); mir_snwprintf(szFinalName, MAX_PATH, L"%s\\%s%s", szDrive, szPath, buffer); if (!PathFileExists(szFinalName)) { delete[] szFinalName; @@ -916,7 +916,7 @@ void CImageItem::SetBitmap32Alpha(HBITMAP hBitmap, BYTE bAlpha) DWORD dwLen = bmp.bmWidth * bmp.bmHeight * (bmp.bmBitsPixel / 8); BYTE *p = (BYTE *)mir_alloc(dwLen); - if (p == NULL) + if (p == nullptr) return; memset(p, 0, dwLen); @@ -1056,7 +1056,7 @@ void CSkin::Init(bool fStartup) bool CSkin::warnToClose() const { - if (::pFirstContainer == NULL) + if (::pFirstContainer == nullptr) return true; if (MessageBox(0, @@ -1077,27 +1077,27 @@ void CSkin::UnloadAeroTabs() { if (m_tabTop) { delete m_tabTop; - m_tabTop = NULL; + m_tabTop = nullptr; } if (m_tabBottom) { delete m_tabBottom; - m_tabBottom = NULL; + m_tabBottom = nullptr; } if (m_tabGlowTop) { delete m_tabGlowTop; - m_tabGlowTop = NULL; + m_tabGlowTop = nullptr; } if (m_tabGlowBottom) { delete m_tabGlowBottom; - m_tabGlowTop = NULL; + m_tabGlowTop = nullptr; } if (m_switchBarItem) { delete m_switchBarItem; - m_switchBarItem = NULL; + m_switchBarItem = nullptr; } } @@ -1207,11 +1207,11 @@ void CSkin::LoadIcon(const wchar_t *szSection, const wchar_t *name, HICON &hIcon if (mir_wstrcmpi(buffer, L"none")) { wchar_t szDrive[MAX_PATH], szDir[MAX_PATH], szImagePath[MAX_PATH]; - _wsplitpath(m_tszFileName, szDrive, szDir, NULL, NULL); + _wsplitpath(m_tszFileName, szDrive, szDir, nullptr, nullptr); mir_snwprintf(szImagePath, L"%s\\%s\\%s", szDrive, szDir, buffer); hIcon = (HICON)LoadImage(0, szImagePath, IMAGE_ICON, 16, 16, LR_LOADFROMFILE); } - else hIcon = NULL; + else hIcon = nullptr; } @@ -1329,7 +1329,7 @@ void CSkin::ReadImageItem(const wchar_t *itemname) if (tmpItem.getHbm() || (tmpItem.getFlags() & IMAGE_GLYPH)) { CImageItem *newItem = new CImageItem(tmpItem); SkinItems[i].imageItem = newItem; - if (m_ImageItems == NULL) + if (m_ImageItems == nullptr) m_ImageItems = newItem; else { CImageItem *pItem = m_ImageItems; @@ -1376,7 +1376,7 @@ void CSkin::Load(void) return; i = 0; - while (_tagSettings[i].szIniKey != NULL) { + while (_tagSettings[i].szIniKey != nullptr) { data = 0; data = GetPrivateProfileInt(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, _tagSettings[i].defaultval, m_tszFileName); @@ -1388,7 +1388,7 @@ void CSkin::Load(void) db_set_dw(0, SRMSGMOD_T, _tagSettings[i].szSetting, data); break; case 2: - db_set_w(NULL, SRMSGMOD_T, _tagSettings[i].szSetting, (WORD)data); + db_set_w(0, SRMSGMOD_T, _tagSettings[i].szSetting, (WORD)data); break; case 5: GetPrivateProfileString(_tagSettings[i].szIniKey, _tagSettings[i].szIniName, L"000000", @@ -1476,7 +1476,7 @@ void CSkin::Load(void) GetPrivateProfileString(L"Theme", L"File", L"None", buffer, MAX_PATH, m_tszFileName); - _wsplitpath(m_tszFileName, szDrive, szPath, NULL, NULL); + _wsplitpath(m_tszFileName, szDrive, szPath, nullptr, nullptr); mir_snwprintf(szFinalName, L"%s\\%s\\%s", szDrive, szPath, buffer); if (PathFileExists(szFinalName)) { ReadThemeFromINI(szFinalName, 0, FALSE, m_fLoadOnStartup ? 0 : M.GetByte("skin_loadmode", 0)); @@ -1523,11 +1523,11 @@ void CSkin::Load(void) void CSkin::LoadItems() { - wchar_t *szSections = NULL; + wchar_t *szSections = nullptr; wchar_t *p, *p1; TIconDesc tmpIconDesc = { 0 }; - if (m_skinIcons == NULL) + if (m_skinIcons == nullptr) m_skinIcons = (TIconDescW *)mir_calloc(sizeof(TIconDescW) * NR_MAXSKINICONS); m_nrSkinIcons = 0; @@ -2154,7 +2154,7 @@ HBITMAP CSkin::CreateAeroCompatibleBitmap(const RECT &rc, HDC dc) dib.bmiHeader.biBitCount = 32; dib.bmiHeader.biCompression = BI_RGB; - return CreateDIBSection(dc, &dib, DIB_RGB_COLORS, NULL, NULL, 0); + return CreateDIBSection(dc, &dib, DIB_RGB_COLORS, nullptr, nullptr, 0); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -2287,7 +2287,7 @@ void CTabBaseDlg::RenderToolbarBG(HDC hdc, const RECT &rcWindow) const HANDLE CSkin::InitiateBufferedPaint(const HDC hdcSrc, RECT& rc, HDC& hdcOut) { - return CMimAPI::m_pfnBeginBufferedPaint(hdcSrc, &rc, BPBF_TOPDOWNDIB, NULL, &hdcOut); + return CMimAPI::m_pfnBeginBufferedPaint(hdcSrc, &rc, BPBF_TOPDOWNDIB, nullptr, &hdcOut); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -2406,10 +2406,10 @@ void CSkin::initAeroEffect() } for (TContainerData *p = pFirstContainer; p; p = p->pNext) { - InvalidateRect(GetDlgItem(p->hwnd, IDC_MSGTABS), NULL, TRUE); - InvalidateRect(p->hwnd, NULL, TRUE); + InvalidateRect(GetDlgItem(p->hwnd, IDC_MSGTABS), nullptr, TRUE); + InvalidateRect(p->hwnd, nullptr, TRUE); if (IsWindow(GetDlgItem(p->hwnd, 5000))) - InvalidateRect(GetDlgItem(p->hwnd, 5000), NULL, TRUE); + InvalidateRect(GetDlgItem(p->hwnd, 5000), nullptr, TRUE); } } diff --git a/plugins/TabSRMM/src/translator.cpp b/plugins/TabSRMM/src/translator.cpp index 6cd89ee628..5c6122a586 100644 --- a/plugins/TabSRMM/src/translator.cpp +++ b/plugins/TabSRMM/src/translator.cpp @@ -33,7 +33,7 @@ TOptionListGroup m_lvGroupsModPlus[] = { 0, LPGENW("Message window tweaks") }, { 0, LPGENW("Display metacontact icons") }, { 0, LPGENW("Error feedback") }, - { 0, NULL } + { 0, nullptr } }; TOptionListItem m_lvItemsModPlus[] = @@ -47,7 +47,7 @@ TOptionListItem m_lvItemsModPlus[] = { 0, LPGENW("On tab control"), 1, LOI_TYPE_SETTING, (UINT_PTR)"MetaiconTab", 1 }, { 0, LPGENW("On the button bar"), 0, LOI_TYPE_SETTING, (UINT_PTR)"MetaiconBar", 1 }, { 0, LPGENW("Disable error popups on sending failures"), 0, LOI_TYPE_SETTING, (UINT_PTR)"adv_noErrorPopups", 2 }, - { 0, NULL, 0, 0, 0, 0 } + { 0, nullptr, 0, 0, 0, 0 } }; TOptionListItem m_lvItemsNEN[] = @@ -77,7 +77,7 @@ TOptionListItem m_lvItemsNEN[] = { 0, LPGENW("Remove popups for a contact when I start typing a reply"), PU_REMOVE_ON_TYPE, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.dwRemoveMask, 7 }, { 0, LPGENW("Remove popups for a contact when I send a reply"), PU_REMOVE_ON_SEND, LOI_TYPE_FLAG, (UINT_PTR)&nen_options.dwRemoveMask, 7 }, - { 0, NULL, 0, 0, 0, 0 } + { 0, nullptr, 0, 0, 0, 0 } }; TOptionListGroup m_lvGroupsNEN[] = @@ -90,7 +90,7 @@ TOptionListGroup m_lvGroupsNEN[] = { 0, LPGENW("Timeout actions (popups only)") }, { 0, LPGENW("Combine notifications for the same contact") }, { 0, LPGENW("Remove popups under following conditions") }, - { 0, NULL } + { 0, nullptr } }; TOptionListGroup m_lvGroupsMsg[] = @@ -98,7 +98,7 @@ TOptionListGroup m_lvGroupsMsg[] = { 0, LPGENW("Message window behavior") }, { 0, LPGENW("Sending messages") }, { 0, LPGENW("Other options") }, - { 0, NULL } + { 0, nullptr } }; TOptionListItem m_lvItemsMsg[] = @@ -115,7 +115,7 @@ TOptionListItem m_lvItemsMsg[] = { 0, LPGENW("Automatically split long messages (experimental, use with care)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"autosplit", 2 }, { 0, LPGENW("Log status changes"), 0, LOI_TYPE_SETTING, (UINT_PTR)"logstatuschanges", 2 }, { 0, LPGENW("Automatically copy selected text"), 1, LOI_TYPE_SETTING, (UINT_PTR)"autocopy", 2 }, - { 0, NULL, 0, 0, 0, 0 } + { 0, nullptr, 0, 0, 0, 0 } }; TOptionListGroup m_lvGroupsLog[] = @@ -124,7 +124,7 @@ TOptionListGroup m_lvGroupsLog[] = { 0, LPGENW("Support for external plugins") }, { 0, LPGENW("Timestamp settings (note: timestamps also depend on your templates)") }, { 0, LPGENW("Message log icons") }, - { 0, NULL } + { 0, nullptr } }; TOptionListItem m_lvItemsLog[] = @@ -148,7 +148,7 @@ TOptionListItem m_lvItemsLog[] = { 0, LPGENW("Underline timestamp/nickname (IEView Compatibility Mode)"), 0, LOI_TYPE_FLAG, MWF_LOG_UNDERLINE, 1 }, { 0, LPGENW("Show timestamp after nickname (IEView Compatibility Mode)"), 0, LOI_TYPE_FLAG, MWF_LOG_SWAPNICK, 1 }, { 0, LPGENW("Use normal templates (uncheck to use simple templates if your template set supports them)"), 1, LOI_TYPE_FLAG, MWF_LOG_NORMALTEMPLATES, 0 }, - { 0, NULL, 0, 0, 0, 0 } + { 0, nullptr, 0, 0, 0, 0 } }; TOptionListGroup m_lvGroupsTab[] = @@ -156,7 +156,7 @@ TOptionListGroup m_lvGroupsTab[] = { 0, LPGENW("Tab options") }, { 0, LPGENW("How to create tabs and windows for incoming messages") }, { 0, LPGENW("Miscellaneous options") }, - { 0, NULL } + { 0, nullptr } }; TOptionListItem m_lvItemsTab[] = @@ -173,7 +173,7 @@ TOptionListItem m_lvItemsTab[] = { 0, LPGENW("Close button only hides message windows"), 0, LOI_TYPE_SETTING, (UINT_PTR)"hideonclose", 2 }, { 0, LPGENW("Allow TAB key in typing area (this will disable focus selection by TAB key)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"tabmode", 2 }, { 0, LPGENW("Add offline contacts to multisend list"), 0, LOI_TYPE_SETTING, (UINT_PTR) "AllowOfflineMultisend", 2 }, - { 0, NULL, 0, 0, 0, 0 } + { 0, nullptr, 0, 0, 0, 0 } }; TOptionListItem* CTranslator::getTree(UINT id) diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index 79a03df722..cbd8e04625 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -93,9 +93,9 @@ void TSAPI CreateTrayMenus(int mode) { if (mode) { mir_snwprintf(g_eventName, L"tsr_evt_%d", GetCurrentThreadId()); - g_hEvent = CreateEvent(NULL, FALSE, FALSE, g_eventName); + g_hEvent = CreateEvent(nullptr, FALSE, FALSE, g_eventName); isAnimThreadRunning = TRUE; - hTrayAnimThread = mir_forkthread(TrayAnimThread, NULL); + hTrayAnimThread = mir_forkthread(TrayAnimThread, nullptr); PluginConfig.g_hMenuTrayUnread = CreatePopupMenu(); PluginConfig.g_hMenuFavorites = CreatePopupMenu(); @@ -194,17 +194,17 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c wchar_t szMenuEntry[80]; wchar_t szFinalNick[100]; - if (szNickname == NULL) + if (szNickname == nullptr) wcsncpy_s(szFinalNick, pcli->pfnGetContactDisplayName(hContact, 0), _TRUNCATE); else wcsncpy_s(szFinalNick, szNickname, _TRUNCATE); - if (szProto == NULL) + if (szProto == nullptr) szProto = GetContactProto(hContact); if (szProto) { if (wStatus == 0) wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); - if (szStatus == NULL) + if (szStatus == nullptr) szStatus = pcli->pfnGetStatusModeDescription(wStatus, 0); } else @@ -232,7 +232,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c } } addnew: - db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(NULL)); + db_set_dw(hContact, SRMSGMOD_T, "isRecent", time(nullptr)); AppendMenu(hMenu, MF_BYCOMMAND, (UINT_PTR)hContact, szMenuEntry); } else if (hMenu == PluginConfig.g_hMenuFavorites) { // insert the item sorted... @@ -247,7 +247,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const wchar_t *szNickname, c else { for (i = 0; i <= c; i++) { mii2.cch = 0; - mii2.dwTypeData = NULL; + mii2.dwTypeData = nullptr; GetMenuItemInfo(PluginConfig.g_hMenuFavorites, i, TRUE, &mii2); mii2.cch++; mii2.dwTypeData = szBuffer; @@ -288,12 +288,12 @@ void TSAPI LoadFavoritesAndRecent() int iIndex = 0, i, j; RCENTRY *recentEntries = new RCENTRY[nen_options.wMaxRecent + 1]; - if (recentEntries == NULL) + if (recentEntries == nullptr) return; for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (M.GetByte(hContact, "isFavorite", 0)) - AddContactToFavorites(hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuFavorites); + AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, 0, 1, PluginConfig.g_hMenuFavorites); if ((dwRecent = M.GetDword(hContact, "isRecent", 0)) != 0 && iIndex < nen_options.wMaxRecent) { recentEntries[iIndex].dwTimestamp = dwRecent; recentEntries[iIndex++].hContact = hContact; @@ -315,7 +315,7 @@ void TSAPI LoadFavoritesAndRecent() } } for (i = 0; i < iIndex; i++) - AddContactToFavorites(recentEntries[i].hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuRecent); + AddContactToFavorites(recentEntries[i].hContact, nullptr, nullptr, nullptr, 0, 0, 1, PluginConfig.g_hMenuRecent); delete[] recentEntries; } diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 23f24220a6..0e133464a3 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -2,9 +2,9 @@ HANDLE hTypingNotify; -static HGENMENU hDisableMenu = NULL; +static HGENMENU hDisableMenu = nullptr; -static MWindowList hPopupsList = NULL; +static MWindowList hPopupsList = nullptr; static BYTE OnePopup; static BYTE ShowMenu; @@ -355,8 +355,8 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]; ppd.lchContact = wParam; - ppd.PluginWindowProc = NULL; - ppd.PluginData = NULL; + ppd.PluginWindowProc = nullptr; + ppd.PluginData = nullptr; PUAddPopupT(&ppd); } } @@ -420,7 +420,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDC_TIMEOUT_VALUE: case IDC_TIMEOUT_VALUE2: - int newValue = GetDlgItemInt(hwndDlg, idCtrl, NULL, 0); + int newValue = GetDlgItemInt(hwndDlg, idCtrl, nullptr, 0); if (wNotifyCode == EN_KILLFOCUS) { int oldValue; diff --git a/plugins/TabSRMM/src/userprefs.cpp b/plugins/TabSRMM/src/userprefs.cpp index e6f1409721..77485cf76d 100644 --- a/plugins/TabSRMM/src/userprefs.cpp +++ b/plugins/TabSRMM/src/userprefs.cpp @@ -182,7 +182,7 @@ static INT_PTR CALLBACK DlgProcUserPrefs(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg, IDC_ISFAVORITE)) { if (!M.GetByte(hContact, "isFavorite", 0)) - AddContactToFavorites(hContact, NULL, NULL, NULL, 0, 0, 1, PluginConfig.g_hMenuFavorites); + AddContactToFavorites(hContact, nullptr, nullptr, nullptr, 0, 0, 1, PluginConfig.g_hMenuFavorites); } else DeleteMenu(PluginConfig.g_hMenuFavorites, hContact, MF_BYCOMMAND); @@ -343,7 +343,7 @@ static INT_PTR CALLBACK DlgProcUserPrefsLogOptions(HWND hwndDlg, UINT msg, WPARA HWND hwnd = M.FindWindow(hContact); DWORD *dwActionToTake = (DWORD *)lParam, dwMask = 0, dwFlags = 0, maskval; - CSrmmWindow *dat = NULL; + CSrmmWindow *dat = nullptr; if (hwnd) dat = (CSrmmWindow*)GetWindowLongPtr(hwnd, GWLP_USERDATA); diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 26eef54d49..e160b81b3b 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -174,7 +174,7 @@ invalid_code: // search a corresponding endmarker which fulfills the criteria INT_PTR mark = beginmark + 1; while ((endmark = message.find(endmarker, mark)) != message.npos) { - if (iswpunct(message[endmark + 1]) || iswspace(message[endmark + 1]) || message[endmark + 1] == 0 || wcschr(L"*/_", message[endmark + 1]) != NULL) + if (iswpunct(message[endmark + 1]) || iswspace(message[endmark + 1]) || message[endmark + 1] == 0 || wcschr(L"*/_", message[endmark + 1]) != nullptr) goto ok; mark = endmark + 1; } @@ -287,7 +287,7 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt BYTE xStatus = dat->m_cache->getXStatusId(); if (dat->m_wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) { ptrW szXStatus(db_get_wsa(dat->m_hContact, dat->m_szProto, "XStatusName")); - dest.Append((szXStatus != NULL) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]); + dest.Append((szXStatus != nullptr) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]); } } break; @@ -297,7 +297,7 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt BYTE xStatus = dat->m_cache->getXStatusId(); if (dat->m_wStatus != ID_STATUS_OFFLINE && xStatus > 0 && xStatus <= 31) { ptrW szXStatus(db_get_wsa(dat->m_hContact, dat->m_szProto, "XStatusName")); - dest.Append((szXStatus != NULL) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]); + dest.Append((szXStatus != nullptr) ? Trunc500(szXStatus) : xStatusDescr[xStatus - 1]); } else dest.Append(dat->m_wszStatus[0] ? dat->m_wszStatus : L"(undef)"); } @@ -318,7 +318,7 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt case 'g': { ptrW tszGroup(db_get_wsa(dat->m_hContact, "CList", "Group")); - if (tszGroup != NULL) + if (tszGroup != nullptr) dest.Append(tszGroup); } break; @@ -335,9 +335,9 @@ bool Utils::FormatTitleBar(const CTabBaseDlg *dat, const wchar_t *szFormat, CMSt char* Utils::FilterEventMarkers(char *szText) { - for (char *p = strstr(szText, "~-+"); p != NULL; p = strstr(p, "~-+")) { + for (char *p = strstr(szText, "~-+"); p != nullptr; p = strstr(p, "~-+")) { char *pEnd = strstr(p + 3, "+-~"); - if (pEnd == NULL) + if (pEnd == nullptr) break; strdel(p, (pEnd - p) + 3); @@ -348,9 +348,9 @@ char* Utils::FilterEventMarkers(char *szText) WCHAR* Utils::FilterEventMarkers(WCHAR *wszText) { - for (WCHAR *p = wcsstr(wszText, L"~-+"); p != NULL; p = wcsstr(p, L"~-+")) { + for (WCHAR *p = wcsstr(wszText, L"~-+"); p != nullptr; p = wcsstr(p, L"~-+")) { WCHAR *pEnd = wcsstr(p + 3, L"+-~"); - if (pEnd == NULL) + if (pEnd == nullptr) break; strdelw(p, (pEnd - p) + 3); @@ -622,12 +622,12 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett if (mir_wstrlen(pContainer->szRelThemeFile) > 1) { if (pContainer->fPrivateThemeChanged == TRUE) { PathToRelativeW(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath()); - db_set_ws(NULL, SRMSGMOD_T, szCName, pContainer->szAbsThemeFile); + db_set_ws(0, SRMSGMOD_T, szCName, pContainer->szAbsThemeFile); pContainer->fPrivateThemeChanged = FALSE; } } else { - ::db_unset(NULL, SRMSGMOD_T, szCName); + ::db_unset(0, SRMSGMOD_T, szCName); pContainer->fPrivateThemeChanged = FALSE; } } @@ -672,12 +672,12 @@ void Utils::scaleAvatarHeightLimited(const HBITMAP hBm, double& dNewWidth, doubl HICON Utils::iconFromAvatar(const CTabBaseDlg *dat) { - if (!ServiceExists(MS_AV_GETAVATARBITMAP) || dat == NULL) + if (!ServiceExists(MS_AV_GETAVATARBITMAP) || dat == nullptr) return 0; AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, dat->m_hContact, 0); - if (ace == NULL || ace->hbmPic == NULL) - return NULL; + if (ace == nullptr || ace->hbmPic == nullptr) + return nullptr; LONG lIconSize = Win7Taskbar->getIconSize(); double dNewWidth, dNewHeight; @@ -733,7 +733,7 @@ AVATARCACHEENTRY* Utils::loadAvatarFromAVS(const MCONTACT hContact) void Utils::sendContactMessage(MCONTACT hContact, UINT uMsg, WPARAM wParam, LPARAM lParam) { HWND h = M.FindWindow(hContact); - if (h != NULL) + if (h != nullptr) PostMessage(h, uMsg, wParam, lParam); } @@ -822,11 +822,11 @@ void Utils::showDlgControl(const HWND hwnd, UINT id, int showCmd) DWORD CALLBACK Utils::StreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG * pcb) { wchar_t *szFilename = (wchar_t*)dwCookie; - HANDLE hFile = CreateFile(szFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile(szFilename, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile != INVALID_HANDLE_VALUE) { - SetFilePointer(hFile, 0, NULL, FILE_END); + SetFilePointer(hFile, 0, nullptr, FILE_END); FilterEventMarkers((char*)pbBuff); - WriteFile(hFile, pbBuff, cb, (DWORD *)pcb, NULL); + WriteFile(hFile, pbBuff, cb, (DWORD *)pcb, nullptr); *pcb = cb; CloseHandle(hFile); return 0; @@ -854,11 +854,11 @@ bool Utils::extractResource(const HMODULE h, const UINT uID, const wchar_t *tszN if (PathFileExists(szFilename)) return true; - HANDLE hFile = CreateFile(szFilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + HANDLE hFile = CreateFile(szFilename, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (hFile == INVALID_HANDLE_VALUE) return false; - WriteFile(hFile, (void*)pData, dwSize, &written, NULL); + WriteFile(hFile, (void*)pData, dwSize, &written, nullptr); CloseHandle(hFile); } } @@ -882,7 +882,7 @@ wchar_t* Utils::extractURLFromRichEdit(const ENLINK* _e, const HWND hwndRich) tr.chrg = _e->chrg; tr.lpstrText = (wchar_t*)mir_alloc(sizeof(wchar_t) * (tr.chrg.cpMax - tr.chrg.cpMin + 8)); ::SendMessage(hwndRich, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - if (wcschr(tr.lpstrText, '@') != NULL && wcschr(tr.lpstrText, ':') == NULL && wcschr(tr.lpstrText, '/') == NULL) { + if (wcschr(tr.lpstrText, '@') != nullptr && wcschr(tr.lpstrText, ':') == nullptr && wcschr(tr.lpstrText, '/') == nullptr) { mir_wstrncpy(tr.lpstrText, L"mailto:", 7); mir_wstrncpy(tr.lpstrText + 7, tr.lpstrText, tr.chrg.cpMax - tr.chrg.cpMin + 1); } @@ -903,7 +903,7 @@ void Utils::sanitizeFilename(wchar_t* tszFilename) for (size_t i = 0; i < forbiddenCharactersLen; i++) { wchar_t* szFound = 0; - while ((szFound = wcschr(tszFilename, (int)forbiddenCharacters[i])) != NULL) + while ((szFound = wcschr(tszFilename, (int)forbiddenCharacters[i])) != nullptr) *szFound = ' '; } } @@ -981,9 +981,9 @@ LRESULT Utils::WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM wPa LRESULT result = mir_callNextSubclass(hwnd, oldWndProc, msg, wParam, lParam); ptrA szFromStream(Message_GetFromStream(hwnd, SF_TEXT | SFF_SELECTION)); - if (szFromStream != NULL) { + if (szFromStream != nullptr) { ptrW converted(mir_utf8decodeW(szFromStream)); - if (converted != NULL) { + if (converted != nullptr) { Utils::FilterEventMarkers(converted); Utils::CopyToClipBoard(converted, hwnd); } @@ -998,7 +998,7 @@ LRESULT Utils::WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM wPa void Utils::AddToFileList(wchar_t ***pppFiles, int *totalCount, LPCTSTR 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) { -- cgit v1.2.3