From 7378dd16f14d3f9f34cde4a18859d406cd303a22 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 25 Apr 2020 17:34:57 +0300 Subject: DBEF_TEMPORARY - new flag to disable event notification about event addition --- include/m_database.h | 1 + plugins/Db3x_mmap/src/dbevents.cpp | 3 +++ plugins/Dbx_mdbx/src/dbevents.cpp | 2 +- plugins/Dbx_sqlite/src/dbevents.cpp | 2 +- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/m_database.h b/include/m_database.h index c49ed1a270..f9ef17b29d 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -160,6 +160,7 @@ struct DBVARIANT }; }; +#define DBEF_TEMPORARY 1 // disable notifications about temporary database events #define DBEF_SENT 2 // this event was sent by the user. If not set this event was received. #define DBEF_READ 4 // event has been read by the user. It does not need to be processed any more except for history. #define DBEF_RTL 8 // event contains the right-to-left aligned text diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index 8e64963ac7..a49e9ebbfb 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -140,6 +140,9 @@ MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, const DBEVENTINFO *dbei) } neednotify = true; } + else if (dbe.flags & DBEF_TEMPORARY) { + neednotify = false; + } else neednotify = m_safetyMode; if (ccSub != nullptr) { diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp index 6a7592a781..b534706b25 100644 --- a/plugins/Dbx_mdbx/src/dbevents.cpp +++ b/plugins/Dbx_mdbx/src/dbevents.cpp @@ -245,7 +245,7 @@ bool CDbxMDBX::EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO DBFlush(); // Notify only in safe mode or on really new events - if (m_safetyMode) + if (m_safetyMode && !(dbei->flags & DBEF_TEMPORARY)) NotifyEventHooks(bNew ? g_hevEventAdded : g_hevEventEdited, contactNotifyID, hDbEvent); return true; diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index 62de7b8394..bb76739baa 100755 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -201,7 +201,7 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, const DBEVENTINFO *dbei) m_modules.insert(mir_strdup(dbei->szModule)); } - if (m_safetyMode) + if (m_safetyMode && !(dbei->flags & DBEF_TEMPORARY)) NotifyEventHooks(g_hevEventAdded, hNotifyContact, (LPARAM)hDbEvent); return hDbEvent; -- cgit v1.2.3