diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-05 21:10:22 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-05 21:10:22 +0300 |
commit | d9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 (patch) | |
tree | f09baaf9b91477d009cedc5bd77449b0fa3e3af7 /plugins/Toaster/src | |
parent | 8a1ff32e54b39ceef22df61bda17bbfda94918fc (diff) |
Popup:
- wiping out checks for service presence;
- code cleaning
Diffstat (limited to 'plugins/Toaster/src')
-rw-r--r-- | plugins/Toaster/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/Toaster/src/options.cpp | 14 | ||||
-rw-r--r-- | plugins/Toaster/src/services.cpp | 32 |
3 files changed, 21 insertions, 29 deletions
diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index cd51eb9819..7aeb3bee78 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -24,6 +24,10 @@ CMPlugin::CMPlugin() : /////////////////////////////////////////////////////////////////////////////////////////
+extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_POPUP, MIID_LAST };
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int OnPreShutdown(WPARAM, LPARAM)
{
CleanupClasses();
diff --git a/plugins/Toaster/src/options.cpp b/plugins/Toaster/src/options.cpp index a235263cff..7c1e446042 100644 --- a/plugins/Toaster/src/options.cpp +++ b/plugins/Toaster/src/options.cpp @@ -20,18 +20,16 @@ bool COptions::OnInitDialog() void COptions::Shortcut_OnClick(CCtrlBase*)
{
if (FAILED(TryCreateShortcut()))
- {
- CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Failed to create shortcut"), (LPARAM)SM_ERROR);
- return;
- }
- CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Shortcut was added to the start menu"), (LPARAM)SM_NOTIFY);
+ PUShowMessageW(TranslateT("Failed to create shortcut"), SM_ERROR);
+ else
+ PUShowMessageW(TranslateT("Shortcut was added to the start menu"), SM_NOTIFY);
}
void COptions::Preview_OnClick(CCtrlBase*)
{
- CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Information"), (LPARAM)SM_NOTIFY);
- CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Warning"), (LPARAM)SM_WARNING);
- CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Error"), (LPARAM)SM_ERROR);
+ PUShowMessageW(TranslateT("Information"), SM_NOTIFY);
+ PUShowMessageW(TranslateT("Warning"), SM_WARNING);
+ PUShowMessageW(TranslateT("Error"), SM_ERROR);
}
void COptions::Enabled_OnChange(CCtrlCheck* chk)
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 82c7572601..6bc3e1b8e4 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -13,35 +13,25 @@ void __stdcall ShowToastNotification(void* p) return;
ptrW imagePath;
- if (td->hContact != NULL && td->hContact != INVALID_CONTACT_ID)
- {
- const char* szProto = GetContactProto(td->hContact);
- if (ProtoServiceExists(szProto, PS_GETAVATARINFO))
- {
+ if (td->hContact != NULL && td->hContact != INVALID_CONTACT_ID) {
+ const char *szProto = GetContactProto(td->hContact);
+ if (ProtoServiceExists(szProto, PS_GETAVATARINFO)) {
PROTO_AVATAR_INFORMATION pai = { td->hContact };
if (CallProtoService(szProto, PS_GETAVATARINFO, 0, (LPARAM)&pai) == GAIR_SUCCESS)
- {
imagePath = mir_wstrdup(pai.filename);
- }
}
- if (imagePath == NULL)
- {
- if (szProto) imagePath = ToasterImage(szProto);
- else
- {
+ if (imagePath == NULL) {
+ if (szProto)
+ imagePath = ToasterImage(szProto);
+ else {
if (td->iType == 1 && td->hBitmap) imagePath = ToasterImage(td->hBitmap);
else if (td->iType == 2 && td->hIcon) imagePath = ToasterImage(td->hIcon);
}
}
}
- else
- {
- if (td->hIcon)
- {
- imagePath = ToasterImage(td->hIcon);
- }
- }
+ else if (td->hIcon)
+ imagePath = ToasterImage(td->hIcon);
new (std::nothrow) ToastNotification(td->tszText, td->tszTitle, imagePath, td->hContact, td->pPopupProc, td->vPopupData);
}
@@ -175,7 +165,7 @@ void CleanupClasses() static INT_PTR PopupQuery(WPARAM wParam, LPARAM)
{
- switch (wParam)
+ switch (wParam)
{
case PUQS_ENABLEPOPUPS:
{
@@ -259,4 +249,4 @@ void InitServices() CreateServiceFunction(MS_POPUP_GETCONTACT, GetPopupContact);
CreateServiceFunction(MS_POPUP_DESTROYPOPUP, HideToast);
-}
\ No newline at end of file +}
|