summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-02-27 16:18:55 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-02-27 16:18:55 +0000
commit60f69a369747444ced2209bcf19ab0a379acc681 (patch)
tree21156f13fea1600adb113f2ca7fba4fc2fa4573e
parent411735c18a498b8a5aafd32ba1c8cae3ff52c650 (diff)
dbx_lmdb: one more contact deletion fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@16365 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Dbx_mdb/src/dbcontacts.cpp15
-rw-r--r--plugins/Dbx_mdb/src/dbevents.cpp1
2 files changed, 9 insertions, 7 deletions
diff --git a/plugins/Dbx_mdb/src/dbcontacts.cpp b/plugins/Dbx_mdb/src/dbcontacts.cpp
index b59e69fe47..1ca1230f41 100644
--- a/plugins/Dbx_mdb/src/dbcontacts.cpp
+++ b/plugins/Dbx_mdb/src/dbcontacts.cpp
@@ -115,7 +115,7 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID)
events.remove(0);
}
}
- {// this code not delete all settings
+ {
DBSettingKey keyS = { contactID, 0 };
memset(keyS.szSettingName, 0, sizeof(keyS.szSettingName));
@@ -124,15 +124,16 @@ STDMETHODIMP_(LONG) CDbxMdb::DeleteContact(MCONTACT contactID)
key.mv_size = sizeof(keyS); key.mv_data = &keyS;
- mdb_cursor_get(cursor, &key, &data, MDB_SET);
+ mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE);
- while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS)
+ do
{
DBSettingKey *pKey = (DBSettingKey*)key.mv_data;
if (pKey->dwContactID != contactID)
break;
mdb_cursor_del(cursor, 0);
- }
+ }
+ while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS);
txn.commit();
}
@@ -202,14 +203,14 @@ void CDbxMdb::GatherContactHistory(MCONTACT hContact, LIST<EventItem> &list)
txn_ptr_ro trnlck(m_txn);
cursor_ptr_ro cursor(m_curEventsSort);
- mdb_cursor_get(cursor, &key, &data, MDB_SET);
- while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS) {
+ mdb_cursor_get(cursor, &key, &data, MDB_SET_RANGE);
+ do {
DBEventSortingKey *pKey = (DBEventSortingKey*)key.mv_data;
if (pKey->dwContactId != hContact)
return;
list.insert(new EventItem(pKey->ts, pKey->dwEventId));
- }
+ } while (mdb_cursor_get(cursor, &key, &data, MDB_NEXT) == MDB_SUCCESS);
}
BOOL CDbxMdb::MetaMergeHistory(DBCachedContact *ccMeta, DBCachedContact *ccSub)
diff --git a/plugins/Dbx_mdb/src/dbevents.cpp b/plugins/Dbx_mdb/src/dbevents.cpp
index bee0cffcc8..03bd186165 100644
--- a/plugins/Dbx_mdb/src/dbevents.cpp
+++ b/plugins/Dbx_mdb/src/dbevents.cpp
@@ -244,6 +244,7 @@ void CDbxMdb::FindNextUnread(const txn_ptr &txn, DBCachedContact *cc, DBEventSor
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;