summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Toaster/src/main.cpp14
-rw-r--r--plugins/Toaster/src/services.cpp39
-rw-r--r--plugins/Toaster/src/stdafx.h19
3 files changed, 58 insertions, 14 deletions
diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp
index 13296b3889..a005a1b8c6 100644
--- a/plugins/Toaster/src/main.cpp
+++ b/plugins/Toaster/src/main.cpp
@@ -59,6 +59,14 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
+ return 0;
+}
+
+int OnPreShutdown(WPARAM, LPARAM)
+{
+ CallFunctionAsync(&HideAllToasts, NULL);
+ CleanupClasses();
+
SHFILEOPSTRUCT file_op = {
NULL,
FO_DELETE,
@@ -70,12 +78,6 @@ extern "C" int __declspec(dllexport) Unload(void)
_T("")
};
SHFileOperation(&file_op);
- return 0;
-}
-int OnPreShutdown(WPARAM, LPARAM)
-{
- CallFunctionAsync(&HideAllToasts, NULL);
- CleanupClasses();
return 0;
} \ No newline at end of file
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp
index 02a92f24ab..82d9c9413d 100644
--- a/plugins/Toaster/src/services.cpp
+++ b/plugins/Toaster/src/services.cpp
@@ -28,7 +28,11 @@ void __stdcall ShowToastNotification(void* p)
if (imagePath == NULL)
{
- if ((td->hIcon && td->bForcehIcon) || !szProto)
+ if (td->iType == 1 && td->hBitmap)
+ {
+ imagePath = ToasterImage(td->hBitmap);
+ }
+ else if (td->iType == 2 && td->hIcon)
{
imagePath = ToasterImage(td->hIcon);
}
@@ -119,7 +123,13 @@ static INT_PTR CreatePopup2(WPARAM wParam, LPARAM)
title = mir_a2u(ppd->lpzTitle);
}
- ToastData *td = new ToastData(ppd->lchContact, title, text, ppd->lchIcon);
+ ToastData *td = NULL;
+
+ if (ppd->hbmAvatar)
+ td = new ToastData(ppd->lchContact, title, text, ppd->hbmAvatar);
+ else
+ td = new ToastData(ppd->lchContact, title, text, ppd->lchIcon);
+
td->vPopupData = ppd->PluginData;
td->pPopupProc = ppd->PluginWindowProc;
@@ -151,11 +161,11 @@ static INT_PTR CreateClassPopup(WPARAM, LPARAM lParam)
if (it->second->iFlags & PCF_TCHAR)
{
- td = new ToastData(ppc->hContact, ppc->ptszTitle, ppc->ptszText, it->second->hIcon, 1);
+ td = new ToastData(ppc->hContact, ppc->ptszTitle, ppc->ptszText, it->second->hIcon);
}
else
{
- td = new ToastData(ppc->hContact, mir_utf8decodeT(ppc->pszTitle), mir_utf8decodeT(ppc->pszText), it->second->hIcon, 1);
+ td = new ToastData(ppc->hContact, mir_utf8decodeT(ppc->pszTitle), mir_utf8decodeT(ppc->pszText), it->second->hIcon);
}
td->vPopupData = ppc->PluginData;
@@ -219,6 +229,23 @@ static INT_PTR PopupQuery(WPARAM wParam, LPARAM)
}
}
+static INT_PTR ShowMessage(WPARAM wParam, LPARAM)
+{
+ ptrT tszText(mir_utf8decodeT((char*)wParam));
+ ToastData *td = new ToastData(NULL, NULL, tszText, HICON(0));
+
+ CallFunctionAsync(&ShowToastNotification, td);
+
+ return 0;
+}
+static INT_PTR ShowMessageW(WPARAM wParam, LPARAM)
+{
+ ToastData *td = new ToastData(NULL, NULL, (wchar_t*)wParam, HICON(0));
+ CallFunctionAsync(&ShowToastNotification, td);
+
+ return 0;
+}
+
void __stdcall HideAllToasts(void*)
{
mir_cslock lck(csNotifications);
@@ -231,10 +258,14 @@ void __stdcall HideAllToasts(void*)
void InitServices()
{
+ CreateServiceFunction(MS_POPUP_SHOWMESSAGE, ShowMessage);
+ CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, ShowMessageW);
+
CreateServiceFunction(MS_POPUP_ADDPOPUP, CreatePopup);
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);
CreateServiceFunction(MS_POPUP_UNREGISTERCLASS, UnRegisterClass);
diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h
index 5c7537641d..a0b2a3509e 100644
--- a/plugins/Toaster/src/stdafx.h
+++ b/plugins/Toaster/src/stdafx.h
@@ -62,18 +62,29 @@ struct ToastData
MCONTACT hContact;
TCHAR *tszTitle;
TCHAR *tszText;
- HICON hIcon;
- bool bForcehIcon;
+ union
+ {
+ HICON hIcon;
+ HBITMAP hBitmap;
+ };
+ int iType; // 0 = none, 1 = hBitmap, 2 = hIcon
WNDPROC pPopupProc;
void *vPopupData;
- ToastData(MCONTACT _hContact, const TCHAR *_tszTitle, const TCHAR *_tszText, HICON _hIcon = NULL, bool b = false) :
+ ToastData(MCONTACT _hContact, const TCHAR *_tszTitle, const TCHAR *_tszText, HICON _hIcon = NULL) :
hContact(_hContact),
tszTitle(mir_tstrdup(_tszTitle)),
tszText(mir_tstrdup(_tszText)),
hIcon(_hIcon),
- bForcehIcon(b)
+ iType(_hIcon ? 2 : 0)
+ {}
+ ToastData(MCONTACT _hContact, const TCHAR *_tszTitle, const TCHAR *_tszText, HBITMAP bmp = NULL) :
+ hContact(_hContact),
+ tszTitle(mir_tstrdup(_tszTitle)),
+ tszText(mir_tstrdup(_tszText)),
+ hBitmap(bmp),
+ iType(bmp ? 1 : 0)
{}
~ToastData()
{