From 53fe3e46177d17b4941610de19f5cc6210700cb4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 Nov 2018 21:44:56 +0300 Subject: db_* functions replaced with g_plugin calls --- plugins/GmailNotifier/src/main.cpp | 32 ++++++++++++++++---------------- plugins/GmailNotifier/src/options.cpp | 26 +++++++++++++------------- plugins/GmailNotifier/src/utility.cpp | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) (limited to 'plugins/GmailNotifier') diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index e894e5c6d5..8131aaf905 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -99,24 +99,24 @@ int CMPlugin::Load() CreateProtoServiceFunction(MODULENAME, PS_GETNAME, GetName); CreateServiceFunction("GmailMNotifier/Notifying", Notifying); - opt.circleTime = db_get_dw(NULL, MODULENAME, "circleTime", 30); - opt.notifierOnTray = db_get_dw(NULL, MODULENAME, "notifierOnTray", TRUE); - opt.notifierOnPop = db_get_dw(NULL, MODULENAME, "notifierOnPop", TRUE); - opt.popupDuration = db_get_dw(NULL, MODULENAME, "popupDuration", -1); - opt.popupBgColor = db_get_dw(NULL, MODULENAME, "popupBgColor", RGB(173, 206, 247)); - opt.popupTxtColor = db_get_dw(NULL, MODULENAME, "popupTxtColor", RGB(0, 0, 0)); - opt.OpenUsePrg = db_get_dw(NULL, MODULENAME, "OpenUsePrg", 0); - opt.ShowCustomIcon = db_get_dw(NULL, MODULENAME, "ShowCustomIcon", FALSE); - opt.UseOnline = db_get_dw(NULL, MODULENAME, "UseOnline", FALSE); - opt.AutoLogin = db_get_dw(NULL, MODULENAME, "AutoLogin", TRUE); - opt.LogThreads = db_get_dw(NULL, MODULENAME, "LogThreads", FALSE); + opt.circleTime = g_plugin.getDword("circleTime", 30); + opt.notifierOnTray = g_plugin.getDword("notifierOnTray", TRUE); + opt.notifierOnPop = g_plugin.getDword("notifierOnPop", TRUE); + opt.popupDuration = g_plugin.getDword("popupDuration", -1); + opt.popupBgColor = g_plugin.getDword("popupBgColor", RGB(173, 206, 247)); + opt.popupTxtColor = g_plugin.getDword("popupTxtColor", RGB(0, 0, 0)); + opt.OpenUsePrg = g_plugin.getDword("OpenUsePrg", 0); + opt.ShowCustomIcon = g_plugin.getDword("ShowCustomIcon", FALSE); + opt.UseOnline = g_plugin.getDword("UseOnline", FALSE); + opt.AutoLogin = g_plugin.getDword("AutoLogin", TRUE); + opt.LogThreads = g_plugin.getDword("LogThreads", FALSE); DBVARIANT dbv; - if (db_get_s(NULL, "SkinIcons", "core_status_" MODULENAME "4", &dbv)) { - db_set_s(NULL, "SkinIcons", "core_status_" MODULENAME "0", "plugins\\GmailNotifier.dll,2"); - db_set_s(NULL, "SkinIcons", "core_status_" MODULENAME "1", "plugins\\GmailNotifier.dll,2"); - db_set_s(NULL, "SkinIcons", "core_status_" MODULENAME "2", "plugins\\GmailNotifier.dll,0"); - db_set_s(NULL, "SkinIcons", "core_status_" MODULENAME "4", "plugins\\GmailNotifier.dll,1"); + if (db_get_s(0, "SkinIcons", "core_status_" MODULENAME "4", &dbv)) { + db_set_s(0, "SkinIcons", "core_status_" MODULENAME "0", "plugins\\GmailNotifier.dll,2"); + db_set_s(0, "SkinIcons", "core_status_" MODULENAME "1", "plugins\\GmailNotifier.dll,2"); + db_set_s(0, "SkinIcons", "core_status_" MODULENAME "2", "plugins\\GmailNotifier.dll,0"); + db_set_s(0, "SkinIcons", "core_status_" MODULENAME "4", "plugins\\GmailNotifier.dll,1"); } else db_free(&dbv); diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index 720bc9aa01..e9bc4bab5c 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -84,7 +84,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } { DBVARIANT dbv; - if (!db_get_s(NULL, MODULENAME, "OpenUsePrgPath", &dbv)) { + if (!g_plugin.getString("OpenUsePrgPath", &dbv)) { mir_strcpy(str, dbv.pszVal); db_free(&dbv); } @@ -216,20 +216,20 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (opt.circleTime > 0) { KillTimer(nullptr, hTimer); hTimer = SetTimer(nullptr, 0, opt.circleTime * 60000, TimerProc); - db_set_dw(NULL, MODULENAME, "circleTime", opt.circleTime); + g_plugin.setDword("circleTime", opt.circleTime); } opt.notifierOnTray = IsDlgButtonChecked(hwndDlg, IDC_OPTTRAY); opt.notifierOnPop = IsDlgButtonChecked(hwndDlg, IDC_OPTPOP); - db_set_dw(NULL, MODULENAME, "notifierOnTray", opt.notifierOnTray); - db_set_dw(NULL, MODULENAME, "notifierOnPop", opt.notifierOnPop); + g_plugin.setDword("notifierOnTray", opt.notifierOnTray); + g_plugin.setDword("notifierOnPop", opt.notifierOnPop); opt.popupDuration = GetDlgItemInt(hwndDlg, IDC_DURATION, nullptr, TRUE); - db_set_dw(NULL, MODULENAME, "popupDuration", opt.popupDuration); + g_plugin.setDword("popupDuration", opt.popupDuration); opt.popupBgColor = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, opt.popupBgColor); opt.popupTxtColor = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, opt.popupBgColor); - db_set_dw(NULL, MODULENAME, "popupBgColor", opt.popupBgColor); - db_set_dw(NULL, MODULENAME, "popupTxtColor", opt.popupTxtColor); + g_plugin.setDword("popupBgColor", opt.popupBgColor); + g_plugin.setDword("popupTxtColor", opt.popupTxtColor); if (IsDlgButtonChecked(hwndDlg, IDC_SYSDEF) == BST_CHECKED) opt.OpenUsePrg = 0; @@ -240,8 +240,8 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } GetDlgItemTextA(hwndDlg, IDC_PRG, str, _countof(str)); - db_set_dw(NULL, MODULENAME, "OpenUsePrg", opt.OpenUsePrg); - db_set_s(NULL, MODULENAME, "OpenUsePrgPath", str); + g_plugin.setDword("OpenUsePrg", opt.OpenUsePrg); + g_plugin.setString("OpenUsePrgPath", str); opt.ShowCustomIcon = IsDlgButtonChecked(hwndDlg, IDC_SHOWICON); opt.UseOnline = IsDlgButtonChecked(hwndDlg, IDC_ONLINE); @@ -252,10 +252,10 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else if (IsDlgButtonChecked(hwndDlg, IDC_AUTOLOGIN) == BST_INDETERMINATE) opt.AutoLogin = 2; opt.LogThreads = IsDlgButtonChecked(hwndDlg, IDC_LOGTHREADS); - db_set_dw(NULL, MODULENAME, "ShowCustomIcon", opt.ShowCustomIcon); - db_set_dw(NULL, MODULENAME, "UseOnline", opt.UseOnline); - db_set_dw(NULL, MODULENAME, "AutoLogin", opt.AutoLogin); - db_set_dw(NULL, MODULENAME, "LogThreads", opt.LogThreads); + g_plugin.setDword("ShowCustomIcon", opt.ShowCustomIcon); + g_plugin.setDword("UseOnline", opt.UseOnline); + g_plugin.setDword("AutoLogin", opt.AutoLogin); + g_plugin.setDword("LogThreads", opt.LogThreads); ID_STATUS_NONEW = opt.UseOnline ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE; for (auto &it : g_accs) diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp index 63ab420896..2751aa2f1c 100644 --- a/plugins/GmailNotifier/src/utility.cpp +++ b/plugins/GmailNotifier/src/utility.cpp @@ -40,7 +40,7 @@ BOOL GetBrowser(char *str) else if (opt.OpenUsePrg == 0) strKey = strDefault; else { - if (!db_get_s(NULL, MODULENAME, "OpenUsePrgPath", &dbv)) { + if (!g_plugin.getString("OpenUsePrgPath", &dbv)) { mir_strcpy(str, dbv.pszVal); db_free(&dbv); } -- cgit v1.2.3