diff options
author | George Hazan <ghazan@miranda.im> | 2017-10-15 15:28:23 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-10-15 15:28:23 +0300 |
commit | cc2d5db55ce7c1d65d7919c7e7f0ce5c48da26f2 (patch) | |
tree | b23e75abe8f09cd6e45d41f078878271079dedc0 /plugins/StatusManager/src/AdvancedAutoAway | |
parent | 73c3207950044c5156bbb74ca2f60fc5b5b2d81a (diff) |
StatusManager: code cleaning
Diffstat (limited to 'plugins/StatusManager/src/AdvancedAutoAway')
3 files changed, 75 insertions, 75 deletions
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp index b18d1ef558..35834d4e75 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp @@ -74,14 +74,14 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L settings[count]->status = statusModeList[i]; DBVARIANT dbv; - if (!db_get(NULL, AAAMODULENAME, StatusModeToDbSetting(statusModeList[i], SETTING_STATUSMSG), &dbv)) { + if (!db_get(0, AAAMODULENAME, StatusModeToDbSetting(statusModeList[i], SETTING_STATUSMSG), &dbv)) { settings[count]->msg = (char*)malloc(mir_strlen(dbv.pszVal) + 1); mir_strcpy(settings[count]->msg, dbv.pszVal); db_free(&dbv); } - else settings[count]->msg = NULL; + else settings[count]->msg = nullptr; - settings[count]->useCustom = db_get_b(NULL, AAAMODULENAME, StatusModeToDbSetting(statusModeList[i], SETTING_MSGCUSTOM), FALSE); + settings[count]->useCustom = db_get_b(0, AAAMODULENAME, StatusModeToDbSetting(statusModeList[i], SETTING_MSGCUSTOM), FALSE); count += 1; } SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETCURSEL, 0, 0); @@ -113,7 +113,7 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L int i = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0); int len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0); if (last != -1) { - if (settings[last]->msg == NULL) + if (settings[last]->msg == nullptr) settings[last]->msg = (char*)malloc(len + 1); else settings[last]->msg = (char*)realloc(settings[last]->msg, len + 1); @@ -121,11 +121,11 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L } if (i != -1) { - if (settings[i]->msg != NULL) + if (settings[i]->msg != nullptr) SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, settings[i]->msg); else { ptrW msgw((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, settings[i]->status, 0)); - SetDlgItemText(hwndDlg, IDC_STATUSMSG, (msgw != NULL) ? msgw : L""); + SetDlgItemText(hwndDlg, IDC_STATUSMSG, (msgw != nullptr) ? msgw : L""); } if (settings[i]->useCustom) { @@ -156,9 +156,9 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case PSN_APPLY: SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS, CBN_SELCHANGE), 0); for (int i = 0; i < count; i++) { - db_set_b(NULL, AAAMODULENAME, StatusModeToDbSetting(settings[i]->status, SETTING_MSGCUSTOM), (BYTE)settings[i]->useCustom); - if ((settings[i]->useCustom) && (settings[i]->msg != NULL) && (settings[i]->msg[0] != '\0')) - db_set_s(NULL, AAAMODULENAME, StatusModeToDbSetting(settings[i]->status, SETTING_STATUSMSG), settings[i]->msg); + db_set_b(0, AAAMODULENAME, StatusModeToDbSetting(settings[i]->status, SETTING_MSGCUSTOM), (BYTE)settings[i]->useCustom); + if ((settings[i]->useCustom) && (settings[i]->msg != nullptr) && (settings[i]->msg[0] != '\0')) + db_set_s(0, AAAMODULENAME, StatusModeToDbSetting(settings[i]->status, SETTING_STATUSMSG), settings[i]->msg); } break; } diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp index c069b46db8..58b79a22f0 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp @@ -32,17 +32,17 @@ static int WriteAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char *protoNa { char setting[128]; mir_snprintf(setting, "%s_OptionFlags", protoName); - db_set_w(NULL, AAAMODULENAME, setting, (WORD)autoAwaySetting.optionFlags); + db_set_w(0, AAAMODULENAME, setting, (WORD)autoAwaySetting.optionFlags); mir_snprintf(setting, "%s_AwayTime", protoName); - db_set_w(NULL, AAAMODULENAME, setting, (WORD)autoAwaySetting.awayTime); + db_set_w(0, AAAMODULENAME, setting, (WORD)autoAwaySetting.awayTime); mir_snprintf(setting, "%s_NATime", protoName); - db_set_w(NULL, AAAMODULENAME, setting, (WORD)autoAwaySetting.naTime); + db_set_w(0, AAAMODULENAME, setting, (WORD)autoAwaySetting.naTime); mir_snprintf(setting, "%s_StatusFlags", protoName); - db_set_w(NULL, AAAMODULENAME, setting, (WORD)autoAwaySetting.statusFlags); + db_set_w(0, AAAMODULENAME, setting, (WORD)autoAwaySetting.statusFlags); mir_snprintf(setting, "%s_Lv1Status", protoName); - db_set_w(NULL, AAAMODULENAME, setting, (WORD)autoAwaySetting.lv1Status); + db_set_w(0, AAAMODULENAME, setting, (WORD)autoAwaySetting.lv1Status); mir_snprintf(setting, "%s_Lv2Status", protoName); - db_set_w(NULL, AAAMODULENAME, setting, (WORD)autoAwaySetting.lv2Status); + db_set_w(0, AAAMODULENAME, setting, (WORD)autoAwaySetting.lv2Status); return 0; } @@ -90,16 +90,16 @@ static TAAAProtoSetting* GetSetting(HWND hwndDlg, TAAAProtoSetting *sameSetting) int iItem = SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_GETCURSEL, 0, 0); if (iItem == -1) - return NULL; + return nullptr; INT_PTR iData = (INT_PTR)SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_GETITEMDATA, iItem, 0); - return (iData == -1) ? NULL : (TAAAProtoSetting*)iData; + return (iData == -1) ? nullptr : (TAAAProtoSetting*)iData; } static void SetDialogStatus(HWND hwndDlg, TAAAProtoSetting *sameSetting) { TAAAProtoSetting *setting = GetSetting(hwndDlg, sameSetting); - if (setting == NULL) + if (setting == nullptr) return; // create columns @@ -265,11 +265,11 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM break; case IDC_AWAYTIME: - setting->awayTime = GetDlgItemInt(hwndDlg, IDC_AWAYTIME, NULL, FALSE); + setting->awayTime = GetDlgItemInt(hwndDlg, IDC_AWAYTIME, nullptr, FALSE); break; case IDC_NATIME: - setting->naTime = GetDlgItemInt(hwndDlg, IDC_NATIME, NULL, FALSE); + setting->naTime = GetDlgItemInt(hwndDlg, IDC_NATIME, nullptr, FALSE); break; case IDC_LV2ONINACTIVE: @@ -362,19 +362,19 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - CheckDlgButton(hwndDlg, IDC_IGNLOCK, db_get_b(NULL, AAAMODULENAME, SETTING_IGNLOCK, FALSE) != 0 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_IGNSYSKEYS, db_get_b(NULL, AAAMODULENAME, SETTING_IGNSYSKEYS, FALSE) != 0 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_IGNALTCOMBO, db_get_b(NULL, AAAMODULENAME, SETTING_IGNALTCOMBO, FALSE) != 0 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MONITORMOUSE, db_get_b(NULL, AAAMODULENAME, SETTING_MONITORMOUSE, BST_CHECKED) != 0 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_MONITORKEYBOARD, db_get_b(NULL, AAAMODULENAME, SETTING_MONITORKEYBOARD, BST_CHECKED) != 0 ? BST_CHECKED : BST_UNCHECKED); - SetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, db_get_w(NULL, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5), FALSE); - SetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, db_get_w(NULL, AAAMODULENAME, SETTING_CONFIRMDELAY, 5), FALSE); + CheckDlgButton(hwndDlg, IDC_IGNLOCK, db_get_b(0, AAAMODULENAME, SETTING_IGNLOCK, FALSE) != 0 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IGNSYSKEYS, db_get_b(0, AAAMODULENAME, SETTING_IGNSYSKEYS, FALSE) != 0 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_IGNALTCOMBO, db_get_b(0, AAAMODULENAME, SETTING_IGNALTCOMBO, FALSE) != 0 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MONITORMOUSE, db_get_b(0, AAAMODULENAME, SETTING_MONITORMOUSE, BST_CHECKED) != 0 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_MONITORKEYBOARD, db_get_b(0, AAAMODULENAME, SETTING_MONITORKEYBOARD, BST_CHECKED) != 0 ? BST_CHECKED : BST_UNCHECKED); + SetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, db_get_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5), FALSE); + SetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, db_get_w(0, AAAMODULENAME, SETTING_CONFIRMDELAY, 5), FALSE); CheckDlgButton(hwndDlg, bSettingSame ? IDC_SAMESETTINGS : IDC_PERPROTOCOLSETTINGS, BST_CHECKED); - ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), db_get_b(NULL, "Idle", "AAEnable", 0)); + ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), db_get_b(0, "Idle", "AAEnable", 0)); break; case WM_SHOWWINDOW: - ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), (db_get_b(NULL, "Idle", "AAEnable", 0))); + ShowWindow(GetDlgItem(hwndDlg, IDC_IDLEWARNING), (db_get_b(0, "Idle", "AAEnable", 0))); break; case WM_COMMAND: @@ -399,14 +399,14 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY) { - db_set_b(NULL, AAAMODULENAME, SETTING_IGNLOCK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNLOCK)); - db_set_b(NULL, AAAMODULENAME, SETTING_IGNSYSKEYS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNSYSKEYS)); - db_set_b(NULL, AAAMODULENAME, SETTING_IGNALTCOMBO, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNALTCOMBO)); - db_set_b(NULL, AAAMODULENAME, SETTING_SAMESETTINGS, (BYTE)bSettingSame); - db_set_w(NULL, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, (WORD)GetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, NULL, FALSE)); - db_set_w(NULL, AAAMODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, NULL, FALSE)); - db_set_b(NULL, AAAMODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE)); - db_set_b(NULL, AAAMODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD)); + db_set_b(0, AAAMODULENAME, SETTING_IGNLOCK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNLOCK)); + db_set_b(0, AAAMODULENAME, SETTING_IGNSYSKEYS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNSYSKEYS)); + db_set_b(0, AAAMODULENAME, SETTING_IGNALTCOMBO, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNALTCOMBO)); + db_set_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, (BYTE)bSettingSame); + db_set_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, (WORD)GetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, nullptr, FALSE)); + db_set_w(0, AAAMODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, nullptr, FALSE)); + db_set_b(0, AAAMODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE)); + db_set_b(0, AAAMODULENAME, SETTING_MONITORKEYBOARD, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORKEYBOARD)); AAALoadOptions(autoAwaySettings, FALSE); } break; @@ -424,7 +424,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayTabs(HWND hwndDlg, UINT msg, WPARAM, LPAR TranslateDialogDefault(hwndDlg); { RECT rcTabs, rcOptions, rcPage; - bSettingSame = db_get_b(NULL, AAAMODULENAME, SETTING_SAMESETTINGS, FALSE); + bSettingSame = db_get_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, FALSE); // set tabs int tabCount = 0; diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp index c15fc40239..71805df1c1 100644 --- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp @@ -37,7 +37,7 @@ TAAAProtoSetting::TAAAProtoSetting(PROTOACCOUNT *pa) m_szName = pa->szModuleName; m_tszAccName = pa->tszAccountName; m_lastStatus = m_status = originalStatusMode = ID_STATUS_CURRENT; - m_szMsg = NULL; + m_szMsg = nullptr; curState = ACTIVE; mStatus = FALSE; } @@ -49,7 +49,7 @@ TAAAProtoSetting::~TAAAProtoSetting() ///////////////////////////////////////////////////////////////////////////////////////// -HANDLE hStateChangedEvent = NULL; +HANDLE hStateChangedEvent = nullptr; static BOOL ignoreLockKeys = FALSE; static BOOL ignoreSysKeys = FALSE; @@ -58,13 +58,13 @@ static BOOL monitorMouse = TRUE; static BOOL monitorKeyboard = TRUE; static HWND confirmDialog; static int mouseStationaryTimer; -HHOOK hMirandaMouseHook = NULL; -HHOOK hMirandaKeyBoardHook = NULL; +HHOOK hMirandaMouseHook = nullptr; +HHOOK hMirandaKeyBoardHook = nullptr; #pragma data_seg("Shared") DWORD lastInput = 0; POINT lastMousePos = { 0 }; -HHOOK hMouseHook = NULL; -HHOOK hKeyBoardHook = NULL; +HHOOK hMouseHook = nullptr; +HHOOK hKeyBoardHook = nullptr; #pragma data_seg() #pragma comment(linker, "/section:Shared,rws") DWORD lastMirandaInput = 0; @@ -95,18 +95,18 @@ void AAALoadOptions(TAAAProtoSettingList &loadSettings, BOOL override) if (!override) UnhookWindowsHooks(); if (hAutoAwayTimer != 0) - KillTimer(NULL, hAutoAwayTimer); + KillTimer(nullptr, hAutoAwayTimer); - ignoreLockKeys = db_get_b(NULL, AAAMODULENAME, SETTING_IGNLOCK, FALSE); - ignoreSysKeys = db_get_b(NULL, AAAMODULENAME, SETTING_IGNSYSKEYS, FALSE); - ignoreAltCombo = db_get_b(NULL, AAAMODULENAME, SETTING_IGNALTCOMBO, FALSE); - monitorMouse = db_get_b(NULL, AAAMODULENAME, SETTING_MONITORMOUSE, TRUE); - monitorKeyboard = db_get_b(NULL, AAAMODULENAME, SETTING_MONITORKEYBOARD, TRUE); + ignoreLockKeys = db_get_b(0, AAAMODULENAME, SETTING_IGNLOCK, FALSE); + ignoreSysKeys = db_get_b(0, AAAMODULENAME, SETTING_IGNSYSKEYS, FALSE); + ignoreAltCombo = db_get_b(0, AAAMODULENAME, SETTING_IGNALTCOMBO, FALSE); + monitorMouse = db_get_b(0, AAAMODULENAME, SETTING_MONITORMOUSE, TRUE); + monitorKeyboard = db_get_b(0, AAAMODULENAME, SETTING_MONITORKEYBOARD, TRUE); lastInput = lastMirandaInput = GetTickCount(); for (int i = 0; i < loadSettings.getCount(); i++) { char* protoName; - if ((db_get_b(NULL, AAAMODULENAME, SETTING_SAMESETTINGS, 0)) && !override) + if ((db_get_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, 0)) && !override) protoName = SETTING_ALL; else protoName = loadSettings[i].m_szName; @@ -119,34 +119,34 @@ void AAALoadOptions(TAAAProtoSettingList &loadSettings, BOOL override) } } - if (db_get_b(NULL, "Idle", "AAEnable", 0)) + if (db_get_b(0, "Idle", "AAEnable", 0)) return; HookWindowsHooks(monitorMiranda, monitorAll); - hAutoAwayTimer = SetTimer(NULL, 0, db_get_w(NULL, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5) * 1000, AutoAwayTimer); + hAutoAwayTimer = SetTimer(nullptr, 0, db_get_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5) * 1000, AutoAwayTimer); } int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char* protoName) { char setting[128]; mir_snprintf(setting, "%s_OptionFlags", protoName); - autoAwaySetting.optionFlags = db_get_w(NULL, AAAMODULENAME, setting, FLAG_LV2ONINACTIVE | FLAG_RESET); + autoAwaySetting.optionFlags = db_get_w(0, AAAMODULENAME, setting, FLAG_LV2ONINACTIVE | FLAG_RESET); mir_snprintf(setting, "%s_AwayTime", protoName); - autoAwaySetting.awayTime = db_get_w(NULL, AAAMODULENAME, setting, SETTING_AWAYTIME_DEFAULT); + autoAwaySetting.awayTime = db_get_w(0, AAAMODULENAME, setting, SETTING_AWAYTIME_DEFAULT); mir_snprintf(setting, "%s_NATime", protoName); - autoAwaySetting.naTime = db_get_w(NULL, AAAMODULENAME, setting, SETTING_NATIME_DEFAULT); + autoAwaySetting.naTime = db_get_w(0, AAAMODULENAME, setting, SETTING_NATIME_DEFAULT); mir_snprintf(setting, "%s_StatusFlags", protoName); - autoAwaySetting.statusFlags = db_get_w(NULL, AAAMODULENAME, setting, StatusModeToProtoFlag(ID_STATUS_ONLINE) | StatusModeToProtoFlag(ID_STATUS_FREECHAT)); + autoAwaySetting.statusFlags = db_get_w(0, AAAMODULENAME, setting, StatusModeToProtoFlag(ID_STATUS_ONLINE) | StatusModeToProtoFlag(ID_STATUS_FREECHAT)); int flags; - if (db_get_b(NULL, AAAMODULENAME, SETTING_SAMESETTINGS, 0)) + if (db_get_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, 0)) flags = 0xFFFFFF; else flags = CallProtoService(protoName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(protoName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0); mir_snprintf(setting, "%s_Lv1Status", protoName); - autoAwaySetting.lv1Status = db_get_w(NULL, AAAMODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_AWAY)) ? ID_STATUS_AWAY : ID_STATUS_OFFLINE); + autoAwaySetting.lv1Status = db_get_w(0, AAAMODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_AWAY)) ? ID_STATUS_AWAY : ID_STATUS_OFFLINE); mir_snprintf(setting, "%s_Lv2Status", protoName); - autoAwaySetting.lv2Status = db_get_w(NULL, AAAMODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_NA)) ? ID_STATUS_NA : ID_STATUS_OFFLINE); + autoAwaySetting.lv2Status = db_get_w(0, AAAMODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_NA)) ? ID_STATUS_NA : ID_STATUS_OFFLINE); return 0; } @@ -222,22 +222,22 @@ static int changeState(TAAAProtoSetting &setting, STATES newState) NotifyEventHooks(hStateChangedEvent, 0, (LPARAM)&setting); if (setting.curState != SET_ORGSTATUS && setting.curState != ACTIVE && setting.statusChanged) { /* change the awaymessage */ - if (setting.m_szMsg != NULL) { + if (setting.m_szMsg != nullptr) { free(setting.m_szMsg); - setting.m_szMsg = NULL; + setting.m_szMsg = nullptr; } - if (db_get_b(NULL, AAAMODULENAME, StatusModeToDbSetting(setting.m_status, SETTING_MSGCUSTOM), FALSE)) { + if (db_get_b(0, AAAMODULENAME, StatusModeToDbSetting(setting.m_status, SETTING_MSGCUSTOM), FALSE)) { DBVARIANT dbv; - if (!db_get_ws(NULL, AAAMODULENAME, StatusModeToDbSetting(setting.m_status, SETTING_STATUSMSG), &dbv)) { + if (!db_get_ws(0, AAAMODULENAME, StatusModeToDbSetting(setting.m_status, SETTING_STATUSMSG), &dbv)) { setting.m_szMsg = wcsdup(dbv.ptszVal); db_free(&dbv); } } } - else if (setting.m_szMsg != NULL) { + else if (setting.m_szMsg != nullptr) { free(setting.m_szMsg); - setting.m_szMsg = NULL; + setting.m_szMsg = nullptr; } return 0; @@ -370,7 +370,7 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) } if (confirm) - confirmDialog = ShowConfirmDialogEx((TProtoSettings*)&ps, db_get_w(NULL, AAAMODULENAME, SETTING_CONFIRMDELAY, 5)); + confirmDialog = ShowConfirmDialogEx((TProtoSettings*)&ps, db_get_w(0, AAAMODULENAME, SETTING_CONFIRMDELAY, 5)); else if (statusChanged) CallService(MS_CS_SETSTATUSEX, (WPARAM)&ps, 0); } @@ -382,15 +382,15 @@ static VOID CALLBACK AutoAwayTimer(HWND, UINT, UINT_PTR, DWORD) static int HookWindowsHooks(int hookMiranda, int hookAll) { if (hookMiranda) { - if (monitorKeyboard && hMirandaKeyBoardHook == NULL) - hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, MirandaKeyBoardHookFunction, NULL, GetCurrentThreadId()); - if (monitorMouse && hMirandaMouseHook == NULL) - hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE, MirandaMouseHookFunction, NULL, GetCurrentThreadId()); + if (monitorKeyboard && hMirandaKeyBoardHook == nullptr) + hMirandaKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, MirandaKeyBoardHookFunction, nullptr, GetCurrentThreadId()); + if (monitorMouse && hMirandaMouseHook == nullptr) + hMirandaMouseHook = SetWindowsHookEx(WH_MOUSE, MirandaMouseHookFunction, nullptr, GetCurrentThreadId()); } if (hookAll) { - if (monitorKeyboard && hKeyBoardHook == NULL) + if (monitorKeyboard && hKeyBoardHook == nullptr) hKeyBoardHook = SetWindowsHookEx(WH_KEYBOARD, KeyBoardHookFunction, 0, GetCurrentThreadId()); - if (monitorMouse && hMouseHook == NULL) + if (monitorMouse && hMouseHook == nullptr) hMouseHook = SetWindowsHookEx(WH_MOUSE, MouseHookFunction, 0, GetCurrentThreadId()); } @@ -404,7 +404,7 @@ static int UnhookWindowsHooks() UnhookWindowsHookEx(hMirandaMouseHook); UnhookWindowsHookEx(hMirandaKeyBoardHook); - hMouseHook = hKeyBoardHook = hMirandaMouseHook = hMirandaKeyBoardHook = NULL; + hMouseHook = hKeyBoardHook = hMirandaMouseHook = hMirandaKeyBoardHook = nullptr; return 0; } @@ -539,7 +539,7 @@ static LRESULT CALLBACK KeyBoardHookFunction(int code, WPARAM wParam, LPARAM lPa static int AutoAwayShutdown(WPARAM, LPARAM) { - KillTimer(NULL, hAutoAwayTimer); + KillTimer(nullptr, hAutoAwayTimer); #ifdef TRIGGERPLUGIN DeInitTrigger(); |