From 011bae9d09a8248168a68a0c17e786df22ab1b00 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Jan 2024 19:07:29 +0300 Subject: =?UTF-8?q?fixes=20#4113=20(Discord:=20=D0=BF=D1=80=D0=BE=D1=82?= =?UTF-8?q?=D0=BE=D0=BA=D0=BE=D0=BB=20=D0=B8=D0=B3=D0=BD=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D1=80=D1=83=D0=B5=D1=82=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=B9=D0=BA=D0=B8=20=D0=B2=D1=81=D0=BF=D0=BB=D1=8B=D0=B2=D0=B0?= =?UTF-8?q?=D1=8E=D1=89=D0=B8=D1=85=20=D0=BE=D0=BA=D0=BE=D0=BD)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewEventNotify/src/main.cpp | 19 ++++++++++--------- plugins/NewEventNotify/src/stdafx.h | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index d0ae746562..deb741df44 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -61,29 +61,30 @@ CMPlugin::CMPlugin() : int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent) { //are popups currently enabled? - if (!g_plugin.bPopups) + if (!g_plugin.bPopups || Contact::IsGroupChat(hContact)) return 0; //get DBEVENTINFO without pBlob - DBEVENTINFO dbe = {}; - db_event_get(hDbEvent, &dbe); + DB::EventInfo dbei(hDbEvent, false); + if (!dbei) + return 0; //do not show popups for sub-contacts if (hContact && db_mc_isSub(hContact)) return 0; //custom database event types - DBEVENTTYPEDESCR *pei = DbEvent_GetType(dbe.szModule, dbe.eventType); + DBEVENTTYPEDESCR *pei = DbEvent_GetType(dbei.szModule, dbei.eventType); // ignore events according to flags if (pei && pei->flags & DETF_NONOTIFY) return 0; // if event was allready read don't show it - if (g_plugin.bReadCheck && (dbe.flags & DBEF_READ)) + if (g_plugin.bReadCheck && (dbei.flags & DBEF_READ)) return 0; // is it an event sent by the user? -> don't show - if (dbe.flags & DBEF_SENT) { + if (dbei.flags & DBEF_SENT) { // JK, only message event, do not influence others auto *pdata = PU_GetByContact(hContact, EVENTTYPE_MESSAGE); if (g_plugin.bHideSend && pdata) @@ -94,15 +95,15 @@ int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent) // which status do we have, are we allowed to post popups? // UNDER CONSTRUCTION!!! CallService(MS_CLIST_GETSTATUSMODE, 0, 0); /// TODO: JK: ???? - if (dbe.eventType == EVENTTYPE_MESSAGE && (g_plugin.bMsgWindowCheck && hContact && CheckMsgWnd(hContact))) + if (dbei.eventType == EVENTTYPE_MESSAGE && (g_plugin.bMsgWindowCheck && hContact && CheckMsgWnd(hContact))) return 0; // is another popup for this contact already present? -> merge message popups if enabled auto *pdata = PU_GetByContact(hContact, EVENTTYPE_MESSAGE); - if (dbe.eventType == EVENTTYPE_MESSAGE && g_plugin.bMergePopup && pdata) + if (dbei.eventType == EVENTTYPE_MESSAGE && g_plugin.bMergePopup && pdata) PopupUpdate(*pdata, hDbEvent); else - PopupShow(hContact, hDbEvent, (UINT)dbe.eventType); + PopupShow(hContact, hDbEvent, dbei.eventType); return 0; } diff --git a/plugins/NewEventNotify/src/stdafx.h b/plugins/NewEventNotify/src/stdafx.h index c6d4e596a3..45db29c4a7 100644 --- a/plugins/NewEventNotify/src/stdafx.h +++ b/plugins/NewEventNotify/src/stdafx.h @@ -35,6 +35,7 @@ #include #include +#include #include #include #include -- cgit v1.2.3