From 419d2a2454ee7d3eb7b394547351509ac801c8f6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 2 Mar 2014 20:06:53 +0000 Subject: MS_MC_DISABLEHIDDENGROUP - nasty clutch removed git-svn-id: http://svn.miranda-ng.org/main/trunk@8363 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/commonheaders.h | 1 + plugins/Db3x_mmap/src/dbcontacts.cpp | 26 ++++++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'plugins/Db3x_mmap') diff --git a/plugins/Db3x_mmap/src/commonheaders.h b/plugins/Db3x_mmap/src/commonheaders.h index 3467c6ddee..6fac634f56 100644 --- a/plugins/Db3x_mmap/src/commonheaders.h +++ b/plugins/Db3x_mmap/src/commonheaders.h @@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include "database.h" #include "dbintf.h" diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index e0dfbf6108..1337341bde 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -247,17 +247,35 @@ void CDb3Mmap::FillContacts() CheckProto(cc, ""); DBVARIANT dbv; dbv.type = DBVT_DWORD; - cc->nSubs = (0 != GetContactSetting(dwContactID, "MetaContacts", "NumContacts", &dbv)) ? -1 : dbv.dVal; + cc->nSubs = (0 != GetContactSetting(dwContactID, META_PROTO, "NumContacts", &dbv)) ? -1 : dbv.dVal; if (cc->nSubs != -1) { cc->pSubs = (MCONTACT*)mir_alloc(cc->nSubs*sizeof(MCONTACT)); for (int i = 0; i < cc->nSubs; i++) { char setting[100]; mir_snprintf(setting, sizeof(setting), "Handle%d", i); - cc->pSubs[i] = (0 != GetContactSetting(dwContactID, "MetaContacts", setting, &dbv)) ? NULL : dbv.dVal; + cc->pSubs[i] = (0 != GetContactSetting(dwContactID, META_PROTO, setting, &dbv)) ? NULL : dbv.dVal; + } + } + cc->activeID = (0 != GetContactSetting(dwContactID, META_PROTO, "Default", &dbv)) ? NULL : dbv.dVal; + cc->parentID = (0 != GetContactSetting(dwContactID, META_PROTO, "Handle", &dbv)) ? NULL : dbv.dVal; + + // whether we need conversion or not + if (!GetContactSetting(dwContactID, META_PROTO, "MetaID", &dbv)) { + // we don't need it anymore + DeleteContactSetting(dwContactID, META_PROTO, "MetaID"); + + for (int i = 0; i < cc->nSubs; i++) { + // store contact id instead of the old mc number + DBCONTACTWRITESETTING dbws = { META_PROTO, "ParentMeta" }; + dbws.value.type = DBVT_DWORD; + dbws.value.dVal = dwContactID; + WriteContactSetting(cc->pSubs[i], &dbws); + + // wipe out old data from subcontacts + DeleteContactSetting(cc->pSubs[i], META_PROTO, "ContactNumber"); + DeleteContactSetting(cc->pSubs[i], META_PROTO, "MetaLink"); } } - cc->activeID = (0 != GetContactSetting(dwContactID, "MetaContacts", "Default", &dbv)) ? NULL : dbv.dVal; - cc->parentID = (0 != GetContactSetting(dwContactID, "MetaContacts", "Handle", &dbv)) ? NULL : dbv.dVal; dwOffset = p->ofsNext; } -- cgit v1.2.3