From 366b12a36bf052025bce085d2859486e0318231c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 17 Apr 2024 20:00:05 +0300 Subject: db_event_delivered + ME_DB_EVENT_DELIVERED = helper & hookable event to catch event's delivery to a server --- include/m_database.h | 14 ++++++++++++++ include/m_db_int.h | 7 ++++--- libs/win32/mir_app.lib | Bin 293250 -> 293480 bytes libs/win32/mir_core.lib | Bin 498286 -> 498518 bytes libs/win64/mir_app.lib | Bin 293028 -> 293248 bytes libs/win64/mir_core.lib | Bin 503602 -> 503818 bytes src/mir_app/src/db_intf.cpp | 2 ++ src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + src/mir_core/src/db.cpp | 6 ++++++ src/mir_core/src/mir_core.def | 7 ++++--- src/mir_core/src/mir_core64.def | 7 ++++--- 12 files changed, 36 insertions(+), 9 deletions(-) diff --git a/include/m_database.h b/include/m_database.h index 75c34d2dbb..5dd0a2859a 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -298,6 +298,10 @@ EXTERN_C MIR_CORE_DLL(int) db_event_count(MCONTACT hContact); EXTERN_C MIR_CORE_DLL(int) db_event_delete(MEVENT hDbEvent, int flags = 0); +// Marks our own event as delivered + +EXTERN_C MIR_CORE_DLL(int) db_event_delivered(MCONTACT hContact, MEVENT hDbEvent); + // Edits an event in the database // Returns 0 on success, or nonzero on error @@ -612,6 +616,16 @@ EXTERN_C MIR_APP_DLL(HICON) DbEvent_GetIcon(DBEVENTINFO *dbei, int flags); #define ME_DB_EVENT_DELETED "DB/Event/Deleted" +///////////////////////////////////////////////////////////////////////////////////////// +// DB/Event/Delivered event +// Called when the server confirms that an event was successfully delivered to server +// wParam = (MCONTACT)hContact +// lParam = (LPARAM)(HANDLE)hDbEvent +// hDbEvent is a valid handle to the event. +// hContact is a valid handle to the contact to which hDbEvent refers, and will remain valid. + +#define ME_DB_EVENT_DELIVERED "DB/Event/Delivered" + ///////////////////////////////////////////////////////////////////////////////////////// // DB/Contact/Added event // Called when a new contact has been added to the database diff --git a/include/m_db_int.h b/include/m_db_int.h index 1657a13d05..51f494049a 100644 --- a/include/m_db_int.h +++ b/include/m_db_int.h @@ -378,12 +378,13 @@ struct DATABASELINK EXTERN_C MIR_APP_EXPORT HANDLE g_hevContactDeleted, // ME_DB_CONTACT_DELETED - g_hevContactAdded, // ME_DB_CONTACT_ADDED + g_hevContactAdded, // ME_DB_CONTACT_ADDED g_hevSettingChanged, // ME_DB_CONTACT_SETTINGCHANGED g_hevMarkedRead, // ME_DB_EVENT_MARKED_READ - g_hevEventAdded, // ME_DB_EVENT_ADDED - g_hevEventEdited, // ME_DB_EVENT_EDITED + g_hevEventAdded, // ME_DB_EVENT_ADDED + g_hevEventEdited, // ME_DB_EVENT_EDITED g_hevEventDeleted, // ME_DB_EVENT_DELETED + g_hevEventDelivered, // ME_DB_EVENT_DELIVERED g_hevEventFiltered; // ME_DB_EVENT_FILTER_ADD ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index c3c18637e0..d1b394d98d 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib index 580a31a887..cc904117d7 100644 Binary files a/libs/win32/mir_core.lib and b/libs/win32/mir_core.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 1a84c76d29..ff294a6598 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib index 94f7763c36..a6dc575f07 100644 Binary files a/libs/win64/mir_core.lib and b/libs/win64/mir_core.lib differ diff --git a/src/mir_app/src/db_intf.cpp b/src/mir_app/src/db_intf.cpp index 6207dedeab..f3b445a4fa 100644 --- a/src/mir_app/src/db_intf.cpp +++ b/src/mir_app/src/db_intf.cpp @@ -72,6 +72,7 @@ MIR_APP_EXPORT HANDLE g_hevEventAdded, // ME_DB_EVENT_ADDED g_hevEventEdited, // ME_DB_EVENT_EDITED g_hevEventDeleted, // ME_DB_EVENT_DELETED + g_hevEventDelivered, // ME_DB_EVENT_DELIVERED g_hevEventFiltered; int LoadDbintfModule() @@ -85,6 +86,7 @@ int LoadDbintfModule() g_hevEventAdded = CreateHookableEvent(ME_DB_EVENT_ADDED); g_hevEventEdited = CreateHookableEvent(ME_DB_EVENT_EDITED); g_hevEventDeleted = CreateHookableEvent(ME_DB_EVENT_DELETED); + g_hevEventDelivered = CreateHookableEvent(ME_DB_EVENT_DELIVERED); g_hevEventFiltered = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD); while (!_waccess(L"libmdbx.mir", 0)) { diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index f2511af7d7..d557bce2dd 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -969,3 +969,4 @@ _Netlib_DownloadFile@20 @1099 NONAME ?MarkEventRead@CSrmmBaseDialog@@QAEXABVEventInfo@DB@@@Z @1105 NONAME ?getEvent@EventInfo@DB@@QBEIXZ @1106 NONAME ?GetPreviewPath@PROTO_INTERFACE@@QBE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@XZ @1107 NONAME +g_hevEventDelivered @1108 NONAME diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 9fbb61bf87..575e6f63f0 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -969,3 +969,4 @@ Netlib_DownloadFile @1093 NONAME ?MarkEventRead@CSrmmBaseDialog@@QEAAXAEBVEventInfo@DB@@@Z @1099 NONAME ?getEvent@EventInfo@DB@@QEBAIXZ @1100 NONAME ?GetPreviewPath@PROTO_INTERFACE@@QEBA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@XZ @1101 NONAME +g_hevEventDelivered @1102 NONAME diff --git a/src/mir_core/src/db.cpp b/src/mir_core/src/db.cpp index e653d51a5f..a8c2db679c 100644 --- a/src/mir_core/src/db.cpp +++ b/src/mir_core/src/db.cpp @@ -427,6 +427,12 @@ MIR_CORE_DLL(int) db_event_delete(MEVENT hDbEvent, int flags) return g_pCurrDb->DeleteEvent(hDbEvent); } +MIR_CORE_DLL(int) db_event_delivered(MCONTACT hContact, MEVENT hDbEvent) +{ + NotifyEventHooks(g_hevEventDelivered, hContact, hDbEvent); + return 0; +} + MIR_CORE_DLL(int) db_event_edit(MEVENT hDbEvent, const DBEVENTINFO *dbei, bool bFromServer) { if (g_pCurrDb == nullptr) diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 1182fddbd6..9ef066901d 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1560,8 +1560,8 @@ db_event_updateId @1772 _TranslateW_UUID@8 @1785 NONAME ?Langpack_GetDefaultLocaleName@@YGPADXZ @1786 NONAME _EventExists@4 @1787 NONAME -?SetTooltip@CCtrlMButton@@QAEXPBD@Z @1788 NONAME -_newStr@4 @1789 NONAME +_newStr@4 @1788 NONAME +_newStrW@4 @1789 NONAME ?ChildElementCount@XMLNode@tinyxml2@@QBEHPBD@Z @1790 NONAME ?ChildElementCount@XMLNode@tinyxml2@@QBEHXZ @1791 NONAME ??0MClipAnsi@@QAE@PBD@Z @1792 NONAME @@ -1577,4 +1577,5 @@ _newStr@4 @1789 NONAME ?Copy@MClipRtf@@UBEXXZ @1802 NONAME ?Copy@MClipUnicode@@UBEXXZ @1803 NONAME ?GetPlainRtf@CCtrlRichEdit@@QAEPAD_N@Z @1804 NONAME -_newStrW@4 @1805 NONAME +?SetTooltip@CCtrlMButton@@QAEXPBD@Z @1805 NONAME +_db_event_delivered@8 @1806 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 140c69f7bf..4e1ba01b17 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1560,8 +1560,8 @@ db_event_updateId @1772 TranslateW_UUID @1785 NONAME ?Langpack_GetDefaultLocaleName@@YAPEADXZ @1786 NONAME EventExists @1787 NONAME -?SetTooltip@CCtrlMButton@@QEAAXPEBD@Z @1788 NONAME -newStr @1789 NONAME +newStr @1788 NONAME +newStrW @1789 NONAME ?ChildElementCount@XMLNode@tinyxml2@@QEBAHPEBD@Z @1790 NONAME ?ChildElementCount@XMLNode@tinyxml2@@QEBAHXZ @1791 NONAME ??0MClipAnsi@@QEAA@PEBD@Z @1792 NONAME @@ -1577,4 +1577,5 @@ newStr @1789 NONAME ?Copy@MClipRtf@@UEBAXXZ @1802 NONAME ?Copy@MClipUnicode@@UEBAXXZ @1803 NONAME ?GetPlainRtf@CCtrlRichEdit@@QEAAPEAD_N@Z @1804 NONAME -newStrW @1805 NONAME +?SetTooltip@CCtrlMButton@@QEAAXPEBD@Z @1805 NONAME +db_event_delivered @1806 NONAME -- cgit v1.2.3