From 8d2b4094f891d20381f65e3180b2b053830f3050 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 9 Mar 2014 15:00:43 +0000 Subject: - unused options removed - duplicated events in history fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@8504 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Db3x_mmap/src/dbevents.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'plugins/Db3x_mmap/src') diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index f7c8876258..7be9a20906 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -37,18 +37,27 @@ STDMETHODIMP_(HANDLE) CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) if (dbei == NULL || dbei->cbSize != sizeof(DBEVENTINFO)) return 0; if (dbei->timestamp == 0) return 0; - if (NotifyEventHooks(hEventFilterAddedEvent, contactID, (LPARAM)dbei)) - return 0; - DBEvent dbe; dbe.signature = DBEVENT_SIGNATURE; - dbe.contactID = contactID; + dbe.contactID = contactID; // store native or subcontact's id dbe.timestamp = dbei->timestamp; dbe.flags = dbei->flags; dbe.wEventType = dbei->eventType; dbe.cbBlob = dbei->cbBlob; BYTE *pBlob = dbei->pBlob; + if (contactID != 0) { + DBCachedContact *cc = m_cache->GetCachedContact(contactID); + if (cc == NULL) + return NULL; + + if (cc->IsSub()) + contactID = cc->parentID; + } + + if (NotifyEventHooks(hEventFilterAddedEvent, contactID, (LPARAM)dbei)) + return NULL; + mir_ptr pCryptBlob; if (m_bEncrypted) { size_t len; @@ -66,7 +75,7 @@ STDMETHODIMP_(HANDLE) CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) DWORD ofsContact = GetContactOffset(contactID); DBContact dbc = *(DBContact*)DBRead(ofsContact, sizeof(DBContact), NULL); if (dbc.signature != DBCONTACT_SIGNATURE) - return 0; + return NULL; DWORD ofsNew = CreateNewSpace(offsetof(DBEvent, blob) + dbe.cbBlob); -- cgit v1.2.3