summaryrefslogtreecommitdiff
path: root/plugins/AutoShutdown/src/watcher.cpp
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/watcher.cpp
parent488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff)
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/AutoShutdown/src/watcher.cpp')
-rw-r--r--plugins/AutoShutdown/src/watcher.cpp18
1 files changed, 9 insertions, 9 deletions
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);