diff options
author | George Hazan <ghazan@miranda.im> | 2020-01-20 19:32:28 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-01-20 19:32:28 +0300 |
commit | 999d22f6c3c618cde52097547e53703664d7e665 (patch) | |
tree | 651589d4660b8346729c12f0bea93d0570fba1e3 /plugins/Dbx_mdbx/src | |
parent | 601ec263ad0887d7a8a090badc3c77cfcb24f0d5 (diff) |
db_event_delete: unused parameter removed
Diffstat (limited to 'plugins/Dbx_mdbx/src')
-rw-r--r-- | plugins/Dbx_mdbx/src/dbcontacts.cpp | 2 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbevents.cpp | 21 | ||||
-rw-r--r-- | plugins/Dbx_mdbx/src/dbintf.h | 2 |
3 files changed, 13 insertions, 12 deletions
diff --git a/plugins/Dbx_mdbx/src/dbcontacts.cpp b/plugins/Dbx_mdbx/src/dbcontacts.cpp index 9ef07017f5..82afdf0727 100644 --- a/plugins/Dbx_mdbx/src/dbcontacts.cpp +++ b/plugins/Dbx_mdbx/src/dbcontacts.cpp @@ -48,7 +48,7 @@ LONG CDbxMDBX::DeleteContact(MCONTACT contactID) OBJLIST<EventItem> events(50);
GatherContactHistory(contactID, events);
while (events.getCount()) {
- DeleteEvent(contactID, events[0].eventId);
+ DeleteEvent(events[0].eventId);
events.remove(0);
}
}
diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp index 776c2679eb..c720609e25 100644 --- a/plugins/Dbx_mdbx/src/dbevents.cpp +++ b/plugins/Dbx_mdbx/src/dbevents.cpp @@ -48,37 +48,38 @@ MEVENT CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei) ///////////////////////////////////////////////////////////////////////////////
-BOOL CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent)
+BOOL CDbxMDBX::DeleteEvent(MEVENT hDbEvent)
{
- DBCachedContact *cc = (contactID != 0) ? m_cache->GetCachedContact(contactID) : &m_ccDummy, *cc2;
- if (cc == nullptr || cc->dbc.dwEventCount == 0)
- return 1;
-
+ DBCachedContact *cc, *cc2;
DBEvent dbe;
{
txn_ptr_ro txn(m_txn_ro);
MDBX_val key = { &hDbEvent, sizeof(MEVENT) }, data;
if (mdbx_get(txn, m_dbEvents, &key, &data) != MDBX_SUCCESS)
return 1;
+
dbe = *(DBEvent*)data.iov_base;
+ cc = (dbe.dwContactID != 0) ? m_cache->GetCachedContact(dbe.dwContactID) : &m_ccDummy;
+ if (cc == nullptr || cc->dbc.dwEventCount == 0)
+ return 1;
}
if (!CheckEvent(cc, &dbe, cc2))
return 1;
{
txn_ptr trnlck(StartTran());
- DBEventSortingKey key2 = { contactID, hDbEvent, dbe.timestamp };
+ DBEventSortingKey key2 = { dbe.dwContactID, hDbEvent, dbe.timestamp };
MDBX_val key = { &key2, sizeof(key2) }, data;
if (mdbx_del(trnlck, m_dbEventsSort, &key, nullptr) != MDBX_SUCCESS)
return 1;
- if (contactID != 0) {
+ if (dbe.dwContactID != 0) {
cc->dbc.dwEventCount--;
if (cc->dbc.evFirstUnread == hDbEvent)
FindNextUnread(trnlck, cc, key2);
- MDBX_val keyc = { &contactID, sizeof(MCONTACT) };
+ MDBX_val keyc = { &dbe.dwContactID, sizeof(MCONTACT) };
data.iov_len = sizeof(DBContact); data.iov_base = &cc->dbc;
if (mdbx_put(trnlck, m_dbContacts, &keyc, &data, 0) != MDBX_SUCCESS)
return 1;
@@ -99,7 +100,7 @@ BOOL CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) if (mdbx_del(trnlck, m_dbEventsSort, &key, nullptr) != MDBX_SUCCESS)
return 1;
- key.iov_len = sizeof(MCONTACT); key.iov_base = &contactID;
+ key.iov_len = sizeof(MCONTACT); key.iov_base = &dbe.dwContactID;
cc2->dbc.dwEventCount--;
if (cc2->dbc.evFirstUnread == hDbEvent)
FindNextUnread(trnlck, cc2, key2);
@@ -120,7 +121,7 @@ BOOL CDbxMDBX::DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) }
DBFlush();
- NotifyEventHooks(g_hevEventDeleted, contactID, hDbEvent);
+ NotifyEventHooks(g_hevEventDeleted, dbe.dwContactID, hDbEvent);
return 0;
}
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h index 53d598b406..4a089b8ef3 100644 --- a/plugins/Dbx_mdbx/src/dbintf.h +++ b/plugins/Dbx_mdbx/src/dbintf.h @@ -268,7 +268,7 @@ public: STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override;
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override;
- STDMETHODIMP_(BOOL) DeleteEvent(MCONTACT contactID, MEVENT hDbEvent) override;
+ STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
|