summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-09 15:00:43 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-09 15:00:43 +0000
commit8d2b4094f891d20381f65e3180b2b053830f3050 (patch)
tree04cb5010af323b37ec67b75fadbeb34ff9c28d9a /plugins/Db3x_mmap/src
parentad0169e0110232390474d23274bdc5dc2d385a9a (diff)
- unused options removed
- duplicated events in history fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@8504 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/src')
-rw-r--r--plugins/Db3x_mmap/src/dbevents.cpp19
1 files changed, 14 insertions, 5 deletions
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<BYTE> 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);