summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb/src/dbevents.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Dbx_mdb/src/dbevents.cpp')
-rw-r--r--plugins/Dbx_mdb/src/dbevents.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp
index 721f81e823..d890d86185 100644
--- a/plugins/Dbx_mdb/src/dbevents.cpp
+++ b/plugins/Dbx_mdb/src/dbevents.cpp
@@ -382,18 +382,18 @@ STDMETHODIMP_(MEVENT) CDbxMdb::FindLastEvent(MCONTACT contactID)
txn_ptr_ro txn(m_txn);
cursor_ptr_ro cursor(m_curEventsSort);
- if (contactID != (m_dwMaxContactId - 1))
+
+ if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) != MDB_SUCCESS)
{
- if (mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE) != MDB_SUCCESS)
- return m_evLast = 0;
- if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_LAST) != MDB_SUCCESS)
return m_evLast = 0;
}
else
{
- if (mdb_cursor_get(cursor, &key, &data, MDB_LAST) != MDB_SUCCESS)
+ if (mdb_cursor_get(cursor, &key, &data, MDB_PREV) != MDB_SUCCESS)
return m_evLast = 0;
}
+
const DBEventSortingKey *pKey = (const DBEventSortingKey*)key.mv_data;
m_tsLast = pKey->ts;
return m_evLast = (pKey->dwContactId == contactID) ? pKey->dwEventId : 0;