summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-09-30 15:44:08 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-09-30 15:44:08 +0000
commitf3132fe11d470b5a852c04f464cc0e7efcf391a6 (patch)
tree60f1fabfbd434dfb13651d7fafe3ec28048f3395
parentfc2d8dc3298e37e459e05bf97db36e114c2e8194 (diff)
fix for the metahistory events importing
git-svn-id: http://svn.miranda-ng.org/main/trunk@10653 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Import/src/import.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp
index 94e2c0854d..f038a2fe86 100644
--- a/plugins/Import/src/import.cpp
+++ b/plugins/Import/src/import.cpp
@@ -558,13 +558,16 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC
{
// Is it contats history import?
MCONTACT hDst = (protoCount == 0) ? MapContact(hContact) : NULL; //system history import
-
- // OK to import this chain?
if (hDst == INVALID_CONTACT_ID) {
nSkippedContacts++;
return;
}
+ // history for subs will be imported via metahistory
+ DBCachedContact *cc = dstDb->m_cache->GetCachedContact(hContact);
+ if (cc == NULL || cc->IsSub())
+ return;
+
bool bSkipAll = false;
DWORD cbAlloc = 4096;
BYTE* eventBuf = (PBYTE)mir_alloc(cbAlloc);
@@ -633,14 +636,17 @@ static void ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int protoC
}
if (!bSkipThis) {
- // Check for duplicate entries
+ // check for duplicate entries
if (!IsDuplicateEvent(hDst, dbei)) {
// no need to display all these dialogs again
if (dbei.eventType == EVENTTYPE_AUTHREQUEST || dbei.eventType == EVENTTYPE_ADDED)
dbei.flags |= DBEF_READ;
- // Add dbevent
- if (dstDb->AddEvent(hDst, &dbei) != NULL)
+ // calculate sub's handle for metahistory
+ MCONTACT hOwner = (cc->IsMeta()) ? MapContact(srcDb->GetEventContact(hEvent)) : hDst;
+
+ // add dbevent
+ if (dstDb->AddEvent(hOwner, &dbei) != NULL)
nMessagesCount++;
else
AddMessage(LPGENT("Failed to add message"));