diff options
author | George Hazan <ghazan@miranda.im> | 2023-03-15 18:08:51 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-03-15 18:08:51 +0300 |
commit | cf91db5000d4f11745e2fe8bb6e7f5c6c6ba162a (patch) | |
tree | 00340b66a65ff421381496798f033a3150754570 /src/core/stdmsg | |
parent | 3a02afffa431d57c9f31a542fa95710dcf3fc3d5 (diff) |
SRMM: common code exctracted to a Srmm_AddEvent() function
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 121856ce37..d2b21d2173 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -65,13 +65,13 @@ static int SRMMStatusToPf2(int status) return 0;
}
-static int MessageEventAdded(WPARAM hContact, LPARAM lParam)
+static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent)
{
if (hContact == 0 || Contact::IsGroupChat(hContact))
return 0;
DBEVENTINFO dbei = {};
- if (db_event_get(lParam, &dbei))
+ if (db_event_get(hDbEvent, &dbei))
return 0;
if (dbei.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei)))
@@ -105,17 +105,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) }
}
- wchar_t toolTip[256];
- mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(hContact));
-
- CLISTEVENT cle = {};
- cle.hContact = hContact;
- cle.hDbEvent = lParam;
- cle.flags = CLEF_UNICODE;
- cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = MS_MSG_READMESSAGE;
- cle.szTooltip.w = toolTip;
- g_clistApi.pfnAddEvent(&cle);
+ Srmm_AddEvent(hContact, hDbEvent);
return 0;
}
@@ -283,20 +273,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 RegisterSRMMFonts(void);
|