summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Dbx_mdbx/src/dbevents.cpp4
-rw-r--r--src/mir_app/src/proto_utils.cpp3
2 files changed, 3 insertions, 4 deletions
diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp
index c62893e8d3..230b5170d1 100644
--- a/plugins/Dbx_mdbx/src/dbevents.cpp
+++ b/plugins/Dbx_mdbx/src/dbevents.cpp
@@ -143,12 +143,12 @@ BOOL CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbei)
MDBX_val key = { &hDbEvent, sizeof(MEVENT) }, data;
if (mdbx_get(txn, m_dbEvents, &key, &data) != MDBX_SUCCESS)
return 1;
-
+
DBEvent *dbe = (DBEvent*)data.iov_base;
dbei->timestamp = dbe->timestamp;
}
- return EditEvent(contactID, hDbEvent, dbei, false);
+ return !EditEvent(contactID, hDbEvent, dbei, false);
}
bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, DBEVENTINFO *dbei, bool bNew)
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp
index a82f92eb78..4f3c2a0206 100644
--- a/src/mir_app/src/proto_utils.cpp
+++ b/src/mir_app/src/proto_utils.cpp
@@ -517,12 +517,11 @@ MEVENT PROTO_INTERFACE::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
// if it's possible to find an existing event by its id, do that
if ((GetCaps(PFLAGNUM_4) & PF4_SERVERMSGID) && pre->szMsgId != nullptr) {
MEVENT hDbEvent = db_event_getById(m_szModuleName, pre->szMsgId);
- if (hDbEvent == 0) {
+ if (hDbEvent == 0 || db_event_edit(hContact, hDbEvent, &dbei)) {
hDbEvent = db_event_add(hContact, &dbei);
if (hDbEvent)
db_event_setId(m_szModuleName, hDbEvent, pre->szMsgId);
}
- else db_event_edit(hContact, hDbEvent, &dbei);
return hDbEvent;
}