diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-02 13:15:26 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-02 13:15:26 +0000 |
commit | e97507aef71bc2bfa51b08e598f21ffe7600880a (patch) | |
tree | 7d3e1ddb43c7c3fe016bfa271703edc5919ca256 /plugins/Toaster/src/services.cpp | |
parent | b85839f935aec299520441b3a04864e9808d193b (diff) |
Toaster: support popup classes
git-svn-id: http://svn.miranda-ng.org/main/trunk@15150 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Toaster/src/services.cpp')
-rw-r--r-- | plugins/Toaster/src/services.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 501d6a8253..36edadc576 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -2,6 +2,7 @@ mir_cs csNotifications;
OBJLIST<ToastNotification> lstNotifications(1);
+std::map<std::string, int> mp_Classes;
wchar_t wszTempDir[MAX_PATH];
__forceinline bool isChatRoom(MCONTACT hContact)
@@ -161,6 +162,36 @@ static INT_PTR CreatePopup2(WPARAM wParam, LPARAM) return 0;
}
+static INT_PTR RegisterClass(WPARAM, LPARAM lParam)
+{
+ POPUPCLASS *pc = (POPUPCLASS*)lParam;
+ mp_Classes[pc->pszName] = pc->flags;
+
+ HANDLE h;
+ Utils_GetRandom(&h, sizeof(h));
+ return (INT_PTR)h;
+}
+
+static INT_PTR CreateClassPopup(WPARAM, LPARAM lParam)
+{
+ POPUPDATACLASS *ppc = (POPUPDATACLASS*)lParam;
+
+ auto it = mp_Classes.find(ppc->pszClassName);
+ if (it != mp_Classes.end())
+ {
+ if (it->second & PCF_TCHAR)
+ {
+ CallFunctionAsync(&ShowToastNotification, new ToastData(ppc->hContact, ppc->ptszTitle, ppc->ptszText));
+ }
+ else
+ {
+ CallFunctionAsync(&ShowToastNotification, new ToastData(ppc->hContact, mir_utf8decodeT(ppc->pszTitle), mir_utf8decodeT(ppc->pszText)));
+ }
+ }
+
+ return 0;
+}
+
static INT_PTR PopupQuery(WPARAM wParam, LPARAM)
{
switch (wParam) {
@@ -204,4 +235,6 @@ void InitServices() CreateServiceFunction(MS_POPUP_ADDPOPUPW, CreatePopupW);
CreateServiceFunction(MS_POPUP_ADDPOPUP2, CreatePopup2);
CreateServiceFunction(MS_POPUP_QUERY, PopupQuery);
+ CreateServiceFunction(MS_POPUP_ADDPOPUPCLASS, CreateClassPopup);
+ CreateServiceFunction(MS_POPUP_REGISTERCLASS, RegisterClass);
}
\ No newline at end of file |