diff options
author | George Hazan <george.hazan@gmail.com> | 2014-09-29 21:31:04 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-09-29 21:31:04 +0000 |
commit | 0094bfe3eff72016d0a2dd039d93cc3ff3fcf273 (patch) | |
tree | b802cb7607f2a56e0ab20dbe8a160ce21e0dd301 /plugins/Import/src | |
parent | e224b9b99c6eb2fa5af3569390a10aca0aed32ab (diff) |
hot plugging metas after import
git-svn-id: http://svn.miranda-ng.org/main/trunk@10645 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Import/src')
-rw-r--r-- | plugins/Import/src/import.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 3626aaacda..d2cbb2f39f 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -431,6 +431,30 @@ void ImportMeta(DBCachedContact *cc) hDest = CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, hDest, (LPARAM)META_PROTO);
+ CopySettings(cc->contactID, META_PROTO, hDest, META_PROTO);
+
+ ccDst = dstDb->m_cache->GetCachedContact(hDest);
+ if (ccDst) {
+ ccDst->nDefault = cc->nDefault;
+ if (ccDst->nSubs = cc->nSubs) {
+ ccDst->pSubs = (MCONTACT*)mir_alloc(sizeof(MCONTACT)*cc->nSubs);
+ for (int i = 0; i < cc->nSubs; i++) {
+ ccDst->pSubs[i] = MapContact(cc->pSubs[i]);
+
+ char szSettingName[100];
+ mir_snprintf(szSettingName, SIZEOF(szSettingName), "Handle%d", i);
+ db_set_dw(hDest, META_PROTO, szSettingName, ccDst->pSubs[i]);
+
+ db_set_b(ccDst->pSubs[i], META_PROTO, "IsSubcontact", 1);
+ db_set_dw(ccDst->pSubs[i], META_PROTO, "ParentMeta", hDest);
+
+ DBCachedContact *ccSub = dstDb->m_cache->GetCachedContact(ccDst->pSubs[i]);
+ if (ccSub)
+ ccSub->parentID = hDest;
+ }
+ }
+ }
+
ptrT tszGroup(myGetWs(cc->contactID, "CList", "Group")), tszNick(myGetWs(cc->contactID, "CList", "MyHandle"));
if (tszNick == NULL)
tszNick = myGetWs(cc->contactID, cc->szProto, "Nick");
@@ -442,13 +466,6 @@ void ImportMeta(DBCachedContact *cc) AddMessage(LPGENT("Added metacontact '%s'"), tszNick);
}
else AddMessage(LPGENT("Added metacontact"));
-
- CopySettings(cc->contactID, META_PROTO, hDest, META_PROTO);
- for (int i = 0; i < cc->nSubs; i++) {
- char szSettingName[100];
- mir_snprintf(szSettingName, SIZEOF(szSettingName), "Handle%d", i);
- db_set_dw(hDest, META_PROTO, szSettingName, MapContact(cc->pSubs[i]));
- }
}
else hDest = ccDst->contactID;
|