diff options
author | George Hazan <george.hazan@gmail.com> | 2016-01-28 11:20:28 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-01-28 11:20:28 +0000 |
commit | 3ffb500915c8b5a9e02d2b0136c20e9519d4f983 (patch) | |
tree | 1773fa5354865dcbaf8a45efd418d4420cfbfff5 /src/core/stdmsg | |
parent | 02d5017ff8c7e8d66adbb210433a93cff45d94d8 (diff) |
port of tabsrmm's solution for events to StdMsg & Scriver
git-svn-id: http://svn.miranda-ng.org/main/trunk@16177 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 573846ae4e..3172bdb661 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -97,7 +97,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) TCHAR toolTip[256];
mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = toolTip;
- CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
+ pcli->pfnAddEvent(&cle);
return 0;
}
@@ -178,15 +178,18 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)& tn);
}
else {
- CLISTEVENT cle = { sizeof(cle) };
+ pcli->pfnRemoveEvent(hContact, 1);
+
+ CLISTEVENT cle = {};
+ cle.cbSize = sizeof(cle);
cle.hContact = hContact;
cle.hDbEvent = 1;
cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR;
cle.hIcon = Skin_LoadIcon(SKINICON_OTHER_TYPING);
cle.pszService = "SRMsg/ReadMessage";
cle.ptszTooltip = szTip;
- CallServiceSync(MS_CLIST_REMOVEEVENT, hContact, 1);
- CallServiceSync(MS_CLIST_ADDEVENT, hContact, (LPARAM)&cle);
+ pcli->pfnAddEvent(&cle);
+
IcoLib_ReleaseIcon(cle.hIcon);
}
}
@@ -223,21 +226,29 @@ static int ContactDeleted(WPARAM wParam, LPARAM) return 0;
}
-static void RestoreUnreadMessageAlerts(void)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct MSavedEvent
{
- TCHAR toolTip[256];
+ MSavedEvent(MCONTACT _hContact, MEVENT _hEvent) :
+ hContact(_hContact),
+ hEvent(_hEvent)
+ {
+ }
- CLISTEVENT cle = { sizeof(cle) };
- cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- cle.pszService = "SRMsg/ReadMessage";
- cle.flags = CLEF_TCHAR;
- cle.ptszTooltip = toolTip;
+ MEVENT hEvent;
+ MCONTACT hContact;
+};
- DBEVENTINFO dbei = { sizeof(dbei) };
+static void RestoreUnreadMessageAlerts(void)
+{
+ OBJLIST<MSavedEvent> arEvents(10, NumericKeySortT);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) {
bool autoPopup = false;
+
+ DBEVENTINFO dbei = { sizeof(dbei) };
dbei.cbBlob = 0;
db_event_get(hDbEvent, &dbei);
if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) {
@@ -255,15 +266,27 @@ static void RestoreUnreadMessageAlerts(void) newData.noActivate = db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS);
CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), NULL, DlgProcMessage, (LPARAM)& newData);
}
- else {
- cle.hContact = hContact;
- cle.hDbEvent = hDbEvent;
- mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
- CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle);
- }
+ else arEvents.insert(new MSavedEvent(hContact, hDbEvent));
}
}
}
+
+ TCHAR toolTip[256];
+
+ CLISTEVENT cle = {};
+ cle.cbSize = sizeof(cle);
+ cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
+ cle.pszService = "SRMsg/ReadMessage";
+ cle.flags = CLEF_TCHAR;
+ cle.ptszTooltip = toolTip;
+
+ for (int i = 0; i < arEvents.getCount(); i++) {
+ MSavedEvent &e = arEvents[i];
+ mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(e.hContact, 0));
+ cle.hContact = e.hContact;
+ cle.hDbEvent = e.hEvent;
+ pcli->pfnAddEvent(&cle);
+ }
}
void RegisterSRMMFonts(void);
|