diff options
author | George Hazan <george.hazan@gmail.com> | 2014-04-02 11:04:09 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-04-02 11:04:09 +0000 |
commit | a1cc2175f61db72a71b26c5be3787f977c021cfb (patch) | |
tree | e2e7dd7439577161323582769b4d04ba39373dc1 /plugins/Db3x_mmap | |
parent | 7c783b8ec0603347548964bacf893de818d03ecf (diff) |
DBEVENTINFO::isMarkRead() - new helper to simplify bit logic
git-svn-id: http://svn.miranda-ng.org/main/trunk@8825 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap')
-rw-r--r-- | plugins/Db3x_mmap/src/dbevents.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index 81fbfa1f9d..66dded5f16 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -291,8 +291,18 @@ STDMETHODIMP_(BOOL) CDb3Mmap::GetEvent(HANDLE hDbEvent, DBEVENTINFO *dbei) STDMETHODIMP_(BOOL) CDb3Mmap::MarkEventRead(MCONTACT contactID, HANDLE hDbEvent)
{
+ DBCachedContact *cc;
+ if (contactID) {
+ if ((cc = m_cache->GetCachedContact(contactID)) == NULL)
+ return -1;
+ if (cc->IsSub())
+ if ((cc = m_cache->GetCachedContact(cc->parentID)) == NULL)
+ return -1;
+ }
+ else cc = NULL;
+
mir_cslockfull lck(m_csDbAccess);
- DWORD ofsContact = GetContactOffset(contactID);
+ DWORD ofsContact = (cc) ? cc->dwDriverData : m_dbHeader.ofsUser;
DBContact dbc = *(DBContact*)DBRead(ofsContact, sizeof(DBContact), NULL);
DBEvent *dbe = (DBEvent*)DBRead((DWORD)hDbEvent, sizeof(DBEvent), NULL);
if (dbe->signature != DBEVENT_SIGNATURE || dbc.signature != DBCONTACT_SIGNATURE)
|