From cb3f9df94ba93527b8c589346b7b4482abad0fae Mon Sep 17 00:00:00 2001 From: ElzorFox Date: Thu, 27 Sep 2018 12:33:54 +0500 Subject: Scriver: fix loading read messages into the log when contact window is open --- plugins/Scriver/src/msgs.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index ac2bfd44ce..15b664fd95 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -88,10 +88,6 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) static int MessageEventAdded(WPARAM hContact, LPARAM lParam) { MEVENT hDbEvent = (MEVENT)lParam; - DBEVENTINFO dbei = {}; - db_event_get(hDbEvent, &dbei); - if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ)) - return 0; HWND hwnd = Srmm_FindWindow(hContact); if (hwnd == nullptr) @@ -99,6 +95,12 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) if (hwnd) SendMessage(hwnd, HM_DBEVENTADDED, hContact, lParam); + DBEVENTINFO dbei = {}; + db_event_get(hDbEvent, &dbei); + + if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ)) + return 0; + if (dbei.flags & DBEF_SENT || !DbEventIsMessageOrCustom(&dbei)) return 0; -- cgit v1.2.3