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 /plugins | |
parent | 3a02afffa431d57c9f31a542fa95710dcf3fc3d5 (diff) |
SRMM: common code exctracted to a Srmm_AddEvent() function
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 32 | ||||
-rw-r--r-- | plugins/TabSRMM/src/container.cpp | 13 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 16 | ||||
-rw-r--r-- | plugins/TabSRMM/src/mim.cpp | 14 |
4 files changed, 10 insertions, 65 deletions
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)
diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 2c6c218631..2d64f9f681 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -2346,18 +2346,7 @@ void TSAPI AutoCreateWindow(MCONTACT hContact, MEVENT hDbEvent) if (!(dbei.flags & DBEF_READ)) {
AddUnreadContact(hContact);
-
- wchar_t toolTip[256];
- mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(hContact));
-
- CLISTEVENT cle = {};
- cle.hContact = hContact;
- cle.hDbEvent = hDbEvent;
- 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);
}
}
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 397e829dc1..7c7a649412 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -455,20 +455,8 @@ void CGlobals::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 CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 7412bd0474..434472f9b3 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -286,6 +286,7 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM nSecs) if (nSecs) {
wchar_t szTip[256];
mir_snwprintf(szTip, TranslateT("%s is typing a message"), Clist_GetContactDisplayName(hContact));
+
if (fShowOnClist && g_plugin.getByte("ShowTypingBalloon", 0))
Clist_TrayNotifyW(nullptr, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4);
@@ -446,18 +447,7 @@ nowindowcreate: // the contact list for flashing
if (!(dbei.flags & DBEF_READ)) {
AddUnreadContact(hContact);
-
- wchar_t toolTip[256];
- mir_snwprintf(toolTip, TranslateT("Message from %s"), Clist_GetContactDisplayName(hContact));
-
- CLISTEVENT cle = {};
- cle.hContact = hContact;
- cle.hDbEvent = hDbEvent;
- 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;
}
|