summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdbx
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-11 17:07:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-11 17:07:04 +0300
commit8f9292d483fcf3a10d9284512359c4562f5311eb (patch)
tree3593ca1eb6a5a4c3b2ef454fa6b4944d4b8da8c4 /plugins/Dbx_mdbx
parent5f4f070347d20fc85b588138217aa744141e8053 (diff)
DB::FILE_BLOB - file events' access unification
Diffstat (limited to 'plugins/Dbx_mdbx')
-rw-r--r--plugins/Dbx_mdbx/src/dbevents.cpp26
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.h4
2 files changed, 15 insertions, 15 deletions
diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp
index 3b2c0e4650..3cbb5e5e5a 100644
--- a/plugins/Dbx_mdbx/src/dbevents.cpp
+++ b/plugins/Dbx_mdbx/src/dbevents.cpp
@@ -137,7 +137,7 @@ BOOL CDbxMDBX::DeleteEvent(MEVENT hDbEvent)
/////////////////////////////////////////////////////////////////////////////////////////
-BOOL CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbei)
+BOOL CDbxMDBX::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei)
{
if (dbei == nullptr) return 1;
if (dbei->timestamp == 0) return 1;
@@ -150,19 +150,19 @@ BOOL CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO
DBEvent *dbe = (DBEvent*)data.iov_base;
tmp.timestamp = dbe->timestamp;
- return !EditEvent(contactID, hDbEvent, &tmp, false);
+ return !EditEvent(dbe->dwContactID, hDbEvent, &tmp, false);
}
-bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbei, bool bNew)
+bool CDbxMDBX::EditEvent(MCONTACT hContact, MEVENT hDbEvent, const DBEVENTINFO *dbei, bool bNew)
{
DBEvent dbe;
- dbe.dwContactID = contactID; // store native or subcontact's id
+ dbe.dwContactID = hContact; // store native or subcontact's id
dbe.iModuleId = GetModuleID(dbei->szModule);
- MCONTACT contactNotifyID = contactID;
+ MCONTACT contactNotifyID = hContact;
DBCachedContact *cc, *ccSub = nullptr;
- if (contactID != 0) {
- if ((cc = m_cache->GetCachedContact(contactID)) == nullptr)
+ if (hContact != 0) {
+ if ((cc = m_cache->GetCachedContact(hContact)) == nullptr)
return false;
if (cc->IsSub()) {
@@ -172,10 +172,10 @@ bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO
// set default sub to the event's source
if (!(dbei->flags & DBEF_SENT))
- db_mc_setDefault(cc->contactID, contactID, false);
- contactID = cc->contactID; // and add an event to a metahistory
+ db_mc_setDefault(cc->contactID, hContact, false);
+ hContact = cc->contactID; // and add an event to a metahistory
if (db_mc_isEnabled())
- contactNotifyID = contactID;
+ contactNotifyID = hContact;
}
}
else cc = &m_ccDummy;
@@ -224,15 +224,15 @@ bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO
return false;
// add a sorting key
- DBEventSortingKey key2 = { contactID, hDbEvent, dbe.timestamp };
+ DBEventSortingKey key2 = { hContact, hDbEvent, dbe.timestamp };
key.iov_len = sizeof(key2); key.iov_base = &key2;
data.iov_len = 1; data.iov_base = (char*)("");
if (mdbx_put(trnlck, m_dbEventsSort, &key, &data, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
cc->Advance(hDbEvent, dbe);
- if (contactID != 0) {
- MDBX_val keyc = { &contactID, sizeof(MCONTACT) }, datac = { &cc->dbc, sizeof(DBContact) };
+ if (hContact != 0) {
+ MDBX_val keyc = { &hContact, sizeof(MCONTACT) }, datac = { &cc->dbc, sizeof(DBContact) };
if (mdbx_put(trnlck, m_dbContacts, &keyc, &datac, MDBX_UPSERT) != MDBX_SUCCESS)
return false;
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h
index f0e931667b..8166864881 100644
--- a/plugins/Dbx_mdbx/src/dbintf.h
+++ b/plugins/Dbx_mdbx/src/dbintf.h
@@ -162,7 +162,7 @@ class CDbxMDBX : public MDatabaseCommon, public MIDatabaseChecker, public MZeroe
MDBX_txn* StartTran();
bool CheckEvent(DBCachedContact *cc, const DBEvent *dbe, DBCachedContact *&cc2);
- bool EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe, bool bNew);
+ bool EditEvent(MCONTACT hContact, MEVENT hDbEvent, const DBEVENTINFO *dbe, bool bNew);
int PrepareCheck(void);
void TouchFile(void);
@@ -249,7 +249,7 @@ public:
STDMETHODIMP_(int) GetEventCount(MCONTACT contactID) override;
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
- STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(BOOL) EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(int) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override;