summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-03-01 19:25:08 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-03-01 19:25:08 +0000
commitd01946052f1ca2263b8bf6853c8788bf55411010 (patch)
tree003e5743ef0eae9764227a33c017ba1a1419ebc4 /plugins/Dbx_mdb
parentd5675b1834031fd7c99baa6d948fb550594fcd3a (diff)
dbx_lmdb: forgotten remap
git-svn-id: http://svn.miranda-ng.org/main/trunk@16384 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb')
-rw-r--r--plugins/Dbx_mdb/src/dbevents.cpp43
-rw-r--r--plugins/Dbx_mdb/src/dbintf.h2
2 files changed, 26 insertions, 19 deletions
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp
index 2e22931c47..ee9d37ccd3 100644
--- a/plugins/Dbx_mdb/src/dbevents.cpp
+++ b/plugins/Dbx_mdb/src/dbevents.cpp
@@ -276,34 +276,41 @@ STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
return -1;
mir_cslockfull lck(m_csDbAccess);
- txn_ptr txn(m_pMdbEnv);
+ DWORD wRetVal = 0;
- MDB_val key = { sizeof(MEVENT), &hDbEvent }, data;
- if (mdb_get(txn, m_dbEvents, &key, &data) != MDB_SUCCESS)
- return 0;
+ for (;; Remap())
+ {
+ txn_ptr txn(m_pMdbEnv);
- DBEvent *dbe = (DBEvent*)data.mv_data;
- if (dbe->dwSignature != DBEVENT_SIGNATURE)
- return -1;
+ MDB_val key = { sizeof(MEVENT), &hDbEvent }, data;
+ MDB_CHECK(mdb_get(txn, m_dbEvents, &key, &data), 0);
+
+ DBEvent *dbe = (DBEvent*)data.mv_data;
+ if (dbe->dwSignature != DBEVENT_SIGNATURE)
+ return -1;
+
+ if (dbe->markedRead())
+ return dbe->flags;
- if (dbe->markedRead())
- return dbe->flags;
+ DBEventSortingKey key2 = { hDbEvent, dbe->timestamp, contactID };
- DBEventSortingKey key2 = { hDbEvent, dbe->timestamp, contactID };
+ dbe->flags |= DBEF_READ;
+ MDB_CHECK(mdb_put(txn, m_dbEvents, &key, &data, 0), -1);
- dbe->flags |= DBEF_READ;
- mdb_put(txn, m_dbEvents, &key, &data, 0);
+ FindNextUnread(txn, cc, key2);
+ key.mv_size = sizeof(MCONTACT); key.mv_data = &contactID;
+ data.mv_data = &cc->dbc; data.mv_size = sizeof(cc->dbc);
+ MDB_CHECK(mdb_put(txn, m_dbContacts, &key, &data, 0), -1);
+ wRetVal = dbe->flags;
- FindNextUnread(txn, cc, key2);
- key.mv_size = sizeof(MCONTACT); key.mv_data = &contactID;
- data.mv_data = &cc->dbc; data.mv_size = sizeof(cc->dbc);
- mdb_put(txn, m_dbContacts, &key, &data, 0);
- txn.commit();
+ if (txn.commit())
+ break;;
+ }
lck.unlock();
NotifyEventHooks(hEventMarkedRead, contactID, (LPARAM)hDbEvent);
- return dbe->flags;
+ return wRetVal;
}
STDMETHODIMP_(MCONTACT) CDbxMdb::GetEventContact(MEVENT hDbEvent)
diff --git a/plugins/Dbx_mdb/src/dbintf.h b/plugins/Dbx_mdb/src/dbintf.h
index 2c95b6413d..f744b37d96 100644
--- a/plugins/Dbx_mdb/src/dbintf.h
+++ b/plugins/Dbx_mdb/src/dbintf.h
@@ -259,7 +259,7 @@ protected:
MDB_dbi m_dbContacts;
MDB_cursor *m_curContacts;
- int m_contactCount, m_dwMaxContactId;
+ DWORD m_contactCount, m_dwMaxContactId;
void GatherContactHistory(MCONTACT hContact, LIST<EventItem> &items);