diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-03 14:35:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-03 14:35:33 +0000 |
commit | 2cbc7f36727cc86800c0866df859a0ab473b678e (patch) | |
tree | c5d53056be9028a895e0a1fd2608885a556c88b3 /plugins/Db3x_mmap/src/dbcontacts.cpp | |
parent | dfc7c1ee5083b76723c98568a3fb4d607d8c1a76 (diff) |
to convert metas we must wait for the end of contact cache filling
git-svn-id: http://svn.miranda-ng.org/main/trunk@8379 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src/dbcontacts.cpp')
-rw-r--r-- | plugins/Db3x_mmap/src/dbcontacts.cpp | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp index 5420037b90..ebdc9c6cfd 100644 --- a/plugins/Db3x_mmap/src/dbcontacts.cpp +++ b/plugins/Db3x_mmap/src/dbcontacts.cpp @@ -240,6 +240,8 @@ void CDb3Mmap::ConvertContacts() void CDb3Mmap::FillContacts()
{
+ LIST<void> arMetas(10);
+
for (DWORD dwOffset = m_dbHeader.ofsFirstContact; dwOffset != 0;) {
DBContact *p = (DBContact*)DBRead(dwOffset, sizeof(DBContact), NULL);
if (p->signature != DBCONTACT_SIGNATURE)
@@ -281,25 +283,34 @@ void CDb3Mmap::FillContacts() 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");
- }
- }
+ if (!GetContactSetting(dwContactID, META_PROTO, "MetaID", &dbv))
+ arMetas.insert((void*)dwContactID);
dwOffset = p->ofsNext;
}
+
+ for (int i = 0; i < arMetas.getCount(); i++) {
+ MCONTACT hContact = (MCONTACT)arMetas[i];
+ DBCachedContact *cc = m_cache->GetCachedContact(hContact);
+ if (cc == NULL)
+ continue;
+
+ // we don't need it anymore
+ DeleteContactSetting(hContact, META_PROTO, "MetaID");
+
+ for (int k = 0; k < cc->nSubs; k++) {
+ // store contact id instead of the old mc number
+ DBCONTACTWRITESETTING dbws = { META_PROTO, "ParentMeta" };
+ dbws.value.type = DBVT_DWORD;
+ dbws.value.dVal = hContact;
+ WriteContactSetting(cc->pSubs[k], &dbws);
+
+ // wipe out old data from subcontacts
+ DeleteContactSetting(cc->pSubs[k], META_PROTO, "ContactNumber");
+ DeleteContactSetting(cc->pSubs[k], META_PROTO, "IsSubcontact");
+ DeleteContactSetting(cc->pSubs[k], META_PROTO, "MetaLink");
+ }
+ }
}
DWORD CDb3Mmap::GetContactOffset(MCONTACT contactID)
|