summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-12-25 21:01:26 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-12-25 21:01:26 +0300
commit0c66b748a7b6b223d34374994e4d7d207e3d2c71 (patch)
treebb960016c02b7ba6a57f342c829b65b00b6d2476 /src/mir_core
parent97e9f52c99a41612fcfef3cae099519c46d55710 (diff)
db_event_replace: new helper to eliminate duplicate events
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/db.cpp10
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
3 files changed, 12 insertions, 0 deletions
diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp
index a680211c82..2965c72842 100644
--- a/src/mir_core/src/db.cpp
+++ b/src/mir_core/src/db.cpp
@@ -469,6 +469,16 @@ MIR_CORE_DLL(MEVENT) db_event_prev(MCONTACT hContact, MEVENT hDbEvent)
return (g_pCurrDb == nullptr) ? 0 : g_pCurrDb->FindPrevEvent(hContact, hDbEvent);
}
+MIR_CORE_DLL(MEVENT) db_event_replace(MCONTACT hContact, const DBEVENTINFO *dbei)
+{
+ MEVENT ret = 0;
+ if (dbei->szId)
+ ret = db_event_getById(dbei->szModule, dbei->szId);
+ if (!ret)
+ ret = db_event_add(hContact, dbei);
+ return ret;
+}
+
MIR_CORE_DLL(MEVENT) db_event_getById(const char *szModule, const char *szId)
{
return (g_pCurrDb == nullptr) ? 0 : g_pCurrDb->GetEventById(szModule, szId);
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index 5d50debe41..09e1804cc4 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1547,3 +1547,4 @@ _Utils_CorrectFontSize@4 @1762 NONAME
?mir_base64_encode@@YGPADABVMBinBuffer@@@Z @1768 NONAME
?append@MBinBuffer@@QAEXABV1@@Z @1769 NONAME
?appendBefore@MBinBuffer@@QAEXABV1@@Z @1770 NONAME
+db_event_replace @1771
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index f5f58713cd..9862559f69 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1547,3 +1547,4 @@ Utils_CorrectFontSize @1762 NONAME
?mir_base64_encode@@YAPEADAEBVMBinBuffer@@@Z @1768 NONAME
?append@MBinBuffer@@QEAAXAEBV1@@Z @1769 NONAME
?appendBefore@MBinBuffer@@QEAAXAEBV1@@Z @1770 NONAME
+db_event_replace @1771