From c5c5972135f392bd2ab5bacc6ce476e3aa267ca3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Mar 2019 18:53:07 +0300 Subject: Clist events: - no need to save 4 bytes each time we wanna declare protocol-wide events; - all event adding code is forced to be executed in the main thread; - also fixes #1904 (ICQ: mail notification bug); - now we can use any event ids for global events. --- src/mir_app/src/clistevents.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index ecb1672986..d3163cd4dc 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -71,7 +71,7 @@ static const char* GetEventProtocol(const CListEvent &ev) if (ev.hContact != 0) return GetContactProto(ev.hContact); - return (ev.flags & CLEF_PROTOCOLGLOBAL) ? ev.lpszProtocol : nullptr; + return (ev.flags & CLEF_PROTOCOLGLOBAL) ? ev.moduleName : nullptr; } ///////////////////////////////////////////////////////////////////////////////////////// @@ -154,10 +154,9 @@ static VOID CALLBACK IconFlashTimer(HWND, UINT, UINT_PTR idEvent, DWORD) iconsOn = !iconsOn; } -CListEvent* fnAddEvent(CLISTEVENT *cle) +static INT_PTR CALLBACK DoAddEvent(void *param) { - if (cle == nullptr) - return nullptr; + CLISTEVENT *cle = (CLISTEVENT*)param; CListEvent *p = new CListEvent(); memcpy(p, cle, sizeof(*cle)); @@ -177,7 +176,15 @@ CListEvent* fnAddEvent(CLISTEVENT *cle) TrayIconUpdateWithImageList(p->imlIconIndex, p->szTooltip.w, GetEventProtocol(*p)); } Clist_ChangeContactIcon(cle->hContact, p->imlIconIndex); - return p; + return (INT_PTR)p; +} + +CListEvent* fnAddEvent(CLISTEVENT *cle) +{ + if (cle == nullptr) + return nullptr; + + return (CListEvent*)CallFunctionSync(DoAddEvent, cle); } // Removes an event from the contact list's queue -- cgit v1.2.3