summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/config.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-03 18:31:26 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-03 18:31:26 +0000
commitc2a98771e0d195ca4d5be500f4c8ba9fd012d676 (patch)
tree1c99fcc878fbf0c72fa0f4140ad0390cc6d235fe /plugins/Popup/src/config.cpp
parent5ae20d4da68c98c2a0d851b4b45da9181e61781c (diff)
- settings convertor for Popup+;
- various DBCONTACTENUMSETTINGS initialization garbage git-svn-id: http://svn.miranda-ng.org/main/trunk@5922 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src/config.cpp')
-rw-r--r--plugins/Popup/src/config.cpp46
1 files changed, 45 insertions, 1 deletions
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp
index 66fba97b46..79fad37a1d 100644
--- a/plugins/Popup/src/config.cpp
+++ b/plugins/Popup/src/config.cpp
@@ -127,4 +127,48 @@ void PopupPreview()
if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME*2)/3); //Pause
PUShowMessageT(TranslateT("This is an error message"), (DWORD)SM_ERROR|0x80000000);
-} \ No newline at end of file
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////
+
+struct EnumProcParam
+{
+ LPCSTR szModule, szNewModule;
+};
+
+static int EnumProc(const char *szSetting, LPARAM 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 };
+
+ DBCONTACTENUMSETTINGS dbces = { 0 };
+ dbces.pfnEnumProc = EnumProc;
+ dbces.szModule = szModule;
+ dbces.lParam = (LPARAM)&param;
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+
+ CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)szModule);
+}
+
+void UpgradeDb()
+{
+ if (db_get_b(NULL, "Compatibility", "Popup+ Opts", 0) == 1)
+ return;
+
+ CopyModule("PopUp", "Popup");
+ CopyModule("PopUpCLASS", "PopupCLASS");
+ CopyModule("PopUpNotifications", "PopupNotifications");
+
+ db_set_b(NULL, "Compatibility", "Popup+ Opts", 1);
+}