summaryrefslogtreecommitdiff
path: root/plugins/AutoShutdown/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-11-12 21:44:56 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-11-12 21:44:56 +0300
commit53fe3e46177d17b4941610de19f5cc6210700cb4 (patch)
treeb67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/AutoShutdown/src
parent488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff)
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/AutoShutdown/src')
-rw-r--r--plugins/AutoShutdown/src/frame.cpp8
-rw-r--r--plugins/AutoShutdown/src/options.cpp20
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp28
-rw-r--r--plugins/AutoShutdown/src/shutdownsvc.cpp6
-rw-r--r--plugins/AutoShutdown/src/watcher.cpp18
5 files changed, 40 insertions, 40 deletions
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp
index 3c1f18750e..ad77a5223b 100644
--- a/plugins/AutoShutdown/src/frame.cpp
+++ b/plugins/AutoShutdown/src/frame.cpp
@@ -39,7 +39,7 @@ static COLORREF GetDefaultColor(BYTE id)
case FRAMEELEMENT_BAR:
return RGB(250, 0, 0); /* same color as used on header icon */
case FRAMEELEMENT_BKGRND:
- return (COLORREF)db_get_dw(NULL, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
+ return (COLORREF)db_get_dw(0, "CLC", "BkColour", CLCDEFAULT_BKCOLOUR);
case FRAMEELEMENT_TEXT:
return GetSysColor(COLOR_WINDOWTEXT);
}
@@ -288,14 +288,14 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame, UINT msg, WPARAM wParam, LP
}
case M_SET_COUNTDOWN:
if (dat->fTimeFlags&SDWTF_ST_TIME) {
- dat->settingLastTime = (time_t)db_get_dw(NULL, MODULENAME, "TimeStamp", SETTING_TIMESTAMP_DEFAULT);
+ dat->settingLastTime = (time_t)g_plugin.getDword("TimeStamp", SETTING_TIMESTAMP_DEFAULT);
dat->countdown = time(0);
if (dat->settingLastTime > dat->countdown) dat->countdown = dat->settingLastTime - dat->countdown;
else dat->countdown = 0;
}
else if (dat->flags&FWPDF_COUNTDOWNINVALID) {
- dat->countdown = (time_t)db_get_dw(NULL, MODULENAME, "Countdown", SETTING_COUNTDOWN_DEFAULT);
- dat->countdown *= (time_t)db_get_dw(NULL, MODULENAME, "CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
+ dat->countdown = (time_t)g_plugin.getDword("Countdown", SETTING_COUNTDOWN_DEFAULT);
+ dat->countdown *= (time_t)g_plugin.getDword("CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
}
dat->flags &= ~FWPDF_COUNTDOWNINVALID;
/* commctl 4.70+, Win95: 1-100 will work fine (wrap around) */
diff --git a/plugins/AutoShutdown/src/options.cpp b/plugins/AutoShutdown/src/options.cpp
index f46c1d344e..3c79c94384 100644
--- a/plugins/AutoShutdown/src/options.cpp
+++ b/plugins/AutoShutdown/src/options.cpp
@@ -31,7 +31,7 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- WORD setting = db_get_w(NULL, MODULENAME, "ConfirmDlgCountdown", SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
+ WORD setting = g_plugin.getWord("ConfirmDlgCountdown", SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
if (setting < 3)
setting = SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg, IDC_SPIN_CONFIRMDLGCOUNTDOWN, UDM_SETRANGE, 0, MAKELPARAM(999, 3));
@@ -39,15 +39,15 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
SendDlgItemMessage(hwndDlg, IDC_SPIN_CONFIRMDLGCOUNTDOWN, UDM_SETPOS, 0, MAKELPARAM(setting, 0));
SetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, setting, FALSE);
}
- CheckDlgButton(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK, db_get_b(NULL, MODULENAME, "SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHECK_REMEMBERONRESTART, db_get_b(NULL, MODULENAME, "RememberOnRestart", SETTING_REMEMBERONRESTART_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG, db_get_b(NULL, MODULENAME, "ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK, g_plugin.getByte("SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_REMEMBERONRESTART, g_plugin.getByte("RememberOnRestart", SETTING_REMEMBERONRESTART_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG, g_plugin.getByte("ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
{
BOOL enabled = ServiceIsTypeEnabled(SDSDT_SHUTDOWN, 0);
if (enabled) {
if (ServiceExists(MS_WEATHER_UPDATE)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_WEATHER), TRUE);
- CheckDlgButton(hwndDlg, IDC_CHECK_WEATHER, db_get_b(NULL, MODULENAME, "WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECK_WEATHER, g_plugin.getByte("WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT) != 0 ? BST_CHECKED : BST_UNCHECKED);
}
}
}
@@ -85,12 +85,12 @@ static INT_PTR CALLBACK ShutdownOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam
case WM_NOTIFY:
switch (((NMHDR*)lParam)->code) {
case PSN_APPLY:
- db_set_b(NULL, MODULENAME, "ShowConfirmDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG) != 0));
- db_set_w(NULL, MODULENAME, "ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "RememberOnRestart", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_REMEMBERONRESTART) != 0));
- db_set_b(NULL, MODULENAME, "SmartOfflineCheck", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK) != 0));
+ g_plugin.setByte("ShowConfirmDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SHOWCONFIRMDLG) != 0));
+ g_plugin.setWord("ConfirmDlgCountdown", (WORD)GetDlgItemInt(hwndDlg, IDC_EDIT_CONFIRMDLGCOUNTDOWN, nullptr, FALSE));
+ g_plugin.setByte("RememberOnRestart", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_REMEMBERONRESTART) != 0));
+ g_plugin.setByte("SmartOfflineCheck", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_SMARTOFFLINECHECK) != 0));
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHECK_WEATHER)))
- db_set_b(NULL, MODULENAME, "WeatherShutdown", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_WEATHER) != 0));
+ g_plugin.setByte("WeatherShutdown", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CHECK_WEATHER) != 0));
return TRUE;
}
break;
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index 3109286671..bb39c0fc18 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -81,7 +81,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
/* read-in watcher flags */
{
- WORD watcherType = db_get_w(NULL, MODULENAME, "WatcherFlags", SETTING_WATCHERFLAGS_DEFAULT);
+ WORD watcherType = g_plugin.getWord("WatcherFlags", SETTING_WATCHERFLAGS_DEFAULT);
CheckRadioButton(hwndDlg, IDC_RADIO_STTIME, IDC_RADIO_STCOUNTDOWN, (watcherType&SDWTF_ST_TIME) ? IDC_RADIO_STTIME : IDC_RADIO_STCOUNTDOWN);
CheckDlgButton(hwndDlg, IDC_CHECK_SPECIFICTIME, (watcherType&SDWTF_SPECIFICTIME) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHECK_MESSAGE, (watcherType&SDWTF_MESSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
@@ -93,14 +93,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
/* read-in countdown val */
{
SYSTEMTIME st;
- if (!TimeStampToSystemTime((time_t)db_get_dw(NULL, MODULENAME, "TimeStamp", SETTING_TIMESTAMP_DEFAULT), &st))
+ if (!TimeStampToSystemTime((time_t)g_plugin.getDword("TimeStamp", SETTING_TIMESTAMP_DEFAULT), &st))
GetLocalTime(&st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), GDT_VALID, &st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_DATE_TIMESTAMP), GDT_VALID, &st);
SendMessage(hwndDlg, M_CHECK_DATETIME, 0, 0);
}
{
- DWORD setting = db_get_dw(NULL, MODULENAME, "Countdown", SETTING_COUNTDOWN_DEFAULT);
+ DWORD setting = g_plugin.getDword("Countdown", SETTING_COUNTDOWN_DEFAULT);
if (setting < 1) setting = SETTING_COUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg, IDC_SPIN_COUNTDOWN, UDM_SETRANGE, 0, MAKELPARAM(UD_MAXVAL, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_COUNTDOWN, EM_SETLIMITTEXT, (WPARAM)10, 0);
@@ -109,7 +109,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_COUNTDOWNUNIT);
- DWORD lastUnit = db_get_dw(NULL, MODULENAME, "CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
+ DWORD lastUnit = g_plugin.getDword("CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_INITSTORAGE, _countof(unitNames), _countof(unitNames) * 16); /* approx. */
for (int i = 0; i < _countof(unitNames); ++i) {
@@ -122,14 +122,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
{
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "Message", &dbv)) {
+ if (!g_plugin.getWString("Message", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_MESSAGE, dbv.pwszVal);
mir_free(dbv.pwszVal);
}
}
/* cpuusage threshold */
{
- BYTE setting = DBGetContactSettingRangedByte(NULL, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
+ BYTE setting = DBGetContactSettingRangedByte(0, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETRANGE, 0, MAKELPARAM(100, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_CPUUSAGE, EM_SETLIMITTEXT, (WPARAM)3, 0);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETPOS, 0, MAKELPARAM(setting, 0));
@@ -138,7 +138,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
/* shutdown types */
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_SHUTDOWNTYPE);
- BYTE lastShutdownType = db_get_b(NULL, MODULENAME, "ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
+ BYTE lastShutdownType = g_plugin.getByte("ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
SendMessage(hwndCombo, CB_INITSTORAGE, SDSDT_MAX, SDSDT_MAX * 32);
@@ -340,7 +340,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
wchar_t *pszText = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
if (pszText != nullptr && GetWindowText(hwndEdit, pszText, len + 1)) {
TrimString(pszText);
- db_set_ws(NULL, MODULENAME, "Message", pszText);
+ g_plugin.setWString("Message", pszText);
}
mir_free(pszText); /* does NULL check */
}
@@ -351,18 +351,18 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), &st); /* time gets synchronized */
if (!SystemTimeToTimeStamp(&st, &timestamp))
timestamp = time(0);
- db_set_dw(NULL, MODULENAME, "TimeStamp", (DWORD)timestamp);
+ g_plugin.setDword("TimeStamp", (DWORD)timestamp);
}
/* shutdown type */
{
int index = SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
- db_set_b(NULL, MODULENAME, "ShutdownType", (BYTE)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
+ g_plugin.setByte("ShutdownType", (BYTE)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
index = SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
- db_set_dw(NULL, MODULENAME, "CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
- db_set_dw(NULL, MODULENAME, "Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
+ g_plugin.setDword("CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
+ g_plugin.setDword("Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
+ g_plugin.setByte("CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
}
/* watcher type */
{
@@ -373,7 +373,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_IDLE)) watcherType |= SDWTF_IDLE;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_STATUS)) watcherType |= SDWTF_STATUS;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_CPUUSAGE)) watcherType |= SDWTF_CPUUSAGE;
- db_set_w(NULL, MODULENAME, "WatcherFlags", watcherType);
+ g_plugin.setWord("WatcherFlags", watcherType);
ServiceStartWatcher(0, watcherType);
}
DestroyWindow(hwndDlg);
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp
index b6f4ac85e0..d8f6df0dac 100644
--- a/plugins/AutoShutdown/src/shutdownsvc.cpp
+++ b/plugins/AutoShutdown/src/shutdownsvc.cpp
@@ -321,7 +321,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, (LONG_PTR)hBoldFont);
}
{
- countdown = db_get_w(NULL, MODULENAME, "ConfirmDlgCountdown", SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
+ countdown = g_plugin.getWord("ConfirmDlgCountdown", SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT);
if (countdown < 3)
countdown = SETTING_CONFIRMDLGCOUNTDOWN_DEFAULT;
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT_HEADER), GWLP_USERDATA, countdown);
@@ -416,7 +416,7 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam)
{
/* passing 0 as wParam is only to be used internally, undocumented */
- if (!wParam) wParam = db_get_b(NULL, MODULENAME, "ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
+ if (!wParam) wParam = g_plugin.getByte("ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
if (!IsShutdownTypeEnabled((BYTE)wParam)) return 1; /* does shutdownType range check */
if ((BOOL)lParam && hwndShutdownDlg != nullptr) return 2;
@@ -428,7 +428,7 @@ INT_PTR ServiceShutdown(WPARAM wParam, LPARAM lParam)
/* tell others */
NotifyEventHooks(hEventShutdown, wParam, lParam);
/* show dialog */
- if (lParam && db_get_b(NULL, MODULENAME, "ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT))
+ if (lParam && g_plugin.getByte("ShowConfirmDlg", SETTING_SHOWCONFIRMDLG_DEFAULT))
if (CreateDialogParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_SHUTDOWNNOW), nullptr, ShutdownDlgProc, (BYTE)wParam) != nullptr)
return 0;
/* show error */
diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp
index 529954f758..3973b251f9 100644
--- a/plugins/AutoShutdown/src/watcher.cpp
+++ b/plugins/AutoShutdown/src/watcher.cpp
@@ -99,7 +99,7 @@ static int MsgEventAdded(WPARAM, LPARAM hDbEvent)
if (!db_event_get(hDbEvent, &dbe))
if (dbe.eventType == EVENTTYPE_MESSAGE && !(dbe.flags & DBEF_SENT)) {
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "Message", &dbv)) {
+ if (!g_plugin.getWString("Message", &dbv)) {
TrimString(dbv.pwszVal);
wchar_t *pszMsg = GetMessageText(&dbe.pBlob, &dbe.cbBlob);
if (pszMsg != nullptr && wcsstr(pszMsg, dbv.pwszVal) != nullptr)
@@ -175,7 +175,7 @@ static int IdleChanged(WPARAM, LPARAM lParam)
static BOOL CheckAllContactsOffline(void)
{
BOOL fSmartCheck, fAllOffline = TRUE; /* tentatively */
- fSmartCheck = db_get_b(NULL, MODULENAME, "SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT);
+ fSmartCheck = g_plugin.getByte("SmartOfflineCheck", SETTING_SMARTOFFLINECHECK_DEFAULT);
for (auto &hContact : Contacts()) {
char *pszProto = GetContactProto(hContact);
if (pszProto != nullptr && Proto_GetStatus(pszProto) != ID_STATUS_OFFLINE) {
@@ -236,7 +236,7 @@ static int WeatherUpdated(WPARAM wParam, LPARAM lParam)
{
char *pszProto = GetContactProto(wParam);
if ((BOOL)lParam && pszProto != nullptr && Proto_GetStatus(pszProto) == THUNDER)
- if (db_get_b(NULL, MODULENAME, "WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT))
+ if (g_plugin.getByte("WeatherShutdown", SETTING_WEATHERSHUTDOWN_DEFAULT))
ServiceShutdown(SDSDT_SHUTDOWN, TRUE);
return 0;
}
@@ -247,7 +247,7 @@ INT_PTR ServiceStartWatcher(WPARAM, LPARAM lParam)
{
/* passing watcherType as lParam is only to be used internally, undocumented */
if (lParam == 0)
- lParam = (LPARAM)db_get_w(NULL, MODULENAME, "WatcherFlags", 0);
+ lParam = (LPARAM)g_plugin.getWord("WatcherFlags", 0);
/* invalid flags or empty? */
if (!(lParam&SDWTF_MASK))
@@ -276,7 +276,7 @@ INT_PTR ServiceStartWatcher(WPARAM, LPARAM lParam)
ShowCountdownFrame(currentWatcherType); /* after modules loaded */
/* Cpu Shutdown */
if (currentWatcherType&SDWTF_CPUUSAGE)
- idCpuUsageThread = PollCpuUsage(CpuUsageWatcherProc, (LPARAM)DBGetContactSettingRangedByte(NULL, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100), 1500);
+ idCpuUsageThread = PollCpuUsage(CpuUsageWatcherProc, (LPARAM)DBGetContactSettingRangedByte(0, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100), 1500);
/* Transfer Shutdown */
if (currentWatcherType&SDWTF_FILETRANSFER && !nTransfersCount)
ShutdownAndStopWatcher();
@@ -317,8 +317,8 @@ void WatcherModulesLoaded(void)
hHookWeatherUpdated = HookEvent(ME_WEATHER_UPDATED, WeatherUpdated);
/* restore watcher if it was running on last exit */
- if (db_get_b(NULL, MODULENAME, "RememberOnRestart", 0) == SDROR_RUNNING) {
- db_set_b(NULL, MODULENAME, "RememberOnRestart", 1);
+ if (g_plugin.getByte("RememberOnRestart", 0) == SDROR_RUNNING) {
+ g_plugin.setByte("RememberOnRestart", 1);
ServiceStartWatcher(0, 0); /* after modules loaded */
}
}
@@ -350,8 +350,8 @@ void UninitWatcher(void)
{
/* remember watcher if running */
if (!ServiceStopWatcher(0, 0))
- if (db_get_b(NULL, MODULENAME, "RememberOnRestart", SETTING_REMEMBERONRESTART_DEFAULT))
- db_set_b(NULL, MODULENAME, "RememberOnRestart", SDROR_RUNNING);
+ if (g_plugin.getByte("RememberOnRestart", SETTING_REMEMBERONRESTART_DEFAULT))
+ g_plugin.setByte("RememberOnRestart", SDROR_RUNNING);
/* Message Shutdown */
UnhookEvent(hHookEventAdded);