From cf91db5000d4f11745e2fe8bb6e7f5c6c6ba162a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 15 Mar 2023 18:08:51 +0300 Subject: SRMM: common code exctracted to a Srmm_AddEvent() function --- plugins/Scriver/src/msgs.cpp | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'plugins/Scriver') diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index e939a1c69e..8302c903ce 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -108,19 +108,9 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) } } - if (hwnd == nullptr || !IsWindowVisible(GetParent(hwnd))) { - wchar_t toolTip[256]; - mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(hContact)); - - CLISTEVENT cle = {}; - cle.flags = CLEF_UNICODE; - cle.hContact = hContact; - cle.hDbEvent = hDbEvent; - cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); - cle.pszService = MS_MSG_READMESSAGE; - cle.szTooltip.w = toolTip; - g_clistApi.pfnAddEvent(&cle); - } + if (hwnd == nullptr || !IsWindowVisible(GetParent(hwnd))) + Srmm_AddEvent(hContact, hDbEvent); + return 0; } @@ -263,20 +253,8 @@ static void RestoreUnreadMessageAlerts(void) } } - wchar_t toolTip[256]; - - CLISTEVENT cle = {}; - cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); - cle.pszService = MS_MSG_READMESSAGE; - cle.flags = CLEF_UNICODE; - cle.szTooltip.w = toolTip; - - for (auto &e : arEvents) { - mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(e->hContact)); - cle.hContact = e->hContact; - cle.hDbEvent = e->hEvent; - g_clistApi.pfnAddEvent(&cle); - } + for (auto &e : arEvents) + Srmm_AddEvent(e->hContact, e->hEvent); } void CMsgDialog::SetStatusText(const wchar_t *wszText, HICON hIcon) -- cgit v1.2.3