From f3132fe11d470b5a852c04f464cc0e7efcf391a6 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 30 Sep 2014 15:44:08 +0000 Subject: fix for the metahistory events importing git-svn-id: http://svn.miranda-ng.org/main/trunk@10653 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Import/src/import.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'plugins') 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")); -- cgit v1.2.3