diff options
author | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-11-12 21:44:56 +0300 |
commit | 53fe3e46177d17b4941610de19f5cc6210700cb4 (patch) | |
tree | b67a6bc208dad141f9db14035cd7e42ff2a51872 /plugins/WhenWasIt/src | |
parent | 488214ac8af0c4aeb1a5c1d8fd48368daaf4c4c7 (diff) |
db_* functions replaced with g_plugin calls
Diffstat (limited to 'plugins/WhenWasIt/src')
-rw-r--r-- | plugins/WhenWasIt/src/dlg_handlers.cpp | 44 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/hooked_events.cpp | 2 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/services.cpp | 46 | ||||
-rw-r--r-- | plugins/WhenWasIt/src/utils.cpp | 2 |
4 files changed, 47 insertions, 47 deletions
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index e6916d60d9..85695e5345 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -347,35 +347,35 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara commonData.cDlgTimeout = wcstol(buffer, &stop, 10);
if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
- db_set_b(NULL, MODULENAME, "IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
- db_set_b(NULL, MODULENAME, "UsePopups", commonData.bUsePopups);
- db_set_b(NULL, MODULENAME, "UseDialog", commonData.bUseDialog);
- db_set_w(NULL, MODULENAME, "CheckInterval", commonData.checkInterval);
- db_set_w(NULL, MODULENAME, "DaysInAdvance", commonData.daysInAdvance);
- db_set_w(NULL, MODULENAME, "DaysAfter", commonData.daysAfter);
- db_set_w(NULL, MODULENAME, "PopupTimeout", commonData.popupTimeout);
- db_set_w(NULL, MODULENAME, "PopupTimeoutToday", commonData.popupTimeoutToday);
+ g_plugin.setByte("IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
+ g_plugin.setByte("UsePopups", commonData.bUsePopups);
+ g_plugin.setByte("UseDialog", commonData.bUseDialog);
+ g_plugin.setWord("CheckInterval", commonData.checkInterval);
+ g_plugin.setWord("DaysInAdvance", commonData.daysInAdvance);
+ g_plugin.setWord("DaysAfter", commonData.daysAfter);
+ g_plugin.setWord("PopupTimeout", commonData.popupTimeout);
+ g_plugin.setWord("PopupTimeoutToday", commonData.popupTimeoutToday);
- db_set_b(NULL, MODULENAME, "ShowCurrentAge", commonData.cShowAgeMode);
- db_set_b(NULL, MODULENAME, "NoBirthdaysPopup", commonData.bNoBirthdaysPopup);
+ g_plugin.setByte("ShowCurrentAge", commonData.cShowAgeMode);
+ g_plugin.setByte("NoBirthdaysPopup", commonData.bNoBirthdaysPopup);
- db_set_b(NULL, MODULENAME, "OpenInBackground", commonData.bOpenInBackground);
+ g_plugin.setByte("OpenInBackground", commonData.bOpenInBackground);
- db_set_b(NULL, MODULENAME, "SoundNearDays", commonData.cSoundNearDays);
+ g_plugin.setByte("SoundNearDays", commonData.cSoundNearDays);
- db_set_b(NULL, MODULENAME, "DefaultModule", commonData.cDefaultModule);
+ g_plugin.setByte("DefaultModule", commonData.cDefaultModule);
- db_set_b(NULL, MODULENAME, "PopupLeftClick", commonData.lPopupClick);
- db_set_b(NULL, MODULENAME, "PopupRightClick", commonData.rPopupClick);
+ g_plugin.setByte("PopupLeftClick", commonData.lPopupClick);
+ g_plugin.setByte("PopupRightClick", commonData.rPopupClick);
- db_set_dw(NULL, MODULENAME, "Foreground", commonData.foreground);
- db_set_dw(NULL, MODULENAME, "Background", commonData.background);
+ g_plugin.setDword("Foreground", commonData.foreground);
+ g_plugin.setDword("Background", commonData.background);
- db_set_b(NULL, MODULENAME, "OncePerDay", commonData.bOncePerDay);
+ g_plugin.setByte("OncePerDay", commonData.bOncePerDay);
- db_set_w(NULL, MODULENAME, "DlgTimeout", commonData.cDlgTimeout);
+ g_plugin.setWord("DlgTimeout", commonData.cDlgTimeout);
- db_set_b(NULL, MODULENAME, "NotifyFor", commonData.notifyFor);
+ g_plugin.setByte("NotifyFor", commonData.notifyFor);
RefreshAllContactListIcons();
@@ -746,7 +746,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa ListView_InsertColumn(hList, 5, &col);
LoadBirthdays(hWnd, 0);
- int column = db_get_b(NULL, MODULENAME, "SortColumn", 0);
+ int column = g_plugin.getByte("SortColumn", 0);
BirthdaysSortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
@@ -818,7 +818,7 @@ INT_PTR CALLBACK DlgProcBirthdays(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa case LVN_COLUMNCLICK:
LPNMLISTVIEW lv = (LPNMLISTVIEW)lParam;
int column = lv->iSubItem;
- db_set_b(NULL, MODULENAME, "SortColumn", column);
+ g_plugin.setByte("SortColumn", column);
BirthdaysSortParams params = {};
params.hList = GetDlgItem(hWnd, IDC_BIRTHDAYS_LIST);
params.column = column;
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp index 7320a42530..443794d9bd 100644 --- a/plugins/WhenWasIt/src/hooked_events.cpp +++ b/plugins/WhenWasIt/src/hooked_events.cpp @@ -141,7 +141,7 @@ int RefreshContactListIcons(MCONTACT hContact) int UpdateTimers()
{
- UINT interval = db_get_dw(NULL, MODULENAME, "Interval", CHECK_INTERVAL);
+ UINT interval = g_plugin.getDword("Interval", CHECK_INTERVAL);
interval *= (1000 * 60 * 60); //go from miliseconds to hours
hCheckTimer = SetTimer(nullptr, 0, interval, OnCheckTimer);
if (!hDateChangeTimer)
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index 38319dc597..b0dfe5c516 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -29,26 +29,26 @@ int InitServices() {
Log("%s", "Entering function " __FUNCTION__);
- commonData.foreground = db_get_dw(NULL, MODULENAME, "Foreground", FOREGROUND_COLOR);
- commonData.background = db_get_dw(NULL, MODULENAME, "Background", BACKGROUND_COLOR);
- commonData.checkInterval = db_get_w(NULL, MODULENAME, "CheckInterval", CHECK_INTERVAL);
- commonData.daysInAdvance = db_get_w(NULL, MODULENAME, "DaysInAdvance", DAYS_TO_NOTIFY);
- commonData.daysAfter = db_get_w(NULL, MODULENAME, "DaysAfter", DAYS_TO_NOTIFY_AFTER);
- commonData.popupTimeout = db_get_w(NULL, MODULENAME, "PopupTimeout", POPUP_TIMEOUT);
- commonData.popupTimeoutToday = db_get_w(NULL, MODULENAME, "PopupTimeoutToday", commonData.popupTimeout);
- commonData.bUsePopups = db_get_b(NULL, MODULENAME, "UsePopups", TRUE);
- commonData.bUseDialog = db_get_b(NULL, MODULENAME, "UseDialog", TRUE);
- commonData.bIgnoreSubcontacts = db_get_b(NULL, MODULENAME, "IgnoreSubcontacts", FALSE);
- commonData.cShowAgeMode = db_get_b(NULL, MODULENAME, "ShowCurrentAge", FALSE);
- commonData.bNoBirthdaysPopup = db_get_b(NULL, MODULENAME, "NoBirthdaysPopup", FALSE);
- commonData.bOpenInBackground = db_get_b(NULL, MODULENAME, "OpenInBackground", FALSE);
- commonData.cSoundNearDays = db_get_b(NULL, MODULENAME, "SoundNearDays", BIRTHDAY_NEAR_DEFAULT_DAYS);
- commonData.cDefaultModule = db_get_b(NULL, MODULENAME, "DefaultModule", 0);
- commonData.lPopupClick = db_get_b(NULL, MODULENAME, "PopupLeftClick", 2);
- commonData.rPopupClick = db_get_b(NULL, MODULENAME, "PopupRightClick", 1);
- commonData.bOncePerDay = db_get_b(NULL, MODULENAME, "OncePerDay", 0);
- commonData.cDlgTimeout = db_get_w(NULL, MODULENAME, "DlgTimeout", POPUP_TIMEOUT);
- commonData.notifyFor = db_get_b(NULL, MODULENAME, "NotifyFor", 0);
+ commonData.foreground = g_plugin.getDword("Foreground", FOREGROUND_COLOR);
+ commonData.background = g_plugin.getDword("Background", BACKGROUND_COLOR);
+ commonData.checkInterval = g_plugin.getWord("CheckInterval", CHECK_INTERVAL);
+ commonData.daysInAdvance = g_plugin.getWord("DaysInAdvance", DAYS_TO_NOTIFY);
+ commonData.daysAfter = g_plugin.getWord("DaysAfter", DAYS_TO_NOTIFY_AFTER);
+ commonData.popupTimeout = g_plugin.getWord("PopupTimeout", POPUP_TIMEOUT);
+ commonData.popupTimeoutToday = g_plugin.getWord("PopupTimeoutToday", commonData.popupTimeout);
+ commonData.bUsePopups = g_plugin.getByte("UsePopups", TRUE);
+ commonData.bUseDialog = g_plugin.getByte("UseDialog", TRUE);
+ commonData.bIgnoreSubcontacts = g_plugin.getByte("IgnoreSubcontacts", FALSE);
+ commonData.cShowAgeMode = g_plugin.getByte("ShowCurrentAge", FALSE);
+ commonData.bNoBirthdaysPopup = g_plugin.getByte("NoBirthdaysPopup", FALSE);
+ commonData.bOpenInBackground = g_plugin.getByte("OpenInBackground", FALSE);
+ commonData.cSoundNearDays = g_plugin.getByte("SoundNearDays", BIRTHDAY_NEAR_DEFAULT_DAYS);
+ commonData.cDefaultModule = g_plugin.getByte("DefaultModule", 0);
+ commonData.lPopupClick = g_plugin.getByte("PopupLeftClick", 2);
+ commonData.rPopupClick = g_plugin.getByte("PopupRightClick", 1);
+ commonData.bOncePerDay = g_plugin.getByte("OncePerDay", 0);
+ commonData.cDlgTimeout = g_plugin.getWord("DlgTimeout", POPUP_TIMEOUT);
+ commonData.notifyFor = g_plugin.getByte("NotifyFor", 0);
CreateServiceFunction(MS_WWI_CHECK_BIRTHDAYS, CheckBirthdaysService);
CreateServiceFunction(MS_WWI_LIST_SHOW, ShowListService);
@@ -104,7 +104,7 @@ INT_PTR CheckBirthdaysService(WPARAM, LPARAM lParam) SYSTEMTIME today;
GetLocalTime(&today);
- DWORD lastChecked = db_get_dw(NULL, MODULENAME, "LastChecked", 0); //get last checked date
+ DWORD lastChecked = g_plugin.getDword("LastChecked", 0); //get last checked date
int lcDay = LOBYTE(LOWORD(lastChecked));
int lcMonth = HIBYTE(LOWORD(lastChecked));
int lcYear = HIWORD(lastChecked);
@@ -131,7 +131,7 @@ INT_PTR CheckBirthdaysService(WPARAM, LPARAM lParam) commonData.daysAfter = savedDaysAfter; //restore previous value
if (lParam) //if not forced - i.e. timer check
- db_set_dw(NULL, MODULENAME, "LastChecked", MAKELONG(MAKEWORD(today.wDay, today.wMonth), today.wYear)); //write the value in DB so we don't check again today
+ g_plugin.setDword("LastChecked", MAKELONG(MAKEWORD(today.wDay, today.wMonth), today.wYear)); //write the value in DB so we don't check again today
return 0;
}
@@ -170,7 +170,7 @@ void __cdecl RefreshUserDetailsWorkerThread(void*) Thread_SetName("WhenWasIt: RefreshUserDetailsWorkerThread");
ShowPopupMessage(TranslateT("WhenWasIt"), TranslateT("Starting to refresh user details"), hRefreshUserDetails);
- int delay = db_get_w(NULL, MODULENAME, "UpdateDelay", REFRESH_DETAILS_DELAY);
+ int delay = g_plugin.getWord("UpdateDelay", REFRESH_DETAILS_DELAY);
MCONTACT hContact = db_find_first();
while (hContact != NULL) {
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 2b058289c4..4b6240ae69 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -135,7 +135,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, size_t size)
{
- return GetStringFromDatabase(NULL, MODULENAME, szSettingName, szError, szResult, size);
+ return GetStringFromDatabase(0, MODULENAME, szSettingName, szError, szResult, size);
}
wchar_t* GetContactID(MCONTACT hContact)
|