summaryrefslogtreecommitdiff
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
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
-rw-r--r--plugins/Popup/src/config.cpp46
-rw-r--r--plugins/Popup/src/main.cpp2
-rw-r--r--plugins/Popup/src/version.h2
-rw-r--r--plugins/TabSRMM/src/buttonsbar.cpp9
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp1
-rw-r--r--protocols/IRCG/src/ircproto.cpp4
-rw-r--r--protocols/IRCG/src/options.cpp2
-rw-r--r--protocols/IcqOscarJ/src/icq_servlist.cpp7
-rw-r--r--protocols/IcqOscarJ/src/icq_uploadui.cpp8
9 files changed, 60 insertions, 21 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);
+}
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index c74ca3551e..880d92c0c3 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -36,6 +36,7 @@ WORD SETTING_MAXIMUMWIDTH_MAX = GetSystemMetrics(SM_CXSCREEN);
//===== Options =====
static int OptionsInitialize(WPARAM,LPARAM);
+void UpgradeDb();
//===== Initializations =====
static int OkToExit(WPARAM,LPARAM);
@@ -365,6 +366,7 @@ MIRAPI int Load(void)
RegisterOptPrevBox();
// Register in DBEditor++
+ UpgradeDb();
db_set_s(NULL, "KnownModules", pluginInfoEx.shortName, MODULNAME);
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
diff --git a/plugins/Popup/src/version.h b/plugins/Popup/src/version.h
index 5249a5a35a..f7d477b703 100644
--- a/plugins/Popup/src/version.h
+++ b/plugins/Popup/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 1
-#define __BUILD_NUM 7
+#define __BUILD_NUM 8
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp
index afac6207cb..27b3fa1c16 100644
--- a/plugins/TabSRMM/src/buttonsbar.cpp
+++ b/plugins/TabSRMM/src/buttonsbar.cpp
@@ -103,20 +103,19 @@ static int DBRemoveEnumProc(const char *szSetting, LPARAM lParam)
static int Hlp_RemoveDatabaseSettings(HANDLE hContact, char *szModule, char *szPrefix)
{
- DBCONTACTENUMSETTINGS dbces;
RemoveSettings rs;
int i, count;
ZeroMemory(&rs, sizeof(RemoveSettings));
rs.szPrefix = szPrefix;
- ZeroMemory(&dbces, sizeof(DBCONTACTENUMSETTINGS));
+
+ DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = DBRemoveEnumProc;
dbces.lParam = (LPARAM)&rs;
dbces.szModule = szModule;
- if (CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)(HANDLE)hContact, (LPARAM)&dbces) == -1) {
-
+ if (CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)(HANDLE)hContact, (LPARAM)&dbces) == -1)
return -1;
- }
+
count = 0;
if (rs.szSettings != NULL) {
for (i=0; i < rs.count; i++) {
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 5e414b6123..22e859bd0e 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -275,7 +275,6 @@ void CSendLater::processSingleContact(const HANDLE hContact)
if (iCount) {
DBCONTACTENUMSETTINGS ces = {0};
-
ces.pfnEnumProc = CSendLater::addStub;
ces.szModule = "SendLater";
ces.lParam = (LPARAM)hContact;
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 9a5cfe818d..7a7bb4d3db 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -289,9 +289,9 @@ int CIrcProto::OnModulesLoaded( WPARAM, LPARAM )
if ( !getByte( "PerformConversionDone", 0 )) {
OBJLIST<String> performToConvert(10);
- DBCONTACTENUMSETTINGS dbces;
+ DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = sttCheckPerform;
- dbces.lParam = ( LPARAM )&performToConvert;
+ dbces.lParam = (LPARAM)&performToConvert;
dbces.szModule = m_szModuleName;
CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp
index dc0f491e5e..344df3c89d 100644
--- a/protocols/IRCG/src/options.cpp
+++ b/protocols/IRCG/src/options.cpp
@@ -167,7 +167,7 @@ void RereadServers()
{
g_servers.destroy();
- DBCONTACTENUMSETTINGS dbces;
+ DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = sttServerEnum;
dbces.szModule = SERVERSMODULE;
CallService(MS_DB_CONTACT_ENUMSETTINGS, NULL, (LPARAM)&dbces);
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp
index de62755301..7110e3ea2e 100644
--- a/protocols/IcqOscarJ/src/icq_servlist.cpp
+++ b/protocols/IcqOscarJ/src/icq_servlist.cpp
@@ -979,13 +979,13 @@ void CIcqProto::LoadServerIDs()
if (wSrvID = getWord("SrvImportID", 0))
ReserveServerID(wSrvID, SSIT_ITEM, 0);
- DBCONTACTENUMSETTINGS dbces;
int nStart = nServerIDListCount;
char szModule[MAX_PATH];
mir_snprintf(szModule, SIZEOF(szModule), "%sSrvGroups", m_szModuleName);
-
GroupReserveIdsEnumParam param = { this, szModule };
+
+ DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = &GroupReserveIdsEnumProc;
dbces.szModule = szModule;
dbces.lParam = (LPARAM)&param;
@@ -1458,7 +1458,6 @@ static int GroupLinksEnumProc(const char *szSetting,LPARAM lParam)
void CIcqProto::removeGroupPathLinks(WORD wGroupID)
{ // remove miranda grouppath links targeting to this groupid
- DBCONTACTENUMSETTINGS dbces;
char szModule[MAX_PATH];
char* pars[3];
@@ -1468,6 +1467,7 @@ void CIcqProto::removeGroupPathLinks(WORD wGroupID)
pars[1] = (char*)wGroupID;
pars[2] = szModule;
+ DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = &GroupLinksEnumProc;
dbces.szModule = szModule;
dbces.lParam = (LPARAM)pars;
@@ -1809,7 +1809,6 @@ char* CIcqProto::getServListUniqueGroupName(const char *szGroupName, int bAlloce
dbces.pfnEnumProc = &SrvGroupNamesEnumProc;
dbces.szModule = szModule;
dbces.lParam = (LPARAM)pars;
-
CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
if (pars[1])
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp
index 8275a03f4a..477ef69600 100644
--- a/protocols/IcqOscarJ/src/icq_uploadui.cpp
+++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp
@@ -176,17 +176,13 @@ static int GroupEnumIdsEnumProc(const char *szSetting,LPARAM lParam)
static void enumServerGroups(CIcqProto* ppro)
{
- DBCONTACTENUMSETTINGS dbces;
-
char szModule[MAX_PATH+9];
+ mir_snprintf(szModule, SIZEOF(szModule), "%s%s", ppro->m_szModuleName, "SrvGroups");
- strcpy(szModule, ppro->m_szModuleName);
- strcat(szModule, "SrvGroups");
-
+ DBCONTACTENUMSETTINGS dbces = { 0 };
dbces.pfnEnumProc = &GroupEnumIdsEnumProc;
dbces.szModule = szModule;
dbces.lParam = (LPARAM)szModule;
-
CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
}