From 3f84f1e91015247074f5154498aec78e70b8f471 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 3 Jan 2025 13:30:24 +0300 Subject: =?UTF-8?q?fixes=20#4822=20(NS+TabSRMM=20-=20=D0=B3=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B8=D1=82=20=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BE=D0=BE?= =?UTF-8?q?=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D0=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/NewStory/src/utils.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'plugins/NewStory/src/utils.cpp') diff --git a/plugins/NewStory/src/utils.cpp b/plugins/NewStory/src/utils.cpp index cfe158f433..927b2b0ab2 100644 --- a/plugins/NewStory/src/utils.cpp +++ b/plugins/NewStory/src/utils.cpp @@ -49,19 +49,29 @@ Bitmap* LoadImageFromResource(HINSTANCE hInst, int resourceId, const wchar_t *pw ///////////////////////////////////////////////////////////////////////////////////////// -int SmartSendEvent(int iEventType, MCONTACT hContact, LPARAM hEvent) +static void SmartSendEventWorker(MWindowList wndList, int iEventType, MCONTACT cc1, MCONTACT cc2, MEVENT hEvent) { - if (HWND hwnd = WindowList_Find(g_hNewstoryLogs, hContact)) - SendMessage(hwnd, iEventType, hContact, hEvent); + if (HWND hwnd = WindowList_Find(wndList, cc1)) + PostMessage(hwnd, iEventType, cc1, hEvent); - if (db_mc_isMeta(hContact)) { - // Send a message to a real contact too + if (cc2 != INVALID_CONTACT_ID) + if (HWND hwnd = WindowList_Find(wndList, cc2)) + PostMessage(hwnd, iEventType, cc2, hEvent); +} + +int SmartSendEvent(int iEventType, MCONTACT cc1, MEVENT hEvent) +{ + MCONTACT cc2 = INVALID_CONTACT_ID; + + // Send a message to a real contact too + if (db_mc_isMeta(cc1)) { MCONTACT cc = db_event_getContact(hEvent); - if (cc != hContact) - if (HWND hwnd = WindowList_Find(g_hNewstoryLogs, cc)) - SendMessage(hwnd, iEventType, cc, hEvent); + if (cc != cc1) + cc2 = cc; } + SmartSendEventWorker(g_hNewstoryLogs, iEventType, cc1, cc2, hEvent); + SmartSendEventWorker(g_hNewstoryHistLogs, iEventType, cc1, cc2, hEvent); return 0; } -- cgit v1.2.3