summaryrefslogtreecommitdiff
path: root/plugins/StatusManager/src/StartupStatus
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-10-15 15:28:23 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-10-15 15:28:23 +0300
commitcc2d5db55ce7c1d65d7919c7e7f0ce5c48da26f2 (patch)
treeb23e75abe8f09cd6e45d41f078878271079dedc0 /plugins/StatusManager/src/StartupStatus
parent73c3207950044c5156bbb74ca2f60fc5b5b2d81a (diff)
StatusManager: code cleaning
Diffstat (limited to 'plugins/StatusManager/src/StartupStatus')
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_options.cpp196
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_profiles.cpp68
-rw-r--r--plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp14
-rw-r--r--plugins/StatusManager/src/StartupStatus/startupstatus.cpp116
4 files changed, 197 insertions, 197 deletions
diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
index 9229f901b0..0629485f15 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_options.cpp
@@ -33,8 +33,8 @@ TSettingsList* GetCurrentProtoSettings()
Proto_EnumAccounts(&count, &protos);
TSettingsList *result = new TSettingsList(count, SSCompareSettings);
- if (result == NULL)
- return NULL;
+ if (result == nullptr)
+ return nullptr;
for (int i = 0; i < count; i++)
if (IsSuitableProto(protos[i]))
@@ -66,8 +66,8 @@ static char* GetStatusDesc(int status)
static char* GetCMDLArguments(TSettingsList& protoSettings)
{
- if (protoSettings.getCount() == NULL)
- return NULL;
+ if (protoSettings.getCount() == 0)
+ return nullptr;
char *cmdl, *pnt;
pnt = cmdl = (char*)malloc(mir_strlen(protoSettings[0].m_szName) + mir_strlen(GetStatusDesc(protoSettings[0].m_status)) + 4);
@@ -87,7 +87,7 @@ static char* GetCMDLArguments(TSettingsList& protoSettings)
}
}
- if (db_get_b(NULL, SSMODULENAME, SETTING_SHOWDIALOG, FALSE) == TRUE) {
+ if (db_get_b(0, SSMODULENAME, SETTING_SHOWDIALOG, FALSE) == TRUE) {
*pnt++ = ' ';
*pnt++ = '\0';
cmdl = (char*)realloc(cmdl, mir_strlen(cmdl) + 12);
@@ -103,7 +103,7 @@ static char* GetCMDLArguments(TSettingsList& protoSettings)
static char* GetCMDL(TSettingsList& protoSettings)
{
char path[MAX_PATH];
- GetModuleFileNameA(NULL, path, MAX_PATH);
+ GetModuleFileNameA(nullptr, path, MAX_PATH);
char* cmdl = (char*)malloc(mir_strlen(path) + 4);
mir_snprintf(cmdl, mir_strlen(path) + 4, "\"%s\" ", path);
@@ -123,7 +123,7 @@ static char* GetCMDL(TSettingsList& protoSettings)
static wchar_t* GetLinkDescription(TSettingsList& protoSettings)
{
if (protoSettings.getCount() == 0)
- return NULL;
+ return nullptr;
CMStringW result(SHORTCUT_DESC);
for (int i = 0; i < protoSettings.getCount(); i++) {
@@ -137,8 +137,8 @@ static wchar_t* GetLinkDescription(TSettingsList& protoSettings)
else if (p.m_status >= MIN_STATUS && p.m_status <= MAX_STATUS)
status = pcli->pfnGetStatusModeDescription(p.m_status, 0);
else
- status = NULL;
- if (status == NULL)
+ status = nullptr;
+ if (status == nullptr)
status = TranslateT("<unknown>");
result.AppendChar('\r');
@@ -154,14 +154,14 @@ static wchar_t* GetLinkDescription(TSettingsList& protoSettings)
HRESULT CreateLink(TSettingsList& protoSettings)
{
wchar_t savePath[MAX_PATH];
- if (SHGetSpecialFolderPath(NULL, savePath, 0x10, FALSE))
+ if (SHGetSpecialFolderPath(nullptr, savePath, 0x10, FALSE))
wcsncat_s(savePath, SHORTCUT_FILENAME, _countof(savePath) - mir_wstrlen(savePath));
else
mir_snwprintf(savePath, L".\\%s", SHORTCUT_FILENAME);
// Get a pointer to the IShellLink interface.
IShellLink *psl;
- HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
+ HRESULT hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
if (SUCCEEDED(hres)) {
char *args = GetCMDLArguments(protoSettings);
wchar_t *desc = GetLinkDescription(protoSettings);
@@ -169,7 +169,7 @@ HRESULT CreateLink(TSettingsList& protoSettings)
// Set the path to the shortcut target, and add the
// description.
wchar_t path[MAX_PATH];
- GetModuleFileName(NULL, path, _countof(path));
+ GetModuleFileName(nullptr, path, _countof(path));
psl->SetPath(path);
psl->SetDescription(desc);
psl->SetArguments(_A2T(args));
@@ -216,7 +216,7 @@ INT_PTR CALLBACK CmdlOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
char cmdl[2048];
GetDlgItemTextA(hwndDlg, IDC_CMDL, cmdl, _countof(cmdl));
HGLOBAL cmdlGlob = GlobalAlloc(GMEM_MOVEABLE, sizeof(cmdl));
- if (cmdlGlob == NULL) {
+ if (cmdlGlob == nullptr) {
CloseClipboard();
break;
}
@@ -259,24 +259,24 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
bInitDone = FALSE;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SETPROFILE, db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_OVERRIDE, db_get_b(NULL, SSMODULENAME, SETTING_OVERRIDE, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWDIALOG, db_get_b(NULL, SSMODULENAME, SETTING_SHOWDIALOG, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SETWINSTATE, db_get_b(NULL, SSMODULENAME, SETTING_SETWINSTATE, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SETWINLOCATION, db_get_b(NULL, SSMODULENAME, SETTING_SETWINLOCATION, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SETDOCKED, db_get_b(NULL, SSMODULENAME, SETTING_SETDOCKED, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SETWINSIZE, db_get_b(NULL, SSMODULENAME, SETTING_SETWINSIZE, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_OFFLINECLOSE, db_get_b(NULL, SSMODULENAME, SETTING_OFFLINECLOSE, 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTODIAL, db_get_b(NULL, SSMODULENAME, SETTING_AUTODIAL, 0) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AUTOHANGUP, db_get_b(NULL, SSMODULENAME, SETTING_AUTOHANGUP, 0) ? BST_CHECKED : BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, db_get_dw(NULL, SSMODULENAME, SETTING_SETPROFILEDELAY, 500), FALSE);
- SetDlgItemInt(hwndDlg, IDC_DLGTIMEOUT, db_get_dw(NULL, SSMODULENAME, SETTING_DLGTIMEOUT, 5), FALSE);
- SetDlgItemInt(hwndDlg, IDC_XPOS, db_get_dw(NULL, SSMODULENAME, SETTING_XPOS, 0), TRUE);
- SetDlgItemInt(hwndDlg, IDC_YPOS, db_get_dw(NULL, SSMODULENAME, SETTING_YPOS, 0), TRUE);
- SetDlgItemInt(hwndDlg, IDC_WIDTH, db_get_dw(NULL, SSMODULENAME, SETTING_WIDTH, 0), FALSE);
- SetDlgItemInt(hwndDlg, IDC_HEIGHT, db_get_dw(NULL, SSMODULENAME, SETTING_HEIGHT, 0), FALSE);
+ CheckDlgButton(hwndDlg, IDC_SETPROFILE, db_get_b(0, SSMODULENAME, SETTING_SETPROFILE, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OVERRIDE, db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWDIALOG, db_get_b(0, SSMODULENAME, SETTING_SHOWDIALOG, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SETWINSTATE, db_get_b(0, SSMODULENAME, SETTING_SETWINSTATE, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SETWINLOCATION, db_get_b(0, SSMODULENAME, SETTING_SETWINLOCATION, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SETDOCKED, db_get_b(0, SSMODULENAME, SETTING_SETDOCKED, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SETWINSIZE, db_get_b(0, SSMODULENAME, SETTING_SETWINSIZE, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_OFFLINECLOSE, db_get_b(0, SSMODULENAME, SETTING_OFFLINECLOSE, 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTODIAL, db_get_b(0, SSMODULENAME, SETTING_AUTODIAL, 0) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AUTOHANGUP, db_get_b(0, SSMODULENAME, SETTING_AUTOHANGUP, 0) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, db_get_dw(0, SSMODULENAME, SETTING_SETPROFILEDELAY, 500), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_DLGTIMEOUT, db_get_dw(0, SSMODULENAME, SETTING_DLGTIMEOUT, 5), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_XPOS, db_get_dw(0, SSMODULENAME, SETTING_XPOS, 0), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_YPOS, db_get_dw(0, SSMODULENAME, SETTING_YPOS, 0), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_WIDTH, db_get_dw(0, SSMODULENAME, SETTING_WIDTH, 0), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_HEIGHT, db_get_dw(0, SSMODULENAME, SETTING_HEIGHT, 0), FALSE);
{
- int val = db_get_b(NULL, SSMODULENAME, SETTING_DOCKED, DOCKED_NONE);
+ int val = db_get_b(0, SSMODULENAME, SETTING_DOCKED, DOCKED_NONE);
int item = SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_SETITEMDATA, (WPARAM)item, (LPARAM)DOCKED_LEFT);
if (val == DOCKED_LEFT)
@@ -304,7 +304,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
SendMessage(hwndDlg, UM_REINITDOCKED, 0, 0);
SendMessage(hwndDlg, UM_REINITWINSTATE, 0, 0);
SendMessage(hwndDlg, UM_REINITWINSIZE, 0, 0);
- SetTimer(hwndDlg, 0, 100, NULL);
+ SetTimer(hwndDlg, 0, 100, nullptr);
bInitDone = TRUE;
break;
@@ -317,13 +317,13 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
else {
wchar_t text[128];
mir_snwprintf(text, TranslateT("size: %d x %d"),
- db_get_dw(NULL, MODULE_CLIST, SETTING_WIDTH, 0),
- db_get_dw(NULL, MODULE_CLIST, SETTING_HEIGHT, 0));
+ db_get_dw(0, MODULE_CLIST, SETTING_WIDTH, 0),
+ db_get_dw(0, MODULE_CLIST, SETTING_HEIGHT, 0));
SetDlgItemText(hwndDlg, IDC_CURWINSIZE, text);
mir_snwprintf(text, TranslateT("loc: %d x %d"),
- db_get_dw(NULL, MODULE_CLIST, SETTING_XPOS, 0),
- db_get_dw(NULL, MODULE_CLIST, SETTING_YPOS, 0));
+ db_get_dw(0, MODULE_CLIST, SETTING_XPOS, 0),
+ db_get_dw(0, MODULE_CLIST, SETTING_YPOS, 0));
SetDlgItemText(hwndDlg, IDC_CURWINLOC, text);
}
break;
@@ -347,7 +347,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
break;
case UM_REINITDOCKED:
- EnableWindow(GetDlgItem(hwndDlg, IDC_SETDOCKED), db_get_b(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 1));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETDOCKED), db_get_b(0, MODULE_CLIST, SETTING_TOOLWINDOW, 1));
if (!IsWindowEnabled(GetDlgItem(hwndDlg, IDC_SETDOCKED)))
CheckDlgButton(hwndDlg, IDC_SETDOCKED, BST_UNCHECKED);
@@ -356,7 +356,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
case UM_REINITWINSTATE:
{
- int val = db_get_b(NULL, SSMODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
+ int val = db_get_b(0, SSMODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_RESETCONTENT, 0, 0);
int item = SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Hidden"));
@@ -364,7 +364,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
if (val == SETTING_STATE_HIDDEN)
SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETCURSEL, item, 0);
- if (!db_get_b(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0)) {
+ if (!db_get_b(0, MODULE_CLIST, SETTING_TOOLWINDOW, 0)) {
item = SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Minimized"));
SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETITEMDATA, item, SETTING_STATE_MINIMIZED);
if (val == SETTING_STATE_MINIMIZED)
@@ -372,14 +372,14 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
}
item = SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Normal"));
SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETITEMDATA, item, SETTING_STATE_NORMAL);
- if (val == SETTING_STATE_NORMAL || (val == SETTING_STATE_MINIMIZED) && db_get_b(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0))
+ if (val == SETTING_STATE_NORMAL || (val == SETTING_STATE_MINIMIZED) && db_get_b(0, MODULE_CLIST, SETTING_TOOLWINDOW, 0))
SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETCURSEL, item, 0);
}
break;
case UM_REINITWINSIZE:
EnableWindow(GetDlgItem(hwndDlg, IDC_WIDTH), IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_HEIGHT), !db_get_b(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0) && IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_HEIGHT), !db_get_b(0, MODULE_CLUI, SETTING_AUTOSIZE, 0) && IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == LBN_SELCHANGE || HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == EN_CHANGE)
@@ -418,7 +418,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
if (ps) {
GetProfile(defProfile, *ps);
for (int i = 0; i < ps->getCount(); i++)
- if ((*ps)[i].m_szMsg != NULL)
+ if ((*ps)[i].m_szMsg != nullptr)
(*ps)[i].m_szMsg = wcsdup((*ps)[i].m_szMsg);
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CMDLOPTIONS), hwndDlg, CmdlOptionsDlgProc, (LPARAM)ps);
@@ -444,45 +444,45 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg, UINT msg, WPARAM w
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
int val;
- db_set_b(NULL, SSMODULENAME, SETTING_SETPROFILE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE));
+ db_set_b(0, SSMODULENAME, SETTING_SETPROFILE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE));
if (IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE))
- db_set_dw(NULL, SSMODULENAME, SETTING_SETPROFILEDELAY, GetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, NULL, FALSE));
+ db_set_dw(0, SSMODULENAME, SETTING_SETPROFILEDELAY, GetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, nullptr, FALSE));
if (IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE) || IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG)) {
val = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0);
- db_set_w(NULL, SSMODULENAME, SETTING_DEFAULTPROFILE, (WORD)val);
+ db_set_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, (WORD)val);
}
- db_set_b(NULL, SSMODULENAME, SETTING_OVERRIDE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE));
- db_set_b(NULL, SSMODULENAME, SETTING_SHOWDIALOG, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG));
+ db_set_b(0, SSMODULENAME, SETTING_OVERRIDE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE));
+ db_set_b(0, SSMODULENAME, SETTING_SHOWDIALOG, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG));
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG))
- db_set_dw(NULL, SSMODULENAME, SETTING_DLGTIMEOUT, GetDlgItemInt(hwndDlg, IDC_DLGTIMEOUT, NULL, FALSE));
+ db_set_dw(0, SSMODULENAME, SETTING_DLGTIMEOUT, GetDlgItemInt(hwndDlg, IDC_DLGTIMEOUT, nullptr, FALSE));
- db_set_b(NULL, SSMODULENAME, SETTING_SETWINSTATE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSTATE));
+ db_set_b(0, SSMODULENAME, SETTING_SETWINSTATE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSTATE));
if (IsDlgButtonChecked(hwndDlg, IDC_SETWINSTATE)) {
val = (int)SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_GETCURSEL, 0, 0), 0);
- db_set_b(NULL, SSMODULENAME, SETTING_WINSTATE, (BYTE)val);
+ db_set_b(0, SSMODULENAME, SETTING_WINSTATE, (BYTE)val);
}
- db_set_b(NULL, SSMODULENAME, SETTING_SETDOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETDOCKED));
+ db_set_b(0, SSMODULENAME, SETTING_SETDOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETDOCKED));
if (IsDlgButtonChecked(hwndDlg, IDC_SETDOCKED)) {
val = (int)SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_GETCURSEL, 0, 0), 0);
- db_set_b(NULL, SSMODULENAME, SETTING_DOCKED, (BYTE)val);
+ db_set_b(0, SSMODULENAME, SETTING_DOCKED, (BYTE)val);
}
- db_set_b(NULL, SSMODULENAME, SETTING_SETWINLOCATION, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINLOCATION));
+ db_set_b(0, SSMODULENAME, SETTING_SETWINLOCATION, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINLOCATION));
if (IsDlgButtonChecked(hwndDlg, IDC_SETWINLOCATION)) {
- db_set_dw(NULL, SSMODULENAME, SETTING_XPOS, GetDlgItemInt(hwndDlg, IDC_XPOS, NULL, TRUE));
- db_set_dw(NULL, SSMODULENAME, SETTING_YPOS, GetDlgItemInt(hwndDlg, IDC_YPOS, NULL, TRUE));
+ db_set_dw(0, SSMODULENAME, SETTING_XPOS, GetDlgItemInt(hwndDlg, IDC_XPOS, nullptr, TRUE));
+ db_set_dw(0, SSMODULENAME, SETTING_YPOS, GetDlgItemInt(hwndDlg, IDC_YPOS, nullptr, TRUE));
}
- db_set_b(NULL, SSMODULENAME, SETTING_SETWINSIZE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
+ db_set_b(0, SSMODULENAME, SETTING_SETWINSIZE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
if (IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE)) {
- db_set_dw(NULL, SSMODULENAME, SETTING_WIDTH, GetDlgItemInt(hwndDlg, IDC_WIDTH, NULL, FALSE));
- db_set_dw(NULL, SSMODULENAME, SETTING_HEIGHT, GetDlgItemInt(hwndDlg, IDC_HEIGHT, NULL, FALSE));
+ db_set_dw(0, SSMODULENAME, SETTING_WIDTH, GetDlgItemInt(hwndDlg, IDC_WIDTH, nullptr, FALSE));
+ db_set_dw(0, SSMODULENAME, SETTING_HEIGHT, GetDlgItemInt(hwndDlg, IDC_HEIGHT, nullptr, FALSE));
}
- db_set_b(NULL, SSMODULENAME, SETTING_OFFLINECLOSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OFFLINECLOSE));
- db_set_b(NULL, SSMODULENAME, SETTING_AUTODIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTODIAL));
- db_set_b(NULL, SSMODULENAME, SETTING_AUTOHANGUP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHANGUP));
+ db_set_b(0, SSMODULENAME, SETTING_OFFLINECLOSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OFFLINECLOSE));
+ db_set_b(0, SSMODULENAME, SETTING_AUTODIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTODIAL));
+ db_set_b(0, SSMODULENAME, SETTING_AUTOHANGUP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHANGUP));
}
break;
}
@@ -503,16 +503,16 @@ static int DeleteSetting(const char *szSetting, LPARAM lParam)
static int ClearDatabase(char* filter)
{
LIST<char> arSettings(10);
- db_enum_settings(NULL, DeleteSetting, SSMODULENAME, &arSettings);
+ db_enum_settings(0, DeleteSetting, SSMODULENAME, &arSettings);
for (int i = 0; i < arSettings.getCount(); i++) {
- if ((filter == NULL) || (!strncmp(filter, arSettings[i], mir_strlen(filter))))
- db_unset(NULL, SSMODULENAME, arSettings[i]);
+ if ((filter == nullptr) || (!strncmp(filter, arSettings[i], mir_strlen(filter))))
+ db_unset(0, SSMODULENAME, arSettings[i]);
mir_free(arSettings[i]);
}
- if (filter == NULL)
- db_unset(NULL, "AutoAway", "Confirm");
+ if (filter == nullptr)
+ db_unset(0, "AutoAway", "Confirm");
return 0;
}
@@ -588,26 +588,26 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
}
else {
for (int j = 0; j < ar.getCount(); j++)
- if (ar[j].m_szMsg != NULL)
+ if (ar[j].m_szMsg != nullptr)
ar[j].m_szMsg = wcsdup(ar[j].m_szMsg);
- ppo->tszName = db_get_wsa(NULL, SSMODULENAME, OptName(i, SETTING_PROFILENAME));
- if (ppo->tszName == NULL) {
+ ppo->tszName = db_get_wsa(0, SSMODULENAME, OptName(i, SETTING_PROFILENAME));
+ if (ppo->tszName == nullptr) {
if (i == defProfile)
ppo->tszName = mir_wstrdup(TranslateT("default"));
else
ppo->tszName = mir_wstrdup(TranslateT("unknown"));
}
- ppo->createTtb = db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_CREATETTBBUTTON), 0);
- ppo->showDialog = db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), 0);
- ppo->createMmi = db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_CREATEMMITEM), 0);
- ppo->inSubMenu = db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_INSUBMENU), 1);
- ppo->regHotkey = db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_REGHOTKEY), 0);
- ppo->hotKey = db_get_w(NULL, SSMODULENAME, OptName(i, SETTING_HOTKEY), MAKEWORD((char)('0' + i), HOTKEYF_CONTROL | HOTKEYF_SHIFT));
+ ppo->createTtb = db_get_b(0, SSMODULENAME, OptName(i, SETTING_CREATETTBBUTTON), 0);
+ ppo->showDialog = db_get_b(0, SSMODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), 0);
+ ppo->createMmi = db_get_b(0, SSMODULENAME, OptName(i, SETTING_CREATEMMITEM), 0);
+ ppo->inSubMenu = db_get_b(0, SSMODULENAME, OptName(i, SETTING_INSUBMENU), 1);
+ ppo->regHotkey = db_get_b(0, SSMODULENAME, OptName(i, SETTING_REGHOTKEY), 0);
+ ppo->hotKey = db_get_w(0, SSMODULENAME, OptName(i, SETTING_HOTKEY), MAKEWORD((char)('0' + i), HOTKEYF_CONTROL | HOTKEYF_SHIFT));
}
arProfiles.insert(ppo);
}
- if (hTTBModuleLoadedHook == NULL)
+ if (hTTBModuleLoadedHook == nullptr)
EnableWindow(GetDlgItem(hwndDlg, IDC_CREATETTB), FALSE);
SendMessage(hwndDlg, UM_REINITPROFILES, 0, 0);
@@ -697,8 +697,8 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
if (idx != -1) {
TSSSetting* ps = (TSSSetting*)SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, LB_GETITEMDATA, idx, 0);
- CheckRadioButton(hwndDlg, IDC_MIRANDAMSG, IDC_CUSTOMMSG, ps->m_szMsg != NULL ? IDC_CUSTOMMSG : IDC_MIRANDAMSG);
- if (ps->m_szMsg != NULL)
+ CheckRadioButton(hwndDlg, IDC_MIRANDAMSG, IDC_CUSTOMMSG, ps->m_szMsg != nullptr ? IDC_CUSTOMMSG : IDC_MIRANDAMSG);
+ if (ps->m_szMsg != nullptr)
SetDlgItemText(hwndDlg, IDC_STATUSMSG, ps->m_szMsg);
bStatusMsg = ((((CallProtoService(ps->m_szName, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_MODEMSGSEND&~PF1_INDIVMODEMSG)) &&
@@ -714,7 +714,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
case UM_ADDPROFILE:
{
wchar_t *tszName = (wchar_t*)lParam;
- if (tszName == NULL)
+ if (tszName == nullptr)
break;
PROFILEOPTIONS* ppo = new PROFILEOPTIONS;
@@ -731,7 +731,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
int i = (int)wParam;
if (arProfiles.getCount() == 1) {
- MessageBox(NULL, TranslateT("At least one profile must exist"), TranslateT("Status manager"), MB_OK);
+ MessageBox(nullptr, TranslateT("At least one profile must exist"), TranslateT("Status manager"), MB_OK);
break;
}
@@ -740,8 +740,8 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
int defProfile;
GetProfileCount((WPARAM)&defProfile, 0);
if (i == defProfile) {
- MessageBox(NULL, TranslateT("Your default profile will be changed"), TranslateT("Status manager"), MB_OK);
- db_set_w(NULL, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
+ MessageBox(nullptr, TranslateT("Your default profile will be changed"), TranslateT("Status manager"), MB_OK);
+ db_set_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
}
SendMessage(hwndDlg, UM_REINITPROFILES, 0, 0);
break;
@@ -785,10 +785,10 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
int len;
TSSSetting* ps = (TSSSetting*)SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, LB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, LB_GETCURSEL, 0, 0), 0);
- if (ps->m_szMsg != NULL)
+ if (ps->m_szMsg != nullptr)
free(ps->m_szMsg);
- ps->m_szMsg = NULL;
+ ps->m_szMsg = nullptr;
if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOMMSG)) {
len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0);
ps->m_szMsg = (wchar_t*)calloc(sizeof(wchar_t), len + 1);
@@ -804,10 +804,10 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
// but it works
TSSSetting* ps = (TSSSetting*)SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, LB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, LB_GETCURSEL, 0, 0), 0);
- if (ps->m_szMsg != NULL) {
+ if (ps->m_szMsg != nullptr) {
if (*ps->m_szMsg)
free(ps->m_szMsg);
- ps->m_szMsg = NULL;
+ ps->m_szMsg = nullptr;
}
int len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0);
ps->m_szMsg = (wchar_t*)calloc(sizeof(wchar_t), len + 1);
@@ -857,7 +857,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
break;
case IDC_VARIABLESHELP:
- variables_showhelp(hwndDlg, IDC_STATUSMSG, VHF_INPUT | VHF_EXTRATEXT | VHF_HELP | VHF_FULLFILLSTRUCT | VHF_HIDESUBJECTTOKEN, NULL, "Protocol ID");
+ variables_showhelp(hwndDlg, IDC_STATUSMSG, VHF_INPUT | VHF_EXTRATEXT | VHF_HELP | VHF_FULLFILLSTRUCT | VHF_HIDESUBJECTTOKEN, nullptr, "Protocol ID");
break;
}
break;
@@ -865,31 +865,31 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
char setting[128];
- int oldCount = db_get_w(NULL, SSMODULENAME, SETTING_PROFILECOUNT, 0);
+ int oldCount = db_get_w(0, SSMODULENAME, SETTING_PROFILECOUNT, 0);
for (int i = 0; i < oldCount; i++) {
mir_snprintf(setting, "%d_", i);
ClearDatabase(setting);
}
for (int i = 0; i < arProfiles.getCount(); i++) {
PROFILEOPTIONS& po = arProfiles[i];
- db_set_b(NULL, SSMODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), po.showDialog);
- db_set_b(NULL, SSMODULENAME, OptName(i, SETTING_CREATETTBBUTTON), po.createTtb);
- db_set_b(NULL, SSMODULENAME, OptName(i, SETTING_CREATEMMITEM), po.createMmi);
- db_set_b(NULL, SSMODULENAME, OptName(i, SETTING_INSUBMENU), po.inSubMenu);
- db_set_b(NULL, SSMODULENAME, OptName(i, SETTING_REGHOTKEY), po.regHotkey);
- db_set_w(NULL, SSMODULENAME, OptName(i, SETTING_HOTKEY), po.hotKey);
- db_set_ws(NULL, SSMODULENAME, OptName(i, SETTING_PROFILENAME), po.tszName);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), po.showDialog);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_CREATETTBBUTTON), po.createTtb);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_CREATEMMITEM), po.createMmi);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_INSUBMENU), po.inSubMenu);
+ db_set_b(0, SSMODULENAME, OptName(i, SETTING_REGHOTKEY), po.regHotkey);
+ db_set_w(0, SSMODULENAME, OptName(i, SETTING_HOTKEY), po.hotKey);
+ db_set_ws(0, SSMODULENAME, OptName(i, SETTING_PROFILENAME), po.tszName);
TSettingsList& ar = *po.ps;
for (int j = 0; j < ar.getCount(); j++) {
- if (ar[j].m_szMsg != NULL) {
+ if (ar[j].m_szMsg != nullptr) {
mir_snprintf(setting, "%s_%s", ar[j].m_szName, SETTING_PROFILE_STSMSG);
- db_set_ws(NULL, SSMODULENAME, OptName(i, setting), ar[j].m_szMsg);
+ db_set_ws(0, SSMODULENAME, OptName(i, setting), ar[j].m_szMsg);
}
- db_set_w(NULL, SSMODULENAME, OptName(i, ar[j].m_szName), ar[j].m_status);
+ db_set_w(0, SSMODULENAME, OptName(i, ar[j].m_szName), ar[j].m_status);
}
}
- db_set_w(NULL, SSMODULENAME, SETTING_PROFILECOUNT, (WORD)arProfiles.getCount());
+ db_set_w(0, SSMODULENAME, SETTING_PROFILECOUNT, (WORD)arProfiles.getCount());
// Rebuild status menu
if (bNeedRebuildMenu)
diff --git a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
index ba056510f5..05fa484306 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
@@ -27,19 +27,19 @@ extern int protoCount;
static int menuprofiles[MAX_MMITEMS];
static int mcount = 0;
-static PROFILECE *pce = NULL;
+static PROFILECE *pce = nullptr;
static int pceCount = 0;
static UINT_PTR releaseTtbTimerId = 0;
static HANDLE hTBModuleLoadedHook;
-static HANDLE hMessageHook = NULL;
+static HANDLE hMessageHook = nullptr;
-static HWND hMessageWindow = NULL;
-static HKINFO *hkInfo = NULL;
+static HWND hMessageWindow = nullptr;
+static HKINFO *hkInfo = nullptr;
static int hkiCount = 0;
-static HANDLE* ttbButtons = NULL;
+static HANDLE* ttbButtons = nullptr;
static int ttbButtonCount = 0;
HANDLE hTTBModuleLoadedHook;
@@ -59,10 +59,10 @@ static int CreateMainMenuItems(WPARAM, LPARAM)
int count = GetProfileCount(0, 0);
for (int i = 0; i < count && mcount < MAX_MMITEMS; i++) {
wchar_t profilename[128];
- if (!db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename))
+ if (!db_get_b(0, SSMODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename))
continue;
- if (db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_INSUBMENU), 1) && !mi.root) {
+ if (db_get_b(0, SSMODULENAME, OptName(i, SETTING_INSUBMENU), 1) && !mi.root) {
mi.root = Menu_CreateRoot(MO_STATUS, LPGENW("Status profiles"), 2000100000);
Menu_ConfigureItem(mi.root, MCI_OPT_UID, "1AB30D51-BABA-4B27-9288-1A12278BAD8D");
}
@@ -87,9 +87,9 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
{
int profile = (int)wParam;
if (profile < 0) // get default profile
- profile = db_get_w(NULL, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
+ profile = db_get_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
- int count = db_get_w(NULL, SSMODULENAME, SETTING_PROFILECOUNT, 0);
+ int count = db_get_w(0, SSMODULENAME, SETTING_PROFILECOUNT, 0);
if (profile >= count && count > 0)
return -1;
@@ -102,7 +102,7 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
DBVARIANT dbv;
char setting[80];
mir_snprintf(setting, "%d_%s", profile, SETTING_PROFILENAME);
- if (db_get_ws(NULL, SSMODULENAME, setting, &dbv))
+ if (db_get_ws(0, SSMODULENAME, setting, &dbv))
return -1;
wcsncpy(buf, dbv.ptszVal, 128 - 1); buf[127] = 0;
@@ -113,9 +113,9 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
INT_PTR GetProfileCount(WPARAM wParam, LPARAM)
{
int *def = (int*)wParam;
- int count = db_get_w(NULL, SSMODULENAME, SETTING_PROFILECOUNT, 1);
+ int count = db_get_w(0, SSMODULENAME, SETTING_PROFILECOUNT, 1);
if (def != 0) {
- *def = db_get_w(NULL, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
+ *def = db_get_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
if (*def >= count)
*def = 0;
}
@@ -131,31 +131,31 @@ wchar_t *GetStatusMessage(int profile, char *szProto)
for (int i = 0; i < pceCount; i++) {
if ((pce[i].profile == profile) && (!mir_strcmp(pce[i].szProto, szProto))) {
mir_snprintf(dbSetting, "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
- if (!db_get_ws(NULL, SSMODULENAME, dbSetting, &dbv)) { // reload from db
+ if (!db_get_ws(0, SSMODULENAME, dbSetting, &dbv)) { // reload from db
pce[i].msg = (wchar_t*)realloc(pce[i].msg, sizeof(wchar_t)*(mir_wstrlen(dbv.ptszVal) + 1));
- if (pce[i].msg != NULL) {
+ if (pce[i].msg != nullptr) {
mir_wstrcpy(pce[i].msg, dbv.ptszVal);
}
db_free(&dbv);
}
else {
- if (pce[i].msg != NULL) {
+ if (pce[i].msg != nullptr) {
free(pce[i].msg);
- pce[i].msg = NULL;
+ pce[i].msg = nullptr;
}
}
return pce[i].msg;
}
}
pce = (PROFILECE*)realloc(pce, (pceCount + 1)*sizeof(PROFILECE));
- if (pce == NULL)
- return NULL;
+ if (pce == nullptr)
+ return nullptr;
pce[pceCount].profile = profile;
pce[pceCount].szProto = _strdup(szProto);
- pce[pceCount].msg = NULL;
+ pce[pceCount].msg = nullptr;
mir_snprintf(dbSetting, "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
- if (!db_get_ws(NULL, SSMODULENAME, dbSetting, &dbv)) {
+ if (!db_get_ws(0, SSMODULENAME, dbSetting, &dbv)) {
pce[pceCount].msg = wcsdup(dbv.ptszVal);
db_free(&dbv);
}
@@ -167,9 +167,9 @@ wchar_t *GetStatusMessage(int profile, char *szProto)
int GetProfile(int profile, TSettingsList& arSettings)
{
if (profile < 0) // get default profile
- profile = db_get_w(NULL, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
+ profile = db_get_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
- int count = db_get_w(NULL, SSMODULENAME, SETTING_PROFILECOUNT, 0);
+ int count = db_get_w(0, SSMODULENAME, SETTING_PROFILECOUNT, 0);
if (profile >= count && count > 0)
return -1;
@@ -188,7 +188,7 @@ int GetProfile(int profile, TSettingsList& arSettings)
static void CALLBACK releaseTtbTimerFunction(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(NULL, releaseTtbTimerId);
+ KillTimer(nullptr, releaseTtbTimerId);
for (int i = 0; i < ttbButtonCount; i++)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)ttbButtons[i], 0);
}
@@ -199,19 +199,19 @@ INT_PTR LoadAndSetProfile(WPARAM iProfileNo, LPARAM)
int profile = (int)iProfileNo;
TSettingsList profileSettings(10, SSCompareSettings);
if (!GetProfile(profile, profileSettings)) {
- profile = (profile >= 0) ? profile : db_get_w(NULL, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
+ profile = (profile >= 0) ? profile : db_get_w(0, SSMODULENAME, SETTING_DEFAULTPROFILE, 0);
char setting[64];
mir_snprintf(setting, "%d_%s", profile, SETTING_SHOWCONFIRMDIALOG);
- if (!db_get_b(NULL, SSMODULENAME, setting, 0))
+ if (!db_get_b(0, SSMODULENAME, setting, 0))
CallService(MS_CS_SETSTATUSEX, (WPARAM)&profileSettings, 0);
else
- ShowConfirmDialogEx((TProtoSettings*)&profileSettings, db_get_dw(NULL, SSMODULENAME, SETTING_DLGTIMEOUT, 5));
+ ShowConfirmDialogEx((TProtoSettings*)&profileSettings, db_get_dw(0, SSMODULENAME, SETTING_DLGTIMEOUT, 5));
}
// add timer here
if (hTTBModuleLoadedHook)
- releaseTtbTimerId = SetTimer(NULL, 0, 100, releaseTtbTimerFunction);
+ releaseTtbTimerId = SetTimer(nullptr, 0, 100, releaseTtbTimerFunction);
return 0;
}
@@ -244,7 +244,7 @@ static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM)
static int UnregisterHotKeys()
{
- if (hkInfo != NULL) {
+ if (hkInfo != nullptr) {
for (int i = 0; i < hkiCount; i++) {
UnregisterHotKey(hMessageWindow, (int)hkInfo[i].id);
GlobalDeleteAtom(hkInfo[i].id);
@@ -254,8 +254,8 @@ static int UnregisterHotKeys()
DestroyWindow(hMessageWindow);
hkiCount = 0;
- hkInfo = NULL;
- hMessageWindow = NULL;
+ hkInfo = nullptr;
+ hMessageWindow = nullptr;
return 0;
}
@@ -263,17 +263,17 @@ static int UnregisterHotKeys()
// assumes UnregisterHotKeys was called before
static int RegisterHotKeys()
{
- hMessageWindow = CreateWindowEx(0, L"STATIC", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+ hMessageWindow = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc);
int count = GetProfileCount(0, 0);
for (int i = 0; i < count; i++) {
- if (!db_get_b(NULL, SSMODULENAME, OptName(i, SETTING_REGHOTKEY), 0))
+ if (!db_get_b(0, SSMODULENAME, OptName(i, SETTING_REGHOTKEY), 0))
continue;
- WORD wHotKey = db_get_w(NULL, SSMODULENAME, OptName(i, SETTING_HOTKEY), 0);
+ WORD wHotKey = db_get_w(0, SSMODULENAME, OptName(i, SETTING_HOTKEY), 0);
hkInfo = (HKINFO*)realloc(hkInfo, (hkiCount + 1)*sizeof(HKINFO));
- if (hkInfo == NULL)
+ if (hkInfo == nullptr)
return -1;
char atomname[255];
diff --git a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
index e9d153670a..e80f19f2a4 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
+++ b/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
@@ -23,7 +23,7 @@
static LIST<void> ttbButtons(1);
-static IconItem iconList[] =
+static IconItem iconList[] =
{
{ LPGEN("Pressed toolbar icon"), "StartupStatus/TtbDown", IDI_TTBDOWN },
{ LPGEN("Released toolbar icon"), "StartupStatus/TtbUp", IDI_TTBUP },
@@ -33,14 +33,14 @@ static IconItem iconList[] =
void RemoveTopToolbarButtons()
{
- for (int i=ttbButtons.getCount()-1; i >= 0; i--)
+ for (int i = ttbButtons.getCount() - 1; i >= 0; i--)
CallService(MS_TTB_REMOVEBUTTON, (WPARAM)ttbButtons[i], 0);
ttbButtons.destroy();
}
int CreateTopToolbarButtons(WPARAM, LPARAM)
{
- if (iconList[0].hIcolib == NULL)
+ if (iconList[0].hIcolib == nullptr)
Icon_Register(hInst, "Toolbar/StartupStatus", iconList, _countof(iconList));
int profileCount = CallService(MS_SS_GETPROFILECOUNT, 0, 0);
@@ -48,15 +48,15 @@ int CreateTopToolbarButtons(WPARAM, LPARAM)
TTBButton ttb = { 0 };
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP;
ttb.pszService = MS_SS_LOADANDSETPROFILE;
- for (int i=0; i < profileCount; i++) {
+ for (int i = 0; i < profileCount; i++) {
char setting[80];
mir_snprintf(setting, "%d_%s", i, SETTING_CREATETTBBUTTON);
- if (!db_get_b(NULL, SSMODULENAME, setting, FALSE))
+ if (!db_get_b(0, SSMODULENAME, setting, FALSE))
continue;
-
+
DBVARIANT dbv;
mir_snprintf(setting, "%d_%s", i, SETTING_PROFILENAME);
- if (db_get(NULL, SSMODULENAME, setting, &dbv))
+ if (db_get(0, SSMODULENAME, setting, &dbv))
continue;
ttb.hIconHandleDn = iconList[0].hIcolib;
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
index fb2b87ea0f..0f02b2065d 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
@@ -28,7 +28,7 @@ TSSSetting::TSSSetting(PROTOACCOUNT *pa)
m_szName = pa->szModuleName;
m_tszAccName = pa->tszAccountName;
m_status = m_lastStatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
- m_szMsg = NULL;
+ m_szMsg = nullptr;
}
TSSSetting::TSSSetting(int profile, PROTOACCOUNT *pa)
@@ -40,14 +40,14 @@ TSSSetting::TSSSetting(int profile, PROTOACCOUNT *pa)
// load status
char setting[80];
mir_snprintf(setting, "%d_%s", profile, pa->szModuleName);
- int iStatus = db_get_w(NULL, SSMODULENAME, setting, 0);
+ int iStatus = db_get_w(0, SSMODULENAME, setting, 0);
if (iStatus < MIN_STATUS || iStatus > MAX_STATUS)
iStatus = DEFAULT_STATUS;
m_status = iStatus;
// load last status
mir_snprintf(setting, "%s%s", PREFIX_LAST, m_szName);
- iStatus = db_get_w(NULL, SSMODULENAME, setting, 0);
+ iStatus = db_get_w(0, SSMODULENAME, setting, 0);
if (iStatus < MIN_STATUS || iStatus > MAX_STATUS)
iStatus = DEFAULT_STATUS;
m_lastStatus = iStatus;
@@ -79,7 +79,7 @@ static PROTOCOLSETTINGEX* IsValidProtocol(TSettingsList& protoSettings, char* pr
if (!strncmp(protoSettings[i].m_szName, protoName, mir_strlen(protoSettings[i].m_szName)))
return &protoSettings[i];
- return NULL;
+ return nullptr;
}
static int IsValidStatusDesc(char* statusDesc)
@@ -133,7 +133,7 @@ static void ProcessCommandLineOptions(TSettingsList& protoSettings)
}
char *protoName = cmdl; // first protocol ?
PROTOCOLSETTINGEX* protoSetting = IsValidProtocol(protoSettings, protoName);
- if (protoSetting != NULL) {
+ if (protoSetting != nullptr) {
while (*cmdl != '=') {
if (*cmdl == '\0')
return;
@@ -163,7 +163,7 @@ static void SetLastStatusMessages(TSettingsList &ps)
mir_snprintf(dbSetting, "%s%s", PREFIX_LASTMSG, ps[i].m_szName);
DBVARIANT dbv;
- if (ps[i].m_szMsg == NULL && !db_get_ws(NULL, SSMODULENAME, dbSetting, &dbv)) {
+ if (ps[i].m_szMsg == nullptr && !db_get_ws(0, SSMODULENAME, dbSetting, &dbv)) {
ps[i].m_szMsg = wcsdup(dbv.ptszVal); // remember this won't be freed
db_free(&dbv);
}
@@ -202,7 +202,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
if (ack->type != ACKTYPE_STATUS && ack->result != ACKRESULT_FAILED)
return 0;
- if (!db_get_b(NULL, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
+ if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
return 0;
for (int i = 0; i < startupSettings.getCount(); i++) {
@@ -218,11 +218,11 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam)
static int StatusChange(WPARAM, LPARAM lParam)
{
// change by menu
- if (!db_get_b(NULL, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
+ if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
return 0;
char *szProto = (char *)lParam;
- if (szProto == NULL) { // global status change
+ if (szProto == nullptr) { // global status change
for (int i = 0; i < startupSettings.getCount(); i++) {
startupSettings[i].m_szName = "";
log_debugA("StartupStatus: all protos overridden by ME_CLIST_STATUSMODECHANGE, status will not be set");
@@ -243,17 +243,17 @@ static int StatusChange(WPARAM, LPARAM lParam)
static int CSStatusChangeEx(WPARAM wParam, LPARAM)
{
// another status plugin made the change
- if (!db_get_b(NULL, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
+ if (!db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0)
return 0;
if (wParam != 0) {
PROTOCOLSETTINGEX** ps = *(PROTOCOLSETTINGEX***)wParam;
- if (ps == NULL)
+ if (ps == nullptr)
return -1;
for (int i = 0; i < startupSettings.getCount(); i++) {
for (int j = 0; j < startupSettings.getCount(); j++) {
- if (ps[i]->m_szName == NULL || startupSettings[j].m_szName == NULL)
+ if (ps[i]->m_szName == nullptr || startupSettings[j].m_szName == nullptr)
continue;
if (!mir_strcmp(ps[i]->m_szName, startupSettings[j].m_szName)) {
@@ -270,7 +270,7 @@ static int CSStatusChangeEx(WPARAM wParam, LPARAM)
static void CALLBACK SetStatusTimed(HWND, UINT, UINT_PTR, DWORD)
{
- KillTimer(NULL, setStatusTimerId);
+ KillTimer(nullptr, setStatusTimerId);
UnhookEvent(hProtoAckHook);
UnhookEvent(hCSStatusChangeHook);
UnhookEvent(hStatusChangeHook);
@@ -294,9 +294,9 @@ static int OnOkToExit(WPARAM, LPARAM)
char lastName[128], lastMsg[128];
mir_snprintf(lastName, "%s%s", PREFIX_LAST, pa->szModuleName);
- db_set_w(NULL, SSMODULENAME, lastName, (WORD)CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0));
+ db_set_w(0, SSMODULENAME, lastName, (WORD)CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0));
mir_snprintf(lastMsg, "%s%s", PREFIX_LASTMSG, pa->szModuleName);
- db_unset(NULL, SSMODULENAME, lastMsg);
+ db_unset(0, SSMODULENAME, lastMsg);
if (!(CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG))
continue;
@@ -310,19 +310,19 @@ static int OnOkToExit(WPARAM, LPARAM)
NAS_PROTOINFO npi = { sizeof(npi) };
npi.szProto = pa->szModuleName;
CallService(MS_NAS_GETSTATE, (WPARAM)&npi, 1);
- if (npi.szMsg == NULL) {
+ if (npi.szMsg == nullptr) {
npi.status = 0;
- npi.szProto = NULL;
+ npi.szProto = nullptr;
CallService(MS_NAS_GETSTATE, (WPARAM)&npi, 1);
}
- if (npi.szMsg != NULL) {
- db_set_ws(NULL, SSMODULENAME, lastMsg, npi.tszMsg);
+ if (npi.szMsg != nullptr) {
+ db_set_ws(0, SSMODULENAME, lastMsg, npi.tszMsg);
mir_free(npi.tszMsg);
}
}
}
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1) || db_get_b(NULL, SSMODULENAME, SETTING_OFFLINECLOSE, 0))
+ if (db_get_b(0, SSMODULENAME, SETTING_SETPROFILE, 1) || db_get_b(0, SSMODULENAME, SETTING_OFFLINECLOSE, 0))
Clist_SetStatusMode(ID_STATUS_OFFLINE);
return 0;
@@ -331,8 +331,8 @@ static int OnOkToExit(WPARAM, LPARAM)
static int OnShutdown(WPARAM, LPARAM)
{
// set windowstate and docked for next startup
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETWINSTATE, 0)) {
- int state = db_get_b(NULL, SSMODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
+ if (db_get_b(0, SSMODULENAME, SETTING_SETWINSTATE, 0)) {
+ int state = db_get_b(0, SSMODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
HWND hClist = pcli->hwndContactList;
BOOL isHidden = !IsWindowVisible(hClist);
switch (state) {
@@ -343,7 +343,7 @@ static int OnShutdown(WPARAM, LPARAM)
break;
case SETTING_STATE_MINIMIZED:
- if (!db_get_b(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0))
+ if (!db_get_b(0, MODULE_CLIST, SETTING_TOOLWINDOW, 0))
ShowWindow(hClist, SW_SHOWMINIMIZED);
break;
@@ -356,13 +356,13 @@ static int OnShutdown(WPARAM, LPARAM)
}
// hangup
- if (db_get_b(NULL, SSMODULENAME, SETTING_AUTOHANGUP, 0))
+ if (db_get_b(0, SSMODULENAME, SETTING_AUTOHANGUP, 0))
InternetAutodialHangup(0);
- int state = db_get_b(NULL, SSMODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
+ int state = db_get_b(0, SSMODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
// set windowstate and docked for next startup
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETWINSTATE, 0))
- db_set_b(NULL, MODULE_CLIST, SETTING_WINSTATE, (BYTE)state);
+ if (db_get_b(0, SSMODULENAME, SETTING_SETWINSTATE, 0))
+ db_set_b(0, MODULE_CLIST, SETTING_WINSTATE, (BYTE)state);
if (hMessageWindow)
DestroyWindow(hMessageWindow);
@@ -401,7 +401,7 @@ int SSModuleLoaded(WPARAM, LPARAM)
HookEvent(ME_SYSTEM_OKTOEXIT, OnOkToExit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnShutdown);
/* message window for poweroff */
- hMessageWindow = CreateWindowEx(0, L"STATIC", NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
+ hMessageWindow = CreateWindowEx(0, L"STATIC", nullptr, 0, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr);
SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc);
GetProfile(-1, startupSettings);
@@ -412,39 +412,39 @@ int SSModuleLoaded(WPARAM, LPARAM)
return 0;// no protocols are loaded
SetLastStatusMessages(startupSettings);
- showDialogOnStartup = (showDialogOnStartup || db_get_b(NULL, SSMODULENAME, SETTING_SHOWDIALOG, 0));
+ showDialogOnStartup = (showDialogOnStartup || db_get_b(0, SSMODULENAME, SETTING_SHOWDIALOG, 0));
// dial
- if (showDialogOnStartup || db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1))
- if (db_get_b(NULL, SSMODULENAME, SETTING_AUTODIAL, 0))
- InternetAutodial(0, NULL);
+ if (showDialogOnStartup || db_get_b(0, SSMODULENAME, SETTING_SETPROFILE, 1))
+ if (db_get_b(0, SSMODULENAME, SETTING_AUTODIAL, 0))
+ InternetAutodial(0, nullptr);
// set the status!
- if (showDialogOnStartup || db_get_b(NULL, SSMODULENAME, SETTING_SHOWDIALOG, 0))
- ShowConfirmDialogEx((TProtoSettings*)&startupSettings, db_get_dw(NULL, SSMODULENAME, SETTING_DLGTIMEOUT, 5));
- else if (db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1)) {
+ if (showDialogOnStartup || db_get_b(0, SSMODULENAME, SETTING_SHOWDIALOG, 0))
+ ShowConfirmDialogEx((TProtoSettings*)&startupSettings, db_get_dw(0, SSMODULENAME, SETTING_DLGTIMEOUT, 5));
+ else if (db_get_b(0, SSMODULENAME, SETTING_SETPROFILE, 1)) {
// set hooks for override
- if (db_get_b(NULL, SSMODULENAME, SETTING_OVERRIDE, 1)) {
+ if (db_get_b(0, SSMODULENAME, SETTING_OVERRIDE, 1)) {
hProtoAckHook = HookEvent(ME_PROTO_ACK, ProcessProtoAck);
hCSStatusChangeHook = HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChangeEx);
hStatusChangeHook = HookEvent(ME_CLIST_STATUSMODECHANGE, StatusChange);
}
- setStatusTimerId = SetTimer(NULL, 0, db_get_dw(NULL, SSMODULENAME, SETTING_SETPROFILEDELAY, 500), SetStatusTimed);
+ setStatusTimerId = SetTimer(nullptr, 0, db_get_dw(0, SSMODULENAME, SETTING_SETPROFILEDELAY, 500), SetStatusTimed);
}
// win size and location
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETWINLOCATION, 0) || db_get_b(NULL, SSMODULENAME, SETTING_SETWINSIZE, 0)) {
+ if (db_get_b(0, SSMODULENAME, SETTING_SETWINLOCATION, 0) || db_get_b(0, SSMODULENAME, SETTING_SETWINSIZE, 0)) {
HWND hClist = pcli->hwndContactList;
// store in db
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETWINLOCATION, 0)) {
- db_set_dw(NULL, MODULE_CLIST, SETTING_XPOS, db_get_dw(NULL, SSMODULENAME, SETTING_XPOS, 0));
- db_set_dw(NULL, MODULE_CLIST, SETTING_YPOS, db_get_dw(NULL, SSMODULENAME, SETTING_YPOS, 0));
+ if (db_get_b(0, SSMODULENAME, SETTING_SETWINLOCATION, 0)) {
+ db_set_dw(0, MODULE_CLIST, SETTING_XPOS, db_get_dw(0, SSMODULENAME, SETTING_XPOS, 0));
+ db_set_dw(0, MODULE_CLIST, SETTING_YPOS, db_get_dw(0, SSMODULENAME, SETTING_YPOS, 0));
}
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETWINSIZE, 0)) {
- db_set_dw(NULL, MODULE_CLIST, SETTING_WIDTH, db_get_dw(NULL, SSMODULENAME, SETTING_WIDTH, 0));
- if (!db_get_b(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0))
- db_set_dw(NULL, MODULE_CLIST, SETTING_HEIGHT, db_get_dw(NULL, SSMODULENAME, SETTING_HEIGHT, 0));
+ if (db_get_b(0, SSMODULENAME, SETTING_SETWINSIZE, 0)) {
+ db_set_dw(0, MODULE_CLIST, SETTING_WIDTH, db_get_dw(0, SSMODULENAME, SETTING_WIDTH, 0));
+ if (!db_get_b(0, MODULE_CLUI, SETTING_AUTOSIZE, 0))
+ db_set_dw(0, MODULE_CLIST, SETTING_HEIGHT, db_get_dw(0, SSMODULENAME, SETTING_HEIGHT, 0));
}
WINDOWPLACEMENT wndpl = { sizeof(wndpl) };
@@ -456,14 +456,14 @@ int SSModuleLoaded(WPARAM, LPARAM)
int y = rc.top;
int width = rc.right - rc.left;
int height = rc.bottom - rc.top;
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETWINLOCATION, 0)) {
- x = db_get_dw(NULL, SSMODULENAME, SETTING_XPOS, x);
- y = db_get_dw(NULL, SSMODULENAME, SETTING_YPOS, y);
+ if (db_get_b(0, SSMODULENAME, SETTING_SETWINLOCATION, 0)) {
+ x = db_get_dw(0, SSMODULENAME, SETTING_XPOS, x);
+ y = db_get_dw(0, SSMODULENAME, SETTING_YPOS, y);
}
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETWINSIZE, 0)) {
- width = db_get_dw(NULL, SSMODULENAME, SETTING_WIDTH, width);
- if (!db_get_b(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0))
- height = db_get_dw(NULL, SSMODULENAME, SETTING_HEIGHT, height);
+ if (db_get_b(0, SSMODULENAME, SETTING_SETWINSIZE, 0)) {
+ width = db_get_dw(0, SSMODULENAME, SETTING_WIDTH, width);
+ if (!db_get_b(0, MODULE_CLUI, SETTING_AUTOSIZE, 0))
+ height = db_get_dw(0, SSMODULENAME, SETTING_HEIGHT, height);
}
MoveWindow(hClist, x, y, width, height, TRUE);
}
@@ -483,17 +483,17 @@ void StartupStatusLoad()
{
HookEvent(ME_SYSTEM_MODULESLOADED, SSModuleLoaded);
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETPROFILE, 1) ||
- db_get_b(NULL, SSMODULENAME, SETTING_OFFLINECLOSE, 0))
- db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
+ if (db_get_b(0, SSMODULENAME, SETTING_SETPROFILE, 1) ||
+ db_get_b(0, SSMODULENAME, SETTING_OFFLINECLOSE, 0))
+ db_set_w(0, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
// docking
- if (db_get_b(NULL, SSMODULENAME, SETTING_SETDOCKED, 0)) {
- int docked = db_get_b(NULL, SSMODULENAME, SETTING_DOCKED, DOCKED_NONE);
+ if (db_get_b(0, SSMODULENAME, SETTING_SETDOCKED, 0)) {
+ int docked = db_get_b(0, SSMODULENAME, SETTING_DOCKED, DOCKED_NONE);
if (docked == DOCKED_LEFT || docked == DOCKED_RIGHT)
docked = -docked;
- db_set_b(NULL, MODULE_CLIST, SETTING_DOCKED, (BYTE)docked);
+ db_set_b(0, MODULE_CLIST, SETTING_DOCKED, (BYTE)docked);
}
// Create service functions; the get functions are created here; they don't rely on commonstatus