diff options
author | George Hazan <ghazan@miranda.im> | 2022-02-09 17:40:09 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-02-09 17:40:09 +0300 |
commit | a43d5bcb1e0bdafb0193662168976aac989ed922 (patch) | |
tree | c4f154f05f36626678efc64ae7a1139b30b5f4fe /plugins/Popup | |
parent | 760867149a99443036f53c73190d53bd87039def (diff) |
db_is_module_empty & db_copy_module - new database helpers
Diffstat (limited to 'plugins/Popup')
-rw-r--r-- | plugins/Popup/src/config.cpp | 33 |
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, ¶m);
-
- 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);
}
|