summaryrefslogtreecommitdiff
path: root/plugins/Popup/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-02-09 17:40:09 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-02-09 17:40:09 +0300
commita43d5bcb1e0bdafb0193662168976aac989ed922 (patch)
treec4f154f05f36626678efc64ae7a1139b30b5f4fe /plugins/Popup/src
parent760867149a99443036f53c73190d53bd87039def (diff)
db_is_module_empty & db_copy_module - new database helpers
Diffstat (limited to 'plugins/Popup/src')
-rw-r--r--plugins/Popup/src/config.cpp33
1 files changed, 4 insertions, 29 deletions
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp
index 5dbcca1324..0f1a3ad934 100644
--- a/plugins/Popup/src/config.cpp
+++ b/plugins/Popup/src/config.cpp
@@ -103,40 +103,15 @@ void PopupPreview()
//////////////////////////////////////////////////////////////////////////////////////////////
-struct EnumProcParam
-{
- LPCSTR szModule, szNewModule;
-};
-
-static int EnumProc(const char *szSetting, void *lParam)
-{
- EnumProcParam* param = (EnumProcParam*)lParam;
-
- DBVARIANT dbv;
- if (!db_get(NULL, param->szModule, szSetting, &dbv)) {
- db_set(NULL, param->szNewModule, szSetting, &dbv);
- db_free(&dbv);
- }
- return 0;
-}
-
-static void CopyModule(const char *szModule, const char *szNewModule)
-{
- EnumProcParam param = { szModule, szNewModule };
- db_enum_settings(NULL, EnumProc, szModule, &param);
-
- db_delete_module(0, szModule);
-}
-
void UpgradeDb()
{
if (db_get_b(0, "Compatibility", "Popup+ Opts", 0) == 1)
return;
- CopyModule("PopUp", "Popup");
- CopyModule("PopUpCLASS", "PopupCLASS");
- CopyModule("PopUpActions", "PopupActions");
- CopyModule("PopUpNotifications", "PopupNotifications");
+ db_copy_module("PopUp", "Popup");
+ db_copy_module("PopUpCLASS", "PopupCLASS");
+ db_copy_module("PopUpActions", "PopupActions");
+ db_copy_module("PopUpNotifications", "PopupNotifications");
db_set_b(0, "Compatibility", "Popup+ Opts", 1);
}