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/Popup/src/actions.cpp | 20 ++++----- plugins/Popup/src/avatars.cpp | 2 +- plugins/Popup/src/config.cpp | 6 +-- plugins/Popup/src/history.cpp | 2 +- plugins/Popup/src/main.cpp | 6 +-- plugins/Popup/src/notifications.cpp | 24 +++++------ plugins/Popup/src/opt_adv.cpp | 72 +++++++++++++++---------------- plugins/Popup/src/opt_class.cpp | 20 ++++----- plugins/Popup/src/opt_gen.cpp | 84 ++++++++++++++++++------------------- plugins/Popup/src/opt_skins.cpp | 30 ++++++------- plugins/Popup/src/popup_thread.cpp | 2 +- plugins/Popup/src/services.cpp | 8 ++-- plugins/Popup/src/skin.cpp | 6 +-- 13 files changed, 141 insertions(+), 141 deletions(-) (limited to 'plugins/Popup/src') diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 5839b0c752..867e4d48bf 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -67,7 +67,7 @@ void RegisterAction(POPUPACTION *action) else { POPUPACTION *actionCopy = new POPUPACTION; *actionCopy = *action; - actionCopy->flags = db_get_b(NULL, "PopupActions", actionCopy->lpzTitle, actionCopy->flags & PAF_ENABLED) ? PAF_ENABLED : 0; + actionCopy->flags = db_get_b(0, "PopupActions", actionCopy->lpzTitle, actionCopy->flags & PAF_ENABLED) ? PAF_ENABLED : 0; gActions.insert(actionCopy); } } @@ -138,13 +138,13 @@ DWORD MouseOverride(HWND hCombo, int number) void LoadOption_Actions() { - PopupOptions.actions = db_get_dw(NULL, MODULENAME, "Actions", + PopupOptions.actions = g_plugin.getDword("Actions", ACT_ENABLE | ACT_RIGHTICONS | ACT_DEF_KEEPWND | ACT_DEF_IMONLY | ACT_DEF_NOGLOBAL | ACT_DEF_MESSAGE | ACT_DEF_DETAILS | ACT_DEF_MENU | ACT_DEF_ADD | ACT_DEF_DISMISS | ACT_DEF_PIN); - PopupOptions.overrideLeft = db_get_dw(NULL, MODULENAME, "OverrideLeft", 0); - PopupOptions.overrideMiddle = db_get_dw(NULL, MODULENAME, "OverrideMiddle", 0); - PopupOptions.overrideRight = db_get_dw(NULL, MODULENAME, "OverrideRight", 0); + PopupOptions.overrideLeft = g_plugin.getDword("OverrideLeft", 0); + PopupOptions.overrideMiddle = g_plugin.getDword("OverrideMiddle", 0); + PopupOptions.overrideRight = g_plugin.getDword("OverrideRight", 0); } static UINT controls[] = @@ -340,18 +340,18 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break; case PSN_APPLY: - db_set_dw(NULL, MODULENAME, "Actions", PopupOptions.actions); + g_plugin.setDword("Actions", PopupOptions.actions); HWND hwndList = GetDlgItem(hwnd, IDC_ACTIONS); for (int i = 0; i < gActions.getCount(); ++i) { gActions[i]->flags = (ListView_GetItemState(hwndList, i, LVIS_STATEIMAGEMASK) == 0x2000) ? PAF_ENABLED : 0; - db_set_b(NULL, "PopupActions", gActions[i]->lpzTitle, (gActions[i]->flags & PAF_ENABLED) ? 1 : 0); + db_set_b(0, "PopupActions", gActions[i]->lpzTitle, (gActions[i]->flags & PAF_ENABLED) ? 1 : 0); } // overrideActions - db_set_dw(NULL, MODULENAME, "OverrideLeft", PopupOptions.overrideLeft); - db_set_dw(NULL, MODULENAME, "OverrideMiddle", PopupOptions.overrideMiddle); - db_set_dw(NULL, MODULENAME, "OverrideRight", PopupOptions.overrideRight); + g_plugin.setDword("OverrideLeft", PopupOptions.overrideLeft); + g_plugin.setDword("OverrideMiddle", PopupOptions.overrideMiddle); + g_plugin.setDword("OverrideRight", PopupOptions.overrideRight); } break; diff --git a/plugins/Popup/src/avatars.cpp b/plugins/Popup/src/avatars.cpp index e3e531fcfb..db5e64650f 100644 --- a/plugins/Popup/src/avatars.cpp +++ b/plugins/Popup/src/avatars.cpp @@ -30,7 +30,7 @@ PopupAvatar *PopupAvatar::create(MCONTACT hContact) AVATARCACHEENTRY *av = (AVATARCACHEENTRY*)CallService(MS_AV_GETAVATARBITMAP, hContact, 0); if (av && (mir_wstrlen(av->szFilename) > 4)) if (!mir_wstrcmpi(av->szFilename + mir_wstrlen(av->szFilename) - 4, L".gif")) - if (db_get_b(NULL, MODULENAME, "EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename)) + if (g_plugin.getByte("EnableGifAnimation", 1) && GDIPlus_IsAnimatedGIF(av->szFilename)) return new GifAvatar(hContact); } } diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp index 6abf66ddd5..5a023520ab 100644 --- a/plugins/Popup/src/config.cpp +++ b/plugins/Popup/src/config.cpp @@ -46,7 +46,7 @@ void LoadOptions() { memset(&PopupOptions, 0, sizeof(PopupOptions)); #if defined(_DEBUG) - PopupOptions.debug = db_get_b(NULL, MODULENAME, "debug", FALSE); + PopupOptions.debug = g_plugin.getByte("debug", FALSE); #endif // Load Popup Options @@ -132,7 +132,7 @@ static void CopyModule(const char *szModule, const char *szNewModule) void UpgradeDb() { - if (db_get_b(NULL, "Compatibility", "Popup+ Opts", 0) == 1) + if (db_get_b(0, "Compatibility", "Popup+ Opts", 0) == 1) return; CopyModule("PopUp", "Popup"); @@ -140,5 +140,5 @@ void UpgradeDb() CopyModule("PopUpActions", "PopupActions"); CopyModule("PopUpNotifications", "PopupNotifications"); - db_set_b(NULL, "Compatibility", "Popup+ Opts", 1); + db_set_b(0, "Compatibility", "Popup+ Opts", 1); } diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp index f1adc8eb80..deed963c17 100644 --- a/plugins/Popup/src/history.cpp +++ b/plugins/Popup/src/history.cpp @@ -56,7 +56,7 @@ void PopupHistoryResize() void PopupHistoryLoad() { - popupHistoryBuffer = db_get_w(NULL, MODULENAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT); + popupHistoryBuffer = g_plugin.getWord("HistorySize", SETTING_HISTORYSIZE_DEFAULT); } void PopupHistoryUnload() diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index e82c40c5fa..ae4875c9ba 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -145,14 +145,14 @@ INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM) // The module is enabled. // The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item. PopupOptions.ModuleIsEnabled = FALSE; - db_set_b(NULL, "Popup", "ModuleIsEnabled", FALSE); + db_set_b(0, "Popup", "ModuleIsEnabled", FALSE); Menu_ModifyItem(hMenuItem, LPGENW("Enable Popups"), hIcon = GetIconHandle(IDI_NOPOPUP)); } else { // The module is disabled. // The action to do is enable popups (show enabled), then write "disable popup" in the new item. PopupOptions.ModuleIsEnabled = TRUE; - db_set_b(NULL, "Popup", "ModuleIsEnabled", TRUE); + db_set_b(0, "Popup", "ModuleIsEnabled", TRUE); Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), hIcon = GetIconHandle(IDI_POPUP)); } @@ -323,7 +323,7 @@ int CMPlugin::Load() CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus); #if defined(_DEBUG) - PopupOptions.debug = db_get_b(NULL, MODULENAME, "debug", FALSE); + PopupOptions.debug = g_plugin.getByte("debug", FALSE); #else PopupOptions.debug = false; #endif diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index f86d235189..8dbee80a98 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -95,32 +95,32 @@ void SaveNotificationSettings(POPUPTREEDATA *ptd, char *szModul) mir_snprintf(setting, "{%s/%s}Timeout", ptd->notification.lpzGroup, ptd->notification.lpzName); - db_set_w(NULL, szModul, setting, ptd->notification.iSeconds); + db_set_w(0, szModul, setting, ptd->notification.iSeconds); mir_snprintf(setting, "{%s/%s}enabled", ptd->notification.lpzGroup, ptd->notification.lpzName); - db_set_b(NULL, szModul, setting, ptd->enabled); + db_set_b(0, szModul, setting, ptd->enabled); mir_snprintf(setting, "{%s/%s}TimeoutVal", ptd->notification.lpzGroup, ptd->notification.lpzName); - db_set_w(NULL, szModul, setting, ptd->timeoutValue); + db_set_w(0, szModul, setting, ptd->timeoutValue); mir_snprintf(setting, "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName); - db_set_b(NULL, szModul, setting, ptd->disableWhen); + db_set_b(0, szModul, setting, ptd->disableWhen); mir_snprintf(setting, "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName); - db_set_s(NULL, szModul, setting, ptd->leftAction); + db_set_s(0, szModul, setting, ptd->leftAction); mir_snprintf(setting, "{%s/%s}rightAction", ptd->notification.lpzGroup, ptd->notification.lpzName); - db_set_s(NULL, szModul, setting, ptd->rightAction); + db_set_s(0, szModul, setting, ptd->rightAction); for (int i = 0; i < ptd->notification.actionCount; ++i) { POPUPNOTIFYACTION &p = ptd->notification.lpActions[i]; @@ -140,28 +140,28 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, "{%s/%s}enabled", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->enabled = - (signed char)db_get_b(NULL, szModul, setting, TRUE); + (signed char)db_get_b(0, szModul, setting, TRUE); mir_snprintf(setting, "{%s/%s}Timeout", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->notification.iSeconds = - (signed char)db_get_w(NULL, szModul, setting, ptd->notification.iSeconds); + (signed char)db_get_w(0, szModul, setting, ptd->notification.iSeconds); mir_snprintf(setting, "{%s/%s}TimeoutVal", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->timeoutValue = - (signed char)db_get_w(NULL, szModul, setting, + (signed char)db_get_w(0, szModul, setting, ptd->notification.iSeconds ? ptd->notification.iSeconds : 0); mir_snprintf(setting, "{%s/%s}disableWhen", ptd->notification.lpzGroup, ptd->notification.lpzName); ptd->disableWhen = - db_get_b(NULL, szModul, setting, 0); + db_get_b(0, szModul, setting, 0); mir_snprintf(setting, "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName); - char *szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzLAction); + char *szTmp = db_get_s(0, szModul, setting, ptd->notification.lpzLAction); mir_strncpy(ptd->leftAction, szTmp, sizeof(ptd->leftAction)); mir_free(szTmp); szTmp = nullptr; mir_snprintf(setting, "{%s/%s}rightAction", ptd->notification.lpzGroup, ptd->notification.lpzName); - szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzRAction); + szTmp = db_get_s(0, szModul, setting, ptd->notification.lpzRAction); mir_strncpy(ptd->rightAction, szTmp, sizeof(ptd->rightAction)); mir_free(szTmp); szTmp = nullptr; } diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp index 235e60833a..e279e7ebb2 100644 --- a/plugins/Popup/src/opt_adv.cpp +++ b/plugins/Popup/src/opt_adv.cpp @@ -46,34 +46,34 @@ void OptAdv_UnregisterVfx() void LoadOption_AdvOpts() { // History - PopupOptions.EnableHistory = db_get_b(NULL, MODULENAME, "EnableHistory", TRUE); - PopupOptions.HistorySize = db_get_w(NULL, MODULENAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT); - PopupOptions.UseHppHistoryLog = db_get_b(NULL, MODULENAME, "UseHppHistoryLog", TRUE); + PopupOptions.EnableHistory = g_plugin.getByte("EnableHistory", TRUE); + PopupOptions.HistorySize = g_plugin.getWord("HistorySize", SETTING_HISTORYSIZE_DEFAULT); + PopupOptions.UseHppHistoryLog = g_plugin.getByte("UseHppHistoryLog", TRUE); // Avatars - PopupOptions.avatarBorders = db_get_b(NULL, MODULENAME, "AvatarBorders", TRUE); - PopupOptions.avatarPNGBorders = db_get_b(NULL, MODULENAME, "AvatarPNGBorders", FALSE); - PopupOptions.avatarRadius = db_get_b(NULL, MODULENAME, "AvatarRadius", 2); - PopupOptions.avatarSize = db_get_w(NULL, MODULENAME, "AvatarSize", SETTING_AVTSIZE_DEFAULT); - PopupOptions.EnableAvatarUpdates = db_get_b(NULL, MODULENAME, "EnableAvatarUpdates", FALSE); + PopupOptions.avatarBorders = g_plugin.getByte("AvatarBorders", TRUE); + PopupOptions.avatarPNGBorders = g_plugin.getByte("AvatarPNGBorders", FALSE); + PopupOptions.avatarRadius = g_plugin.getByte("AvatarRadius", 2); + PopupOptions.avatarSize = g_plugin.getWord("AvatarSize", SETTING_AVTSIZE_DEFAULT); + PopupOptions.EnableAvatarUpdates = g_plugin.getByte("EnableAvatarUpdates", FALSE); // Monitor - PopupOptions.Monitor = db_get_b(NULL, MODULENAME, "Monitor", SETTING_MONITOR_DEFAULT); + PopupOptions.Monitor = g_plugin.getByte("Monitor", SETTING_MONITOR_DEFAULT); // Transparency - PopupOptions.UseTransparency = db_get_b(NULL, MODULENAME, "UseTransparency", TRUE); - PopupOptions.Alpha = db_get_b(NULL, MODULENAME, "Alpha", SETTING_ALPHA_DEFAULT); - PopupOptions.OpaqueOnHover = db_get_b(NULL, MODULENAME, "OpaqueOnHover", TRUE); + PopupOptions.UseTransparency = g_plugin.getByte("UseTransparency", TRUE); + PopupOptions.Alpha = g_plugin.getByte("Alpha", SETTING_ALPHA_DEFAULT); + PopupOptions.OpaqueOnHover = g_plugin.getByte("OpaqueOnHover", TRUE); // Effects - PopupOptions.UseAnimations = db_get_b(NULL, MODULENAME, "UseAnimations", TRUE); - PopupOptions.UseEffect = db_get_b(NULL, MODULENAME, "Fade", TRUE); - PopupOptions.Effect = (LPTSTR)DBGetContactSettingStringX(NULL, MODULENAME, "Effect", "", DBVT_WCHAR); - PopupOptions.FadeIn = db_get_dw(NULL, MODULENAME, "FadeInTime", SETTING_FADEINTIME_DEFAULT); - PopupOptions.FadeOut = db_get_dw(NULL, MODULENAME, "FadeOutTime", SETTING_FADEOUTTIME_DEFAULT); + PopupOptions.UseAnimations = g_plugin.getByte("UseAnimations", TRUE); + PopupOptions.UseEffect = g_plugin.getByte("Fade", TRUE); + PopupOptions.Effect = (LPTSTR)DBGetContactSettingStringX(0, MODULENAME, "Effect", "", DBVT_WCHAR); + PopupOptions.FadeIn = g_plugin.getDword("FadeInTime", SETTING_FADEINTIME_DEFAULT); + PopupOptions.FadeOut = g_plugin.getDword("FadeOutTime", SETTING_FADEOUTTIME_DEFAULT); // other old stuff - PopupOptions.MaxPopups = db_get_w(NULL, MODULENAME, "MaxPopups", 20); + PopupOptions.MaxPopups = g_plugin.getWord("MaxPopups", 20); } INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -492,31 +492,31 @@ INT_PTR CALLBACK DlgProcPopupAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY: // History - db_set_b(NULL, MODULENAME, "EnableHistory", (BYTE)PopupOptions.EnableHistory); - db_set_w(NULL, MODULENAME, "HistorySize", PopupOptions.HistorySize); + g_plugin.setByte("EnableHistory", (BYTE)PopupOptions.EnableHistory); + g_plugin.setWord("HistorySize", PopupOptions.HistorySize); PopupHistoryResize(); - db_set_b(NULL, MODULENAME, "UseHppHistoryLog", PopupOptions.UseHppHistoryLog); + g_plugin.setByte("UseHppHistoryLog", PopupOptions.UseHppHistoryLog); // Avatars - db_set_b(NULL, MODULENAME, "AvatarBorders", PopupOptions.avatarBorders); - db_set_b(NULL, MODULENAME, "AvatarPNGBorders", PopupOptions.avatarPNGBorders); - db_set_b(NULL, MODULENAME, "AvatarRadius", PopupOptions.avatarRadius); - db_set_w(NULL, MODULENAME, "AvatarSize", PopupOptions.avatarSize); - db_set_b(NULL, MODULENAME, "EnableAvatarUpdates", PopupOptions.EnableAvatarUpdates); + g_plugin.setByte("AvatarBorders", PopupOptions.avatarBorders); + g_plugin.setByte("AvatarPNGBorders", PopupOptions.avatarPNGBorders); + g_plugin.setByte("AvatarRadius", PopupOptions.avatarRadius); + g_plugin.setWord("AvatarSize", PopupOptions.avatarSize); + g_plugin.setByte("EnableAvatarUpdates", PopupOptions.EnableAvatarUpdates); // Monitor - db_set_b(NULL, MODULENAME, "Monitor", PopupOptions.Monitor); + g_plugin.setByte("Monitor", PopupOptions.Monitor); // Transparency - db_set_b(NULL, MODULENAME, "UseTransparency", PopupOptions.UseTransparency); - db_set_b(NULL, MODULENAME, "Alpha", PopupOptions.Alpha); - db_set_b(NULL, MODULENAME, "OpaqueOnHover", PopupOptions.OpaqueOnHover); + g_plugin.setByte("UseTransparency", PopupOptions.UseTransparency); + g_plugin.setByte("Alpha", PopupOptions.Alpha); + g_plugin.setByte("OpaqueOnHover", PopupOptions.OpaqueOnHover); // Effects - db_set_b(NULL, MODULENAME, "UseAnimations", PopupOptions.UseAnimations); - db_set_b(NULL, MODULENAME, "Fade", PopupOptions.UseEffect); - db_set_ws(NULL, MODULENAME, "Effect", PopupOptions.Effect); - db_set_dw(NULL, MODULENAME, "FadeInTime", PopupOptions.FadeIn); - db_set_dw(NULL, MODULENAME, "FadeOutTime", PopupOptions.FadeOut); + g_plugin.setByte("UseAnimations", PopupOptions.UseAnimations); + g_plugin.setByte("Fade", PopupOptions.UseEffect); + g_plugin.setWString("Effect", PopupOptions.Effect); + g_plugin.setDword("FadeInTime", PopupOptions.FadeIn); + g_plugin.setDword("FadeOutTime", PopupOptions.FadeOut); // other old stuff - db_set_w(NULL, MODULENAME, "MaxPopups", (BYTE)PopupOptions.MaxPopups); + g_plugin.setWord("MaxPopups", (BYTE)PopupOptions.MaxPopups); } return TRUE; } diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 415d9a2cdb..4b38d22a18 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -483,24 +483,24 @@ void LoadClassSettings(POPUPTREEDATA *ptd, char* szModul) char setting[2 * MAXMODULELABELLENGTH]; mir_snprintf(setting, "%s/enabled", ptd->pupClass.pszName); ptd->enabled = - (signed char)db_get_b(NULL, szModul, setting, TRUE); + (signed char)db_get_b(0, szModul, setting, TRUE); mir_snprintf(setting, "%s/Timeout", ptd->pupClass.pszName); ptd->pupClass.iSeconds = - (signed char)db_get_w(NULL, szModul, setting, 0); + (signed char)db_get_w(0, szModul, setting, 0); mir_snprintf(setting, "%s/TimeoutVal", ptd->pupClass.pszName); ptd->timeoutValue = - (signed char)db_get_w(NULL, szModul, setting, + (signed char)db_get_w(0, szModul, setting, ptd->pupClass.iSeconds ? ptd->pupClass.iSeconds : PopupOptions.Seconds); mir_snprintf(setting, "%s/leftAction", ptd->pupClass.pszName); - char *szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_NOTHING); // standart ?? + char *szTmp = db_get_s(0, szModul, setting, POPUP_ACTION_NOTHING); // standart ?? mir_strncpy(ptd->leftAction, szTmp, _countof(ptd->leftAction)); mir_free(szTmp); mir_snprintf(setting, "%s/rightAction", ptd->pupClass.pszName); - szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_DISMISS); // standart ?? + szTmp = db_get_s(0, szModul, setting, POPUP_ACTION_DISMISS); // standart ?? mir_strncpy(ptd->rightAction, szTmp, _countof(ptd->rightAction)); mir_free(szTmp); } @@ -510,17 +510,17 @@ void SaveClassSettings(POPUPTREEDATA *ptd, char* szModul) char setting[2 * MAXMODULELABELLENGTH]; mir_snprintf(setting, "%s/enabled", ptd->pupClass.pszName); - db_set_b(NULL, szModul, setting, ptd->enabled); + db_set_b(0, szModul, setting, ptd->enabled); mir_snprintf(setting, "%s/Timeout", ptd->pupClass.pszName); - db_set_w(NULL, szModul, setting, ptd->pupClass.iSeconds); + db_set_w(0, szModul, setting, ptd->pupClass.iSeconds); mir_snprintf(setting, "%s/TimeoutVal", ptd->pupClass.pszName); - db_set_w(NULL, szModul, setting, ptd->timeoutValue); + db_set_w(0, szModul, setting, ptd->timeoutValue); mir_snprintf(setting, "%s/leftAction", ptd->pupClass.pszName); - db_set_s(NULL, szModul, setting, ptd->leftAction); + db_set_s(0, szModul, setting, ptd->leftAction); mir_snprintf(setting, "%s/rightAction", ptd->pupClass.pszName); - db_set_s(NULL, szModul, setting, ptd->rightAction); + db_set_s(0, szModul, setting, ptd->rightAction); } diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index c77cae67e9..80620f84dd 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -89,40 +89,40 @@ int AddStatusModes(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flags) void LoadOption_General() { // Seconds - PopupOptions.InfiniteDelay = db_get_b(NULL, MODULENAME, "InfiniteDelay", FALSE); + PopupOptions.InfiniteDelay = g_plugin.getByte("InfiniteDelay", FALSE); PopupOptions.Seconds = - DBGetContactSettingRangedWord(NULL, MODULENAME, "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX); - PopupOptions.LeaveHovered = db_get_b(NULL, MODULENAME, "LeaveHovered", TRUE); + DBGetContactSettingRangedWord(0, MODULENAME, "Seconds", SETTING_LIFETIME_DEFAULT, SETTING_LIFETIME_MIN, SETTING_LIFETIME_MAX); + PopupOptions.LeaveHovered = g_plugin.getByte("LeaveHovered", TRUE); // Dynamic Resize - PopupOptions.DynamicResize = db_get_b(NULL, MODULENAME, "DynamicResize", FALSE); - PopupOptions.UseMinimumWidth = db_get_b(NULL, MODULENAME, "UseMinimumWidth", TRUE); - PopupOptions.MinimumWidth = db_get_w(NULL, MODULENAME, "MinimumWidth", 160); - PopupOptions.UseMaximumWidth = db_get_b(NULL, MODULENAME, "UseMaximumWidth", TRUE); - PopupOptions.MaximumWidth = db_get_w(NULL, MODULENAME, "MaximumWidth", 300); + PopupOptions.DynamicResize = g_plugin.getByte("DynamicResize", FALSE); + PopupOptions.UseMinimumWidth = g_plugin.getByte("UseMinimumWidth", TRUE); + PopupOptions.MinimumWidth = g_plugin.getWord("MinimumWidth", 160); + PopupOptions.UseMaximumWidth = g_plugin.getByte("UseMaximumWidth", TRUE); + PopupOptions.MaximumWidth = g_plugin.getWord("MaximumWidth", 300); // Position PopupOptions.Position = - DBGetContactSettingRangedByte(NULL, MODULENAME, "Position", POS_LOWERRIGHT, POS_MINVALUE, POS_MAXVALUE); + DBGetContactSettingRangedByte(0, MODULENAME, "Position", POS_LOWERRIGHT, POS_MINVALUE, POS_MAXVALUE); // Configure popup area - PopupOptions.gapTop = db_get_w(NULL, MODULENAME, "gapTop", 5); - PopupOptions.gapBottom = db_get_w(NULL, MODULENAME, "gapBottom", 5); - PopupOptions.gapLeft = db_get_w(NULL, MODULENAME, "gapLeft", 5); - PopupOptions.gapRight = db_get_w(NULL, MODULENAME, "gapRight", 5); - PopupOptions.spacing = db_get_w(NULL, MODULENAME, "spacing", 5); + PopupOptions.gapTop = g_plugin.getWord("gapTop", 5); + PopupOptions.gapBottom = g_plugin.getWord("gapBottom", 5); + PopupOptions.gapLeft = g_plugin.getWord("gapLeft", 5); + PopupOptions.gapRight = g_plugin.getWord("gapRight", 5); + PopupOptions.spacing = g_plugin.getWord("spacing", 5); // Spreading PopupOptions.Spreading = - DBGetContactSettingRangedByte(NULL, MODULENAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE); + DBGetContactSettingRangedByte(0, MODULENAME, "Spreading", SPREADING_VERTICAL, SPREADING_MINVALUE, SPREADING_MAXVALUE); // miscellaneous - PopupOptions.ReorderPopups = db_get_b(NULL, MODULENAME, "ReorderPopups", TRUE); - PopupOptions.ReorderPopupsWarning = db_get_b(NULL, MODULENAME, "ReorderPopupsWarning", TRUE); + PopupOptions.ReorderPopups = g_plugin.getByte("ReorderPopups", TRUE); + PopupOptions.ReorderPopupsWarning = g_plugin.getByte("ReorderPopupsWarning", TRUE); // disable When - PopupOptions.ModuleIsEnabled = db_get_b(NULL, "Popup", "ModuleIsEnabled", TRUE); - PopupOptions.DisableWhenFullscreen = db_get_b(NULL, MODULENAME, "DisableWhenFullscreen", TRUE); + PopupOptions.ModuleIsEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", TRUE); + PopupOptions.DisableWhenFullscreen = g_plugin.getByte("DisableWhenFullscreen", TRUE); } INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -243,10 +243,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM wchar_t pszSettingName[256]; mir_snwprintf(pszSettingName, LPGENW("Protocol Status")L"/%s", pa->tszAccountName); - OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULENAME, prefix, 0), pszSettingName); + OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, g_plugin.getDword(prefix, 0), pszSettingName); } } - OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, db_get_dw(NULL, MODULENAME, "Global Status", 0), LPGENW("Global Status")); + OptTree_SetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, g_plugin.getDword("Global Status", 0), LPGENW("Global Status")); } TranslateDialogDefault(hwnd); // do it on end of WM_INITDIALOG @@ -335,7 +335,7 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDC_REORDERPOPUPS: PopupOptions.ReorderPopups = !PopupOptions.ReorderPopups; - PopupOptions.ReorderPopupsWarning = PopupOptions.ReorderPopups ? db_get_b(NULL, MODULENAME, "ReorderPopupsWarning", TRUE) : TRUE; + PopupOptions.ReorderPopupsWarning = PopupOptions.ReorderPopups ? g_plugin.getByte("ReorderPopupsWarning", TRUE) : TRUE; SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); break; @@ -485,35 +485,35 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case PSN_APPLY: // Seconds - db_set_b(NULL, MODULENAME, "InfiniteDelay", PopupOptions.InfiniteDelay); - db_set_w(NULL, MODULENAME, "Seconds", (WORD)PopupOptions.Seconds); - db_set_b(NULL, MODULENAME, "LeaveHovered", PopupOptions.LeaveHovered); + g_plugin.setByte("InfiniteDelay", PopupOptions.InfiniteDelay); + g_plugin.setWord("Seconds", (WORD)PopupOptions.Seconds); + g_plugin.setByte("LeaveHovered", PopupOptions.LeaveHovered); // Dynamic Resize - db_set_b(NULL, MODULENAME, "DynamicResize", PopupOptions.DynamicResize); - db_set_b(NULL, MODULENAME, "UseMinimumWidth", PopupOptions.UseMinimumWidth); - db_set_w(NULL, MODULENAME, "MinimumWidth", PopupOptions.MinimumWidth); - db_set_b(NULL, MODULENAME, "UseMaximumWidth", PopupOptions.UseMaximumWidth); - db_set_w(NULL, MODULENAME, "MaximumWidth", PopupOptions.MaximumWidth); + g_plugin.setByte("DynamicResize", PopupOptions.DynamicResize); + g_plugin.setByte("UseMinimumWidth", PopupOptions.UseMinimumWidth); + g_plugin.setWord("MinimumWidth", PopupOptions.MinimumWidth); + g_plugin.setByte("UseMaximumWidth", PopupOptions.UseMaximumWidth); + g_plugin.setWord("MaximumWidth", PopupOptions.MaximumWidth); // Position - db_set_b(NULL, MODULENAME, "Position", (BYTE)PopupOptions.Position); + g_plugin.setByte("Position", (BYTE)PopupOptions.Position); // Configure popup area - db_set_w(NULL, MODULENAME, "gapTop", (WORD)PopupOptions.gapTop); - db_set_w(NULL, MODULENAME, "gapBottom", (WORD)PopupOptions.gapBottom); - db_set_w(NULL, MODULENAME, "gapLeft", (WORD)PopupOptions.gapLeft); - db_set_w(NULL, MODULENAME, "gapRight", (WORD)PopupOptions.gapRight); - db_set_w(NULL, MODULENAME, "spacing", (WORD)PopupOptions.spacing); + g_plugin.setWord("gapTop", (WORD)PopupOptions.gapTop); + g_plugin.setWord("gapBottom", (WORD)PopupOptions.gapBottom); + g_plugin.setWord("gapLeft", (WORD)PopupOptions.gapLeft); + g_plugin.setWord("gapRight", (WORD)PopupOptions.gapRight); + g_plugin.setWord("spacing", (WORD)PopupOptions.spacing); // Spreading - db_set_b(NULL, MODULENAME, "Spreading", (BYTE)PopupOptions.Spreading); + g_plugin.setByte("Spreading", (BYTE)PopupOptions.Spreading); // miscellaneous Check_ReorderPopups(hwnd); // this save also PopupOptions.ReorderPopups // disable When - db_set_b(NULL, MODULENAME, "DisableWhenFullscreen", PopupOptions.DisableWhenFullscreen); + g_plugin.setByte("DisableWhenFullscreen", PopupOptions.DisableWhenFullscreen); // new status options for (auto &pa : Accounts()) @@ -523,10 +523,10 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM wchar_t pszSettingName[256]; mir_snwprintf(pszSettingName, L"Protocol Status/%s", pa->tszAccountName); - db_set_dw(NULL, MODULENAME, prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName)); + g_plugin.setDword(prefix, OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, pszSettingName)); } - db_set_dw(NULL, MODULENAME, "Global Status", OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, L"Global Status")); + g_plugin.setDword("Global Status", OptTree_GetOptions(hwnd, IDC_STATUSES, statusOptions, statusOptionsCount, L"Global Status")); return TRUE; } break; @@ -598,8 +598,8 @@ void Check_ReorderPopups(HWND hwnd) return; } } - db_set_b(NULL, MODULENAME, "ReorderPopups", PopupOptions.ReorderPopups); - db_set_b(NULL, MODULENAME, "ReorderPopupsWarning", PopupOptions.ReorderPopupsWarning); + g_plugin.setByte("ReorderPopups", PopupOptions.ReorderPopups); + g_plugin.setByte("ReorderPopupsWarning", PopupOptions.ReorderPopupsWarning); if (hwnd) CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups ? BST_CHECKED : BST_UNCHECKED); } diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index cca1efd0b9..ba678c497e 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -282,7 +282,7 @@ bool SkinOptionList_Update(OPTTREE_OPTION* &options, int *OptionsCount, HWND hwn char prefix[128]; mir_snprintf(prefix, "skin.%S", PopupOptions.SkinPack); OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount, - db_get_dw(NULL, MODULENAME, prefix, dwSkinOptions), L"Skin options"); + g_plugin.getDword(prefix, dwSkinOptions), L"Skin options"); // check "Global Settings" OptTree_SetOptions(hwndDlg, IDC_SKIN_LIST_OPT, options, *OptionsCount, @@ -293,14 +293,14 @@ bool SkinOptionList_Update(OPTTREE_OPTION* &options, int *OptionsCount, HWND hwn void LoadOption_Skins() { // skin pack - PopupOptions.SkinPack = (LPTSTR)DBGetContactSettingStringX(NULL, MODULENAME, "SkinPack", "* Popup Classic", DBVT_WCHAR); + PopupOptions.SkinPack = (LPTSTR)DBGetContactSettingStringX(0, MODULENAME, "SkinPack", "* Popup Classic", DBVT_WCHAR); // more Skin options - PopupOptions.DisplayTime = db_get_b(NULL, MODULENAME, "DisplayTime", TRUE); - PopupOptions.DropShadow = db_get_b(NULL, MODULENAME, "DropShadow", TRUE); - PopupOptions.EnableFreeformShadows = db_get_b(NULL, MODULENAME, "EnableShadowRegion", 1); - PopupOptions.EnableAeroGlass = db_get_b(NULL, MODULENAME, "EnableAeroGlass", 1); - PopupOptions.UseWinColors = db_get_b(NULL, MODULENAME, "UseWinColors", FALSE); - PopupOptions.UseMText = db_get_b(NULL, MODULENAME, "UseMText", TRUE); + PopupOptions.DisplayTime = g_plugin.getByte("DisplayTime", TRUE); + PopupOptions.DropShadow = g_plugin.getByte("DropShadow", TRUE); + PopupOptions.EnableFreeformShadows = g_plugin.getByte("EnableShadowRegion", 1); + PopupOptions.EnableAeroGlass = g_plugin.getByte("EnableAeroGlass", 1); + PopupOptions.UseWinColors = g_plugin.getByte("UseWinColors", FALSE); + PopupOptions.UseMText = g_plugin.getByte("UseMText", TRUE); } INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -477,19 +477,19 @@ INT_PTR CALLBACK DlgProcPopSkinsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case PSN_APPLY: { // skin pack - db_set_ws(NULL, MODULENAME, "SkinPack", PopupOptions.SkinPack); + g_plugin.setWString("SkinPack", PopupOptions.SkinPack); // skin options const PopupSkin *skin = nullptr; if (skin = skins.getSkin(PopupOptions.SkinPack)) skin->saveOpts(); skins.freeAllButActive(); // more Skin options - db_set_b(NULL, MODULENAME, "DisplayTime", PopupOptions.DisplayTime); - db_set_b(NULL, MODULENAME, "DropShadow", PopupOptions.DropShadow); - db_set_b(NULL, MODULENAME, "EnableShadowRegion", PopupOptions.EnableFreeformShadows); - db_set_b(NULL, MODULENAME, "EnableAeroGlass", PopupOptions.EnableAeroGlass); - db_set_b(NULL, MODULENAME, "UseWinColors", PopupOptions.UseWinColors); - db_set_b(NULL, MODULENAME, "UseMText", PopupOptions.UseMText); + g_plugin.setByte("DisplayTime", PopupOptions.DisplayTime); + g_plugin.setByte("DropShadow", PopupOptions.DropShadow); + g_plugin.setByte("EnableShadowRegion", PopupOptions.EnableFreeformShadows); + g_plugin.setByte("EnableAeroGlass", PopupOptions.EnableAeroGlass); + g_plugin.setByte("UseWinColors", PopupOptions.UseWinColors); + g_plugin.setByte("UseMText", PopupOptions.UseMText); }// end PSN_APPLY: return TRUE; }// switch (((LPNMHDR)lParam)->code) diff --git a/plugins/Popup/src/popup_thread.cpp b/plugins/Popup/src/popup_thread.cpp index 6aecc57af8..6d86c83432 100644 --- a/plugins/Popup/src/popup_thread.cpp +++ b/plugins/Popup/src/popup_thread.cpp @@ -152,7 +152,7 @@ static LRESULT CALLBACK PopupThreadManagerWndProc(HWND hwnd, UINT message, WPARA switch (message) { case UTM_STOP_THREAD: gTerminating = true; - if (db_get_b(NULL, MODULENAME, "FastExit", 0)) + if (g_plugin.getByte("FastExit", 0)) for (auto &it : popupList) PUDeletePopup(it->getHwnd()); PostQuitMessage(0); diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp index 3490c2a25f..058b565150 100644 --- a/plugins/Popup/src/services.cpp +++ b/plugins/Popup/src/services.cpp @@ -138,7 +138,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) if (PopupOptions.DisableWhenFullscreen && (bShowMode != PU_SHOWMODE_FULLSCREEN) && IsFullScreen()) return -1; - if (db_get_dw(NULL, MODULENAME, LPGEN("Global Status"), 0) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0))) + if (g_plugin.getDword(LPGEN("Global Status"), 0) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0))) return -1; if ((disableWhen & 0x0000FFFF) & Proto_Status2Flag_My(CallService(MS_CLIST_GETSTATUSMODE, 0, 0))) @@ -147,7 +147,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam) if (proto) { char prefix[128]; mir_snprintf(prefix, LPGEN("Protocol Status") "/%s", GetContactProto(ppd->lchContact)); - if (db_get_dw(NULL, MODULENAME, prefix, 0) & Proto_Status2Flag_My(Proto_GetStatus(proto))) + if (g_plugin.getDword(prefix, 0) & Proto_Status2Flag_My(Proto_GetStatus(proto))) return -1; if (((disableWhen >> 16) & 0xFFFF0000) & Proto_Status2Flag_My(Proto_GetStatus(proto))) return -1; @@ -379,7 +379,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) // we ignore pc->colorText and use fonts.text as default (if no setting found in DB) mir_snprintf(setting, "%s/TextCol", ptd->pupClass.pszName); - ptd->pupClass.colorText = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/); + ptd->pupClass.colorText = (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, fonts.clText/*pc->colorText*/); FontIDW fid = {}; mir_snwprintf(fid.group, L"%S/%s", PU_FNT_AND_COLOR, ptd->pszDescription); @@ -397,7 +397,7 @@ INT_PTR Popup_RegisterPopupClass(WPARAM, LPARAM lParam) // we ignore pc->colorBack and use fonts.clBack as default (if no setting found in DB) mir_snprintf(setting, "%s/BgCol", ptd->pupClass.pszName); - ptd->pupClass.colorBack = (COLORREF)db_get_dw(NULL, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/); + ptd->pupClass.colorBack = (COLORREF)db_get_dw(0, PU_MODULCLASS, setting, (DWORD)fonts.clBack/*pc->colorBack*/); ColourIDW cid = {}; mir_snwprintf(cid.group, L"%S/%s", PU_FNT_AND_COLOR, ptd->pszDescription); diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 0ccfdca254..477bc9f533 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -524,7 +524,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, POPUPOPTIONS *options, DW if (textAreaWidth <= 0) textAreaWidth = wnd->getRenderInfo()->realtextw; drawActionBar(bmp, wnd, - db_get_b(NULL, MODULENAME, "CenterActions", 0) ? + g_plugin.getByte("CenterActions", 0) ? (pt.x + (textAreaWidth - wnd->getRenderInfo()->actw) / 2) : (PopupOptions.actions & ACT_RIGHTICONS) ? (pt.x + textAreaWidth - wnd->getRenderInfo()->actw) : @@ -1046,14 +1046,14 @@ void PopupSkin::saveOpts() const { char buf[128]; mir_snprintf(buf, "skin.%.120S", m_name); - db_set_dw(NULL, MODULENAME, buf, m_flags); + g_plugin.setDword(buf, m_flags); } void PopupSkin::loadOpts() const { char buf[128]; mir_snprintf(buf, "skin.%.120S", m_name); - m_flags = db_get_dw(NULL, MODULENAME, buf, m_flags); + m_flags = g_plugin.getDword(buf, m_flags); } // Skins -- cgit v1.2.3