summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Toaster/src/main.cpp')
-rw-r--r--plugins/Toaster/src/main.cpp80
1 files changed, 4 insertions, 76 deletions
diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp
index 0f6265e293..c5cf1d04ca 100644
--- a/plugins/Toaster/src/main.cpp
+++ b/plugins/Toaster/src/main.cpp
@@ -29,91 +29,19 @@ DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
OSVERSIONINFO osvi = { sizeof(OSVERSIONINFO) };
- //GetVersionEx(&osvi);
- //if (osvi.dwMajorVersion >= 6 && osvi.dwMinorVersion >= 2)
+ if (IsWinVer8Plus())
return &pluginInfo;
- //MessageBox(NULL, _T(MODULE" supports Windows 8 or higher"), _T(MODULE), MB_OK | MB_ICONERROR);
- //return NULL;
+ MessageBox(NULL, _T(MODULE" supports Windows 8 or higher"), _T(MODULE), MB_OK | MB_ICONERROR);
+ return NULL;
}
-static void __cdecl OnToastNotificationClicked(void* arg)
-{
- MCONTACT hContact = (MCONTACT)arg;
- if (hContact)
- CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)"");
-}
-
-static void ShowToastNotification(TCHAR* text, TCHAR* title, MCONTACT hContact)
-{
- ptrT imagePath;
- ToastEventHandler *eventHandler;
- /*if (hContact)
- {
- eventHandler = new ToastEventHandler(OnToastNotificationClicked, (void*)hContact);
-
- TCHAR avatarPath[MAX_PATH] = { 0 };
- const char* szProto = GetContactProto(hContact);
- if (ProtoServiceExists(szProto, PS_GETMYAVATAR))
- if (!CallProtoService(szProto, PS_GETMYAVATAR, (WPARAM)avatarPath, (LPARAM)MAX_PATH))
- imagePath = mir_tstrdup(avatarPath);
- }
- else*/
- eventHandler = new ToastEventHandler(nullptr);
-
- ToastNotification notification(text, title, imagePath);
- notification.Show(eventHandler);
-}
-
-static INT_PTR CreatePopup(WPARAM wParam, LPARAM)
-{
- POPUPDATA *ppd = (POPUPDATA*)wParam;
- ptrW text(mir_a2u(ppd->lpzText));
- ptrW contactName(mir_a2u(ppd->lpzContactName));
-
- ShowToastNotification(text, contactName, ppd->lchContact);
-
- return 0;
-}
-
-static INT_PTR CreatePopupW(WPARAM wParam, LPARAM)
-{
- POPUPDATAW *ppd = (POPUPDATAW*)wParam;
-
- ShowToastNotification(ppd->lpwzText, ppd->lpwzContactName, ppd->lchContact);
-
- return 0;
-}
-
-static INT_PTR CreatePopup2(WPARAM wParam, LPARAM)
-{
- POPUPDATA2 *ppd = (POPUPDATA2*)wParam;
-
- ptrW text, title;
- if (ppd->flags & PU2_UNICODE)
- {
- text = mir_wstrdup(ppd->lpwzText);
- title = mir_wstrdup(ppd->lpwzTitle);
- }
- else
- {
- text = mir_a2u(ppd->lpzText);
- title = mir_a2u(ppd->lpzTitle);
- }
-
- ShowToastNotification(text, title, ppd->lchContact);
-
- return 0;
-}
-
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
- CreateServiceFunction(MS_POPUP_ADDPOPUP, CreatePopup);
- CreateServiceFunction(MS_POPUP_ADDPOPUPW, CreatePopupW);
- CreateServiceFunction(MS_POPUP_ADDPOPUP2, CreatePopup2);
+ InitServices();
return 0;
}