From 93545c9575e94cb9015827525a8737437f80166a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 2 Aug 2023 21:40:08 +0300 Subject: =?UTF-8?q?fixes=20#3605=20(NewsAggregator:=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B8=20=D0=B2=D1=81=D1=82=D1=80=D0=BE=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B6=D1=83=D1=80=D0=BD=D0=B0=D0=BB?= =?UTF-8?q?=D0=B0=20StdMsg=20=D0=B8=D0=BB=D0=B8=20Scriver=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D1=80=D1=8B=D1=82=D1=8B=D0=B9=20=D0=B8=D0=B7=20=D1=81?= =?UTF-8?q?=D0=BF=D0=B8=D1=81=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B0?= =?UTF-8?q?=D0=BA=D1=82=D0=BE=D0=B2=20=D1=84=D0=B8=D0=B4=20=D0=BF=D1=83?= =?UTF-8?q?=D1=81=D1=82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #3523 (NewsAggregator и история сообщений.) --- plugins/Scriver/src/msgs.cpp | 51 +++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 62d97ef0fe..80dbe87ee0 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -79,6 +79,39 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + +struct CAutoPpopup : public MAsyncObject +{ + MCONTACT hContact; + MEVENT hDbEvent; + + CAutoPpopup(MCONTACT _1, MEVENT _2) : + hContact(_1), + hDbEvent(_2) + {} + + void Invoke() override + { + /* does a window for the contact exist? */ + HWND hwnd = Srmm_FindWindow(hContact); + if (hwnd == nullptr) + hwnd = Srmm_FindWindow(db_event_getContact(hDbEvent)); + + if (hwnd == nullptr) { + /* new message */ + Skin_PlaySound("AlertMsg"); + if (IsAutoPopup(hContact)) { + (new CMsgDialog(hContact, true))->Show(); + return; + } + } + + if (hwnd == nullptr || !IsWindowVisible(GetParent(hwnd))) + Srmm_AddEvent(hContact, hDbEvent); + } +}; + static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) { if (hContact == 0 || Contact::IsGroupChat(hContact)) @@ -94,23 +127,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) if (dbei.flags & DBEF_SENT || !DbEventIsMessageOrCustom(dbei)) return 0; - /* does a window for the contact exist? */ - HWND hwnd = Srmm_FindWindow(hContact); - if (hwnd == nullptr) - hwnd = Srmm_FindWindow(db_event_getContact(hDbEvent)); - - if (hwnd == nullptr) { - /* new message */ - Skin_PlaySound("AlertMsg"); - if (IsAutoPopup(hContact)) { - (new CMsgDialog(hContact, true))->Show(); - return 0; - } - } - - if (hwnd == nullptr || !IsWindowVisible(GetParent(hwnd))) - Srmm_AddEvent(hContact, hDbEvent); - + Utils_InvokeAsync(new CAutoPpopup(hContact, hDbEvent)); return 0; } -- cgit v1.2.3