summaryrefslogtreecommitdiff
path: root/plugins/Nudge/src
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:03:31 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:07:33 +0100
commita7c24ca48995cf2bf436156302f96b91bf135409 (patch)
tree953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/Nudge/src
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/Nudge/src')
-rw-r--r--plugins/Nudge/src/main.cpp22
-rw-r--r--plugins/Nudge/src/options.cpp12
-rw-r--r--plugins/Nudge/src/shake.cpp24
3 files changed, 29 insertions, 29 deletions
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp
index 5c90b286ae..990546769b 100644
--- a/plugins/Nudge/src/main.cpp
+++ b/plugins/Nudge/src/main.cpp
@@ -48,7 +48,7 @@ INT_PTR NudgeShowMenu(WPARAM wParam, LPARAM lParam)
INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam)
{
char *protoName = GetContactProto(hContact);
- int diff = time(NULL) - db_get_dw(hContact, "Nudge", "LastSent", time(NULL) - 30);
+ int diff = time(nullptr) - db_get_dw(hContact, "Nudge", "LastSent", time(nullptr) - 30);
if (diff < GlobalNudge.sendTimeSec) {
wchar_t msg[500];
mir_snwprintf(msg, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"), GlobalNudge.sendTimeSec, 30 - diff);
@@ -64,7 +64,7 @@ INT_PTR NudgeSend(WPARAM hContact, LPARAM lParam)
return 0;
}
- db_set_dw(hContact, "Nudge", "LastSent", time(NULL));
+ db_set_dw(hContact, "Nudge", "LastSent", time(nullptr));
if (GlobalNudge.useByProtocol) {
for (int i = 0; i < arNudges.getCount(); i++) {
@@ -92,7 +92,7 @@ int NudgeReceived(WPARAM hContact, LPARAM lParam)
{
char *protoName = GetContactProto(hContact);
- DWORD currentTimestamp = time(NULL);
+ DWORD currentTimestamp = time(nullptr);
DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp;
int diff = currentTimestamp - db_get_dw(hContact, "Nudge", "LastReceived", currentTimestamp - 30);
@@ -248,7 +248,7 @@ static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam)
static int TabsrmmButtonInit(WPARAM, LPARAM)
{
- HOTKEYDESC hkd = { "srmm_nudge", LPGEN("Send nudge"), BB_HK_SECTION, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), LPARAM(hInst) };
+ HOTKEYDESC hkd = { "srmm_nudge", LPGEN("Send nudge"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), LPARAM(hInst) };
Hotkey_Register(&hkd);
BBButton bbd = {};
@@ -287,7 +287,7 @@ static int ContactWindowOpen(WPARAM, LPARAM lParam)
static int PrebuildContactMenu(WPARAM hContact, LPARAM)
{
char *szProto = GetContactProto(hContact);
- if (szProto != NULL) {
+ if (szProto != nullptr) {
bool isChat = db_get_b(hContact, szProto, "ChatRoom", false) != 0;
NudgeShowMenu((WPARAM)szProto, !isChat);
}
@@ -311,7 +311,7 @@ int ModulesLoaded(WPARAM, LPARAM)
int AccListChanged(WPARAM wParam, LPARAM lParam)
{
PROTOACCOUNT *proto = (PROTOACCOUNT*)wParam;
- if (proto == NULL)
+ if (proto == nullptr)
return 0;
if (lParam == PRAC_ADDED)
@@ -421,7 +421,7 @@ int Preview()
if (p.openMessageWindow)
CallService(MS_MSG_SENDMESSAGEW, hContact, NULL);
if (p.shakeChat)
- ShakeChat(hContact, (LPARAM)time(NULL));
+ ShakeChat(hContact, (LPARAM)time(nullptr));
}
}
}
@@ -437,7 +437,7 @@ int Preview()
if (DefaultNudge.openMessageWindow)
CallService(MS_MSG_SENDMESSAGEW, hContact, NULL);
if (DefaultNudge.shakeChat)
- ShakeChat(hContact, (LPARAM)time(NULL));
+ ShakeChat(hContact, (LPARAM)time(nullptr));
}
}
return 0;
@@ -472,7 +472,7 @@ void Nudge_ShowPopup(CNudgeElement*, MCONTACT hContact, wchar_t * Message)
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&NudgePopup, 0);
}
- else MessageBox(NULL, Message, lpzContactName, 0);
+ else MessageBox(nullptr, Message, lpzContactName, 0);
}
void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact)
@@ -482,7 +482,7 @@ void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact)
DBEVENTINFO dbei = {};
dbei.szModule = MODULENAME;
dbei.flags = DBEF_SENT | DBEF_UTF;
- dbei.timestamp = (DWORD)time(NULL);
+ dbei.timestamp = (DWORD)time(nullptr);
dbei.eventType = 1;
dbei.cbBlob = (DWORD)mir_strlen(buff) + 1;
dbei.pBlob = (PBYTE)buff;
@@ -508,7 +508,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto)
char str[MAXMODULELABELLENGTH + 10];
mir_snprintf(str, "%s/Nudge", proto->szModuleName);
HANDLE hevent = HookEvent(str, NudgeReceived);
- if (hevent == NULL)
+ if (hevent == nullptr)
return;
nProtocol++;
diff --git a/plugins/Nudge/src/options.cpp b/plugins/Nudge/src/options.cpp
index be47266c4b..fce6159268 100644
--- a/plugins/Nudge/src/options.cpp
+++ b/plugins/Nudge/src/options.cpp
@@ -1,6 +1,6 @@
#include "stdafx.h"
-CNudgeElement* ActualNudge = NULL;
+CNudgeElement* ActualNudge = nullptr;
static int GetSelProto(HWND hwnd, HTREEITEM hItem)
{
@@ -8,7 +8,7 @@ static int GetSelProto(HWND hwnd, HTREEITEM hItem)
TVITEM tvi = { 0 };
tvi.mask = TVIF_IMAGE;
- tvi.hItem = hItem == NULL ? TreeView_GetSelection(hLstView) : hItem;
+ tvi.hItem = hItem == nullptr ? TreeView_GetSelection(hLstView) : hItem;
TreeView_GetItem(hLstView, &tvi);
@@ -19,8 +19,8 @@ static void UpdateControls(HWND hwnd)
{
int proto = nProtocol;
if (GlobalNudge.useByProtocol) {
- proto = GetSelProto(hwnd, NULL);
- ActualNudge = NULL;
+ proto = GetSelProto(hwnd, nullptr);
+ ActualNudge = nullptr;
for (int i = 0; i < arNudges.getCount(); i++) {
CNudgeElement &p = arNudges[i];
if (p.iProtoNumber == proto)
@@ -70,7 +70,7 @@ static void CheckChange(HWND hwnd, HTREEITEM hItem)
int proto = nProtocol;
if (GlobalNudge.useByProtocol) {
proto = GetSelProto(hwnd, hItem);
- ActualNudge = NULL;
+ ActualNudge = nullptr;
for (int i = 0; i < arNudges.getCount(); i++) {
CNudgeElement &p = arNudges[i];
if (p.iProtoNumber == proto)
@@ -174,7 +174,7 @@ static void PopulateProtocolList(HWND hWnd)
TreeView_DeleteAllItems(hLstView);
- TVINSERTSTRUCT tvi = { 0 };
+ TVINSERTSTRUCT tvi = {};
tvi.hParent = TVI_ROOT;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE;
diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp
index a6a03d9acb..d66d7ad6be 100644
--- a/plugins/Nudge/src/shake.cpp
+++ b/plugins/Nudge/src/shake.cpp
@@ -37,14 +37,14 @@ INT_PTR ShakeClist(WPARAM, LPARAM)
INT_PTR ShakeChat(WPARAM wParam, LPARAM)
{
- if (((HANDLE)wParam) == NULL) return -1;
+ if (((HANDLE)wParam) == nullptr) return -1;
MessageWindowData mwd;
Srmm_GetWindowData(db_mc_tryMeta(wParam), mwd);
HWND parent;
HWND hWnd = mwd.hwndWindow;
- while ((parent = GetParent(hWnd)) != 0) hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm)
+ while ((parent = GetParent(hWnd)) != nullptr) hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm)
mir_forkthread(ShakeChatWindow, (void*)hWnd);
return 0;
@@ -57,16 +57,16 @@ int CShake::ShakeChat(HWND hWnd)
RECT rect;
GetWindowRect(hWnd, &rect);
for (int i = 0; i < nMoveChat; i++) {
- SetWindowPos(hWnd, 0, rect.left - nScaleChat, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left - nScaleChat, rect.top, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left, rect.top - nScaleChat, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top - nScaleChat, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left + nScaleChat, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left + nScaleChat, rect.top, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left, rect.top + nScaleChat, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top + nScaleChat, 0, 0, SWP_NOSIZE);
Sleep(10);
}
- SetWindowPos(hWnd, 0, rect.left, rect.top, 0, 0, SWP_NOSIZE); //SWP_DRAWFRAME
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top, 0, 0, SWP_NOSIZE); //SWP_DRAWFRAME
ShakingChat = false;
}
return 0;
@@ -79,16 +79,16 @@ int CShake::ShakeClist(HWND hWnd)
RECT rect;
GetWindowRect(hWnd, &rect);
for (int i = 0; i < nMoveClist; i++) {
- SetWindowPos(hWnd, 0, rect.left - nScaleClist, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left - nScaleClist, rect.top, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left, rect.top - nScaleClist, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top - nScaleClist, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left + nScaleClist, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left + nScaleClist, rect.top, 0, 0, SWP_NOSIZE);
Sleep(10);
- SetWindowPos(hWnd, 0, rect.left, rect.top + nScaleClist, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top + nScaleClist, 0, 0, SWP_NOSIZE);
Sleep(10);
}
- SetWindowPos(hWnd, 0, rect.left, rect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hWnd, nullptr, rect.left, rect.top, 0, 0, SWP_NOSIZE);
Shaking = false;
}
return 0;