summaryrefslogtreecommitdiff
path: root/plugins/QuickContacts
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/QuickContacts
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/QuickContacts')
-rw-r--r--plugins/QuickContacts/src/options.cpp22
-rw-r--r--plugins/QuickContacts/src/quickcontacts.cpp42
2 files changed, 32 insertions, 32 deletions
diff --git a/plugins/QuickContacts/src/options.cpp b/plugins/QuickContacts/src/options.cpp
index 1e534e6c6a..d018d6a20a 100644
--- a/plugins/QuickContacts/src/options.cpp
+++ b/plugins/QuickContacts/src/options.cpp
@@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA.
// Prototypes /////////////////////////////////////////////////////////////////////////////////////
-HANDLE hOptHook = NULL;
+HANDLE hOptHook = nullptr;
Options opts;
@@ -76,16 +76,16 @@ void DeInitOptions()
// Options page
static OptPageControl controls[] = {
- { NULL, CONTROL_CHECKBOX, IDC_LASTSENTTO, "EnableLastSentTo", (BYTE)TRUE },
- { NULL, CONTROL_RADIO, IDC_GLOBAL, "MsgTypeRec", (WORD)TYPE_GLOBAL, TYPE_GLOBAL },
- { NULL, CONTROL_RADIO, IDC_LOCAL, "MsgTypeRec", (WORD)TYPE_GLOBAL, TYPE_LOCAL },
- { NULL, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "ShowOffline%s", (BYTE)FALSE },
- { NULL, CONTROL_CHECKBOX, IDC_HIDE_OFFLINE, "HideOfflineFromOfflineProto", (BYTE)TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_APPEND_GROUP, "AppendGroupName", (BYTE)FALSE },
- { NULL, CONTROL_CHECKBOX, IDC_GROUP_COLUMN, "GroupColumn", (BYTE)FALSE },
- { NULL, CONTROL_CHECKBOX, IDC_GROUP_LEFT, "GroupColumnLeft", (BYTE)FALSE },
- { NULL, CONTROL_CHECKBOX, IDC_SUBCONTACTS, "HideSubcontacts", (BYTE)TRUE },
- { NULL, CONTROL_CHECKBOX, IDC_KEEP_OFFLINE, "KeepSubcontactsFromOffline", (BYTE)TRUE }
+ { nullptr, CONTROL_CHECKBOX, IDC_LASTSENTTO, "EnableLastSentTo", (BYTE)TRUE },
+ { nullptr, CONTROL_RADIO, IDC_GLOBAL, "MsgTypeRec", (WORD)TYPE_GLOBAL, TYPE_GLOBAL },
+ { nullptr, CONTROL_RADIO, IDC_LOCAL, "MsgTypeRec", (WORD)TYPE_GLOBAL, TYPE_LOCAL },
+ { nullptr, CONTROL_PROTOCOL_LIST, IDC_PROTOCOLS, "ShowOffline%s", (BYTE)FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_HIDE_OFFLINE, "HideOfflineFromOfflineProto", (BYTE)TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_APPEND_GROUP, "AppendGroupName", (BYTE)FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_GROUP_COLUMN, "GroupColumn", (BYTE)FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_GROUP_LEFT, "GroupColumnLeft", (BYTE)FALSE },
+ { nullptr, CONTROL_CHECKBOX, IDC_SUBCONTACTS, "HideSubcontacts", (BYTE)TRUE },
+ { nullptr, CONTROL_CHECKBOX, IDC_KEEP_OFFLINE, "KeepSubcontactsFromOffline", (BYTE)TRUE }
};
static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp
index b4e00128f5..75034af9ca 100644
--- a/plugins/QuickContacts/src/quickcontacts.cpp
+++ b/plugins/QuickContacts/src/quickcontacts.cpp
@@ -41,12 +41,12 @@ HINSTANCE hInst;
HIMAGELIST hIml;
int hLangpack = 0;
-HANDLE hModulesLoaded = NULL;
-HANDLE hEventAdded = NULL;
-HANDLE hHotkeyPressed = NULL;
+HANDLE hModulesLoaded = nullptr;
+HANDLE hEventAdded = nullptr;
+HANDLE hHotkeyPressed = nullptr;
long main_dialog_open = 0;
-HWND hwndMain = NULL;
+HWND hwndMain = nullptr;
int ModulesLoaded(WPARAM wParam, LPARAM lParam);
int EventAdded(WPARAM wparam, LPARAM lparam);
@@ -128,7 +128,7 @@ int ModulesLoaded(WPARAM, LPARAM)
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_ALT, 'Q');
Hotkey_Register(&hkd);
- hkd.pszService = NULL;
+ hkd.pszService = nullptr;
hkd.lParam = HOTKEY_FILE;
hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'F');
@@ -304,12 +304,12 @@ void SortArray(void)
}
-int GetStatus(MCONTACT hContact, char *proto = NULL)
+int GetStatus(MCONTACT hContact, char *proto = nullptr)
{
- if (proto == NULL)
+ if (proto == nullptr)
proto = GetContactProto(hContact);
- if (proto == NULL)
+ if (proto == nullptr)
return ID_STATUS_OFFLINE;
return db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
@@ -340,7 +340,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *pszProto = GetContactProto(hContact);
- if(pszProto == NULL)
+ if(pszProto == nullptr)
continue;
// Get meta
@@ -398,7 +398,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
DBVARIANT dbv;
if (db_get_ws(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
{
- if (dbv.ptszVal != NULL)
+ if (dbv.ptszVal != nullptr)
mir_wstrncpy(contact->szgroup, dbv.ptszVal, _countof(contact->szgroup));
db_free(&dbv);
@@ -410,7 +410,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all)
mir_wstrncpy(contact->szname, tmp, _countof(contact->szname));
PROTOACCOUNT *acc = Proto_GetAccount(pszProto);
- if (acc != NULL)
+ if (acc != nullptr)
mir_wstrncpy(contact->proto, acc->tszAccountName, _countof(contact->proto));
contact->hcontact = hContact;
@@ -455,7 +455,7 @@ void EnableButtons(HWND hwndDlg, MCONTACT hContact)
INT_PTR caps = 0;
char *pszProto = GetContactProto(hContact);
- if (pszProto != NULL)
+ if (pszProto != nullptr)
caps = CallProtoService(pszProto, PS_GETCAPS, PFLAGNUM_1, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), caps & PF1_IMSEND ? TRUE : FALSE);
@@ -476,7 +476,7 @@ int CheckText(HWND hdlg, wchar_t *sztext, BOOL only_enable = FALSE)
{
EnableButtons(hwndMain, NULL);
- if(sztext == NULL || sztext[0] == '\0')
+ if(sztext == nullptr || sztext[0] == '\0')
return 0;
size_t len = mir_wstrlen(sztext);
@@ -709,7 +709,7 @@ static void FillButton(HWND hwndDlg, int dlgItem, wchar_t *name, wchar_t *key, H
wchar_t tmp[256];
wchar_t *full = tmp;
- if (key == NULL)
+ if (key == nullptr)
full = TranslateW(name);
else
mir_snwprintf(tmp, L"%s (%s)", TranslateW(name), key);
@@ -725,7 +725,7 @@ static void FillCheckbox(HWND hwndDlg, int dlgItem, wchar_t *name, wchar_t *key)
wchar_t tmp[256];
wchar_t *full = tmp;
- if (key == NULL)
+ if (key == nullptr)
full = TranslateW(name);
else
mir_snwprintf(tmp, L"%s (%s)", TranslateW(name), key);
@@ -746,12 +746,12 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
CreateWindow(L"STATIC", L"", WS_CHILD | WS_VISIBLE | SS_ICON | SS_CENTERIMAGE,
rc.left - 20, rc.top + (rc.bottom - rc.top - 16) / 2, 16, 16, hwndDlg, (HMENU) IDC_ICO,
- hInst, NULL);
+ hInst, nullptr);
if (!hasNewHotkeyModule)
hAcct = LoadAccelerators(hInst, MAKEINTRESOURCE(ACCEL_TABLE));
- hHook = SetWindowsHookEx(WH_MSGFILTER, HookProc, 0, GetCurrentThreadId());
+ hHook = SetWindowsHookEx(WH_MSGFILTER, HookProc, nullptr, GetCurrentThreadId());
// Combo
SendDlgItemMessage(hwndDlg, IDC_USERNAME, EM_LIMITTEXT, (WPARAM)119, 0);
@@ -759,7 +759,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
// Buttons
FillCheckbox(hwndDlg, IDC_SHOW_ALL_CONTACTS, LPGENW("Show all contacts"), hasNewHotkeyModule ? NULL : L"Ctrl+A");
- FillButton(hwndDlg, IDC_MESSAGE, LPGENW("Send message"), NULL, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
+ FillButton(hwndDlg, IDC_MESSAGE, LPGENW("Send message"), nullptr, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
FillButton(hwndDlg, IDC_FILE, LPGENW("Send file"), hasNewHotkeyModule ? NULL : L"Ctrl+F", Skin_LoadIcon(SKINICON_EVENT_FILE));
FillButton(hwndDlg, IDC_URL, LPGENW("Send URL"), hasNewHotkeyModule ? NULL : L"Ctrl+U", Skin_LoadIcon(SKINICON_EVENT_URL));
FillButton(hwndDlg, IDC_USERINFO, LPGENW("Open user info"), hasNewHotkeyModule ? NULL : L"Ctrl+I", Skin_LoadIcon(SKINICON_OTHER_USERDETAILS));
@@ -934,7 +934,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
RECT rc;
GetWindowRect(GetDlgItem(hwndDlg, IDC_MENU), &rc);
HMENU hMenu = Menu_BuildContactMenu(hContact);
- int ret = TrackPopupMenu(hMenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, NULL);
+ int ret = TrackPopupMenu(hMenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, rc.left, rc.bottom, 0, hwndDlg, nullptr);
DestroyMenu(hMenu);
if(ret)
@@ -984,7 +984,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
case WM_DESTROY:
UnhookWindowsHookEx(hHook);
- hwndMain = NULL;
+ hwndMain = nullptr;
FreeContacts();
InterlockedExchange(&main_dialog_open, 0);
break;
@@ -1122,7 +1122,7 @@ INT_PTR ShowDialog(WPARAM, LPARAM)
{
InterlockedExchange(&main_dialog_open, 1);
- hwndMain = CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), NULL, MainDlgProc);
+ hwndMain = CreateDialog(hInst, MAKEINTRESOURCE(IDD_MAIN), nullptr, MainDlgProc);
}
// Show it