diff options
-rw-r--r-- | plugins/Dbx_mdb/src/dbevents.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp index 26be93a7af..c0a507f5d3 100644 --- a/plugins/Dbx_mdb/src/dbevents.cpp +++ b/plugins/Dbx_mdb/src/dbevents.cpp @@ -152,9 +152,9 @@ STDMETHODIMP_(BOOL) CDbxMdb::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) // update a contact
key.mv_size = sizeof(int); key.mv_data = &contactID;
- cc->dbc.dwEventCount--; - if (cc->dbc.dwFirstUnread == hDbEvent) - FindNextUnread(txn, cc, key2); + cc->dbc.dwEventCount--;
+ if (cc->dbc.dwFirstUnread == hDbEvent)
+ FindNextUnread(txn, cc, key2);
if (txn.commit())
break;
@@ -228,22 +228,22 @@ STDMETHODIMP_(BOOL) CDbxMdb::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) void CDbxMdb::FindNextUnread(const txn_ptr &txn, DBCachedContact *cc, DBEventSortingKey &key2)
{
- cursor_ptr cursor(txn, m_dbEventsSort); - - MDB_val key = { sizeof(key2), &key2 }, data; - key2.dwEventId++; - mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY); - while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) { - DBEvent *dbe = (DBEvent*)data.mv_data; - if (!dbe->markedRead()) { - cc->dbc.dwFirstUnread = key2.dwEventId; - cc->dbc.tsFirstUnread = key2.ts; - return; - } - } - - cc->dbc.dwFirstUnread = cc->dbc.tsFirstUnread = 0; -} + cursor_ptr cursor(txn, m_dbEventsSort);
+
+ MDB_val key = { sizeof(key2), &key2 }, data;
+ key2.dwEventId++;
+ mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY);
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == 0) {
+ DBEvent *dbe = (DBEvent*)data.mv_data;
+ if (!dbe->markedRead()) {
+ cc->dbc.dwFirstUnread = key2.dwEventId;
+ cc->dbc.tsFirstUnread = key2.ts;
+ return;
+ }
+ }
+
+ cc->dbc.dwFirstUnread = cc->dbc.tsFirstUnread = 0;
+}
STDMETHODIMP_(BOOL) CDbxMdb::MarkEventRead(MCONTACT contactID, MEVENT hDbEvent)
{
@@ -304,7 +304,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindFirstEvent(MCONTACT contactID) txn_ptr txn(m_pMdbEnv, true);
cursor_ptr cursor(txn, m_dbEventsSort);
- mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY);
+ mdb_cursor_get(cursor, &key, &data, MDB_SET);
if (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) != MDB_SUCCESS)
return m_evLast = 0;
@@ -328,7 +328,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindLastEvent(MCONTACT contactID) txn_ptr txn(m_pMdbEnv, true);
cursor_ptr cursor(txn, m_dbEventsSort);
- mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY);
+ mdb_cursor_get(cursor, &key, &data, MDB_SET);
if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
return m_evLast = 0;
@@ -357,7 +357,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindNextEvent(MCONTACT contactID, MEVENT hDbEvent MDB_val key = { sizeof(keyVal), &keyVal };
cursor_ptr cursor(txn, m_dbEventsSort);
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_SET) != MDB_SUCCESS)
return m_evLast = 0;
if (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) != MDB_SUCCESS)
@@ -388,7 +388,7 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindPrevEvent(MCONTACT contactID, MEVENT hDbEvent MDB_val key = { sizeof(keyVal), &keyVal };
cursor_ptr cursor(txn, m_dbEventsSort);
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_KEY) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_SET) != MDB_SUCCESS)
return m_evLast = 0;
if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
|