summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_clist.h8
-rw-r--r--protocols/ICQ-WIM/src/poll.cpp2
-rw-r--r--protocols/ICQ-WIM/src/proto.h1
-rw-r--r--protocols/ICQ-WIM/src/utils.cpp5
-rw-r--r--src/mir_app/src/clistevents.cpp17
5 files changed, 20 insertions, 13 deletions
diff --git a/include/m_clist.h b/include/m_clist.h
index 116ddfa931..2739ae2a05 100644
--- a/include/m_clist.h
+++ b/include/m_clist.h
@@ -247,10 +247,8 @@ struct CLISTEVENT
MCONTACT hContact; // handle to the contact to put the icon by
DWORD flags; // ...of course
HICON hIcon; // icon to flash
- union {
- MEVENT hDbEvent; // caller defined but should be unique for hContact
- const char *lpszProtocol;
- };
+ MEVENT hDbEvent; // caller defined but should be unique for hContact
+ const char *moduleName; // for events with CLEF_PROTOCOLGLOBAL in flags
LPARAM lParam; // caller defined
const char *pszService; // name of the service to call on activation
MAllCStrings szTooltip; // short description of the event to display as a tooltip on the system tray
@@ -263,7 +261,7 @@ struct CLISTEVENT
#define CLEF_UNICODE 4 // set pszTooltip as unicode
#define CLEF_PROTOCOLGLOBAL 8 // set event globally for protocol, hContact has to be NULL,
- // lpszProtocol the protocol ID name to be set
+ // moduleName the protocol ID name to be set
/////////////////////////////////////////////////////////////////////////////////////////
// gets the image list with all the useful icons in it
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp
index e2e5fb8796..279e8ce0b2 100644
--- a/protocols/ICQ-WIM/src/poll.cpp
+++ b/protocols/ICQ-WIM/src/poll.cpp
@@ -228,7 +228,7 @@ void CIcqProto::ProcessNotification(const JSONNode &ev)
// we've read/removed some messages from server
if (iOldCount > m_unreadEmails) {
- g_clistApi.pfnRemoveEvent(0, 1);
+ g_clistApi.pfnRemoveEvent(0, ICQ_FAKE_EVENT_ID);
return;
}
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index 5a27d13893..b560335ce0 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -35,6 +35,7 @@
#define ICQ_APP_ID "ic1nmMjqg7Yu-0hL"
#define ICQ_API_SERVER "https://api.icq.net"
+#define ICQ_FAKE_EVENT_ID 0xBABAEB
#define ICQ_ROBUST_SERVER "https://rapi.icq.net"
#define PS_DUMMY "/DoNothing"
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp
index 3f5cefb9a5..786c4679f2 100644
--- a/protocols/ICQ-WIM/src/utils.cpp
+++ b/protocols/ICQ-WIM/src/utils.cpp
@@ -369,9 +369,10 @@ void CIcqProto::EmailNotification(const wchar_t *pwszText)
return;
CLISTEVENT cle = {};
- cle.hDbEvent = 1;
+ cle.hDbEvent = ICQ_FAKE_EVENT_ID;
+ cle.moduleName = m_szModuleName;
cle.hIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
- cle.flags = CLEF_UNICODE;
+ cle.flags = CLEF_UNICODE | CLEF_PROTOCOLGLOBAL;
cle.pszService = szServiceFunction;
cle.szTooltip.w = pwszText;
g_clistApi.pfnAddEvent(&cle);
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