summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-25 17:08:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-25 17:08:32 +0300
commit6ea21b88c16c553aa97e2cd53266ffd4a689d581 (patch)
treefd32557b4347043c0ce04aaaad2333e90faee3ba /plugins
parentc9f5b74041f85d59dd061c7e1cfbe35d23ead9a3 (diff)
db_event_add / db_event_edit to receive const pointer to DBEVENTINFO
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Db3x_mmap/src/dbevents.cpp4
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h4
-rw-r--r--plugins/Dbx_mdbx/src/dbevents.cpp11
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.h6
-rwxr-xr-xplugins/Dbx_sqlite/src/dbevents.cpp4
-rwxr-xr-xplugins/Dbx_sqlite/src/dbintf.h4
-rw-r--r--plugins/Import/src/dbrw/dbevents.cpp4
-rw-r--r--plugins/Import/src/dbrw/dbintf.h4
8 files changed, 21 insertions, 20 deletions
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp
index ba17be694e..8e64963ac7 100644
--- a/plugins/Db3x_mmap/src/dbevents.cpp
+++ b/plugins/Db3x_mmap/src/dbevents.cpp
@@ -30,7 +30,7 @@ LONG CDb3Mmap::GetEventCount(MCONTACT contactID)
return (dbc->signature != DBCONTACT_SIGNATURE) ? -1 : dbc->eventCount;
}
-MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
+MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, const DBEVENTINFO *dbei)
{
if (dbei == nullptr) return 0;
if (dbei->timestamp == 0) return 0;
@@ -260,7 +260,7 @@ BOOL CDb3Mmap::DeleteEvent(MEVENT hDbEvent)
return 0;
}
-BOOL CDb3Mmap::EditEvent(MCONTACT, MEVENT, DBEVENTINFO*)
+BOOL CDb3Mmap::EditEvent(MCONTACT, MEVENT, const DBEVENTINFO*)
{
return 1;
}
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h
index bdbcbeac0c..97c262f8ce 100644
--- a/plugins/Db3x_mmap/src/dbintf.h
+++ b/plugins/Db3x_mmap/src/dbintf.h
@@ -218,9 +218,9 @@ public:
STDMETHODIMP_(LONG) GetContactSize(void) override;
STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override;
- STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
- STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override;
diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp
index 78d1531a29..6a7592a781 100644
--- a/plugins/Dbx_mdbx/src/dbevents.cpp
+++ b/plugins/Dbx_mdbx/src/dbevents.cpp
@@ -34,7 +34,7 @@ LONG CDbxMDBX::GetEventCount(MCONTACT contactID)
///////////////////////////////////////////////////////////////////////////////
-MEVENT CDbxMDBX::AddEvent(MCONTACT contactID, DBEVENTINFO *dbei)
+MEVENT CDbxMDBX::AddEvent(MCONTACT contactID, const DBEVENTINFO *dbei)
{
if (dbei == nullptr) return 0;
if (dbei->timestamp == 0) return 0;
@@ -127,11 +127,12 @@ BOOL CDbxMDBX::DeleteEvent(MEVENT hDbEvent)
///////////////////////////////////////////////////////////////////////////////
-BOOL CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbei)
+BOOL CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbei)
{
if (dbei == nullptr) return 1;
if (dbei->timestamp == 0) return 1;
+ DBEVENTINFO tmp = *dbei;
{
txn_ptr_ro txn(m_txn_ro);
MDBX_val key = { &hDbEvent, sizeof(MEVENT) }, data;
@@ -139,13 +140,13 @@ BOOL CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbei)
return 1;
DBEvent *dbe = (DBEvent*)data.iov_base;
- dbei->timestamp = dbe->timestamp;
+ tmp.timestamp = dbe->timestamp;
}
- return !EditEvent(contactID, hDbEvent, dbei, false);
+ return !EditEvent(contactID, hDbEvent, &tmp, false);
}
-bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbei, bool bNew)
+bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbei, bool bNew)
{
DBEvent dbe;
dbe.dwContactID = contactID; // store native or subcontact's id
diff --git a/plugins/Dbx_mdbx/src/dbintf.h b/plugins/Dbx_mdbx/src/dbintf.h
index 4a089b8ef3..b74b6bbc12 100644
--- a/plugins/Dbx_mdbx/src/dbintf.h
+++ b/plugins/Dbx_mdbx/src/dbintf.h
@@ -168,7 +168,7 @@ class CDbxMDBX : public MDatabaseCommon, public MZeroedObject
}
bool CheckEvent(DBCachedContact *cc, const DBEvent *dbe, DBCachedContact *&cc2);
- bool EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe, bool bNew);
+ bool EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe, bool bNew);
void FillContacts(void);
int PrepareCheck(void);
void TouchFile(void);
@@ -267,9 +267,9 @@ public:
STDMETHODIMP_(LONG) GetContactSize(void) override;
STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override;
- STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
- STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override;
diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp
index ef6562f85a..62de7b8394 100755
--- a/plugins/Dbx_sqlite/src/dbevents.cpp
+++ b/plugins/Dbx_sqlite/src/dbevents.cpp
@@ -123,7 +123,7 @@ LONG CDbxSQLite::GetEventCount(MCONTACT hContact)
return cc->m_count;
}
-MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, DBEVENTINFO *dbei)
+MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, const DBEVENTINFO *dbei)
{
if (dbei == nullptr)
return 0;
@@ -245,7 +245,7 @@ BOOL CDbxSQLite::DeleteEvent(MEVENT hDbEvent)
return 0;
}
-BOOL CDbxSQLite::EditEvent(MCONTACT hContact, MEVENT hDbEvent, DBEVENTINFO *dbei)
+BOOL CDbxSQLite::EditEvent(MCONTACT hContact, MEVENT hDbEvent, const DBEVENTINFO *dbei)
{
if (dbei == nullptr)
return 1;
diff --git a/plugins/Dbx_sqlite/src/dbintf.h b/plugins/Dbx_sqlite/src/dbintf.h
index 16a8db11dd..8a2c0f98a7 100755
--- a/plugins/Dbx_sqlite/src/dbintf.h
+++ b/plugins/Dbx_sqlite/src/dbintf.h
@@ -63,9 +63,9 @@ public:
STDMETHODIMP_(LONG) GetContactSize(void) override;
STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override;
- STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
- STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override;
diff --git a/plugins/Import/src/dbrw/dbevents.cpp b/plugins/Import/src/dbrw/dbevents.cpp
index 0b4611d51d..3dff9584ab 100644
--- a/plugins/Import/src/dbrw/dbevents.cpp
+++ b/plugins/Import/src/dbrw/dbevents.cpp
@@ -34,7 +34,7 @@ STDMETHODIMP_(LONG) CDbxSQLite::GetEventCount(MCONTACT contactID)
return res;
}
-STDMETHODIMP_(MEVENT) CDbxSQLite::AddEvent(MCONTACT, DBEVENTINFO*)
+STDMETHODIMP_(MEVENT) CDbxSQLite::AddEvent(MCONTACT, const DBEVENTINFO*)
{
return 0;
}
@@ -44,7 +44,7 @@ STDMETHODIMP_(BOOL) CDbxSQLite::DeleteEvent(MEVENT)
return FALSE;
}
-BOOL CDbxSQLite::EditEvent(MCONTACT, MEVENT, DBEVENTINFO*)
+BOOL CDbxSQLite::EditEvent(MCONTACT, MEVENT, const DBEVENTINFO*)
{
return 1;
}
diff --git a/plugins/Import/src/dbrw/dbintf.h b/plugins/Import/src/dbrw/dbintf.h
index 6d62fd6fb6..09d7514f2f 100644
--- a/plugins/Import/src/dbrw/dbintf.h
+++ b/plugins/Import/src/dbrw/dbintf.h
@@ -132,9 +132,9 @@ public:
STDMETHODIMP_(LONG) GetContactSize(void) override;
STDMETHODIMP_(LONG) GetEventCount(MCONTACT contactID) override;
- STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(MEVENT) AddEvent(MCONTACT contactID, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) DeleteEvent(MEVENT hDbEvent) override;
- STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(LONG) GetBlobSize(MEVENT hDbEvent) override;
STDMETHODIMP_(BOOL) GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbe) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT contactID, MEVENT hDbEvent) override;