summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-06 16:15:45 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-06 16:15:55 +0300
commitf580be3d9dcccb14831d6bed9e7dfca600f5b6f8 (patch)
tree468913d477b9d2a9fb430df9a886d24a8cf41887
parent827dbce0a554ccc313fd0b14b45bd57dffeead95 (diff)
popups:
- internal implementation details & all service declarations moved to m_popup_int.h; - all service calls removed and replaced with function calls; - direct access to popup serttings replaced with Popup_Enable / Popup_Enabled;
-rw-r--r--include/m_popup.h418
-rw-r--r--include/m_popup_int.h43
-rw-r--r--libs/win32/mir_app.libbin184278 -> 188990 bytes
-rw-r--r--libs/win64/mir_app.libbin180578 -> 184906 bytes
-rwxr-xr-xplugins/Alarms/src/alarmlist.cpp4
-rw-r--r--plugins/BossKeyPlus/src/BossKey.cpp14
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp12
-rw-r--r--plugins/ChangeKeyboardLayout/src/hook_events.cpp4
-rw-r--r--plugins/ChangeKeyboardLayout/src/options.cpp6
-rw-r--r--plugins/ChangeKeyboardLayout/src/text_operations.cpp5
-rw-r--r--plugins/ClientChangeNotify/src/ClientChangeNotify.cpp4
-rw-r--r--plugins/CmdLine/src/mimcmd_handlers.cpp12
-rw-r--r--plugins/Exchange/src/emails.cpp2
-rw-r--r--plugins/MirLua/Modules/m_popup/src/main.cpp12
-rw-r--r--plugins/MirLua/Modules/m_popup/src/stdafx.h1
-rw-r--r--plugins/MirLua/src/utils.cpp2
-rw-r--r--plugins/MsgPopup/src/main.cpp5
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp14
-rw-r--r--plugins/NotifyAnything/src/main.cpp2
-rw-r--r--plugins/Nudge/src/main.cpp6
-rw-r--r--plugins/PackUpdater/Src/Notifications.cpp14
-rw-r--r--plugins/PackUpdater/Src/Options.cpp4
-rw-r--r--plugins/PackUpdater/Src/Utils.cpp10
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp2
-rw-r--r--plugins/PluginUpdater/src/Notifications.cpp2
-rw-r--r--plugins/Popup/src/config.cpp15
-rw-r--r--plugins/Popup/src/config.h1
-rw-r--r--plugins/Popup/src/history.cpp28
-rw-r--r--plugins/Popup/src/main.cpp29
-rw-r--r--plugins/Popup/src/opt_class.cpp4
-rw-r--r--plugins/Popup/src/opt_gen.cpp19
-rw-r--r--plugins/Popup/src/opt_skins.cpp4
-rw-r--r--plugins/Popup/src/popup_wnd2.cpp8
-rw-r--r--plugins/Popup/src/popup_wnd2.h4
-rw-r--r--plugins/Popup/src/services.cpp70
-rw-r--r--plugins/Popup/src/stdafx.h2
-rw-r--r--plugins/SeenPlugin/src/options.cpp2
-rw-r--r--plugins/SendScreenshotPlus/src/Main.cpp1
-rw-r--r--plugins/SendScreenshotPlus/src/dlg_msgbox.cpp5
-rw-r--r--plugins/SmileyAdd/src/general.cpp2
-rw-r--r--plugins/Spamotron/src/popups.cpp5
-rw-r--r--plugins/StartupSilence/src/main.cpp8
-rw-r--r--plugins/StatusManager/src/keepstatus.cpp2
-rw-r--r--plugins/TabSRMM/src/chat_tools.cpp2
-rw-r--r--plugins/TabSRMM/src/msgs.cpp2
-rw-r--r--plugins/TabSRMM/src/typingnotify.cpp5
-rw-r--r--plugins/Toaster/src/options.cpp7
-rw-r--r--plugins/Toaster/src/services.cpp47
-rw-r--r--plugins/Toaster/src/stdafx.h2
-rw-r--r--plugins/UserInfoEx/src/dlg_msgbox.cpp6
-rw-r--r--plugins/UserInfoEx/src/init.cpp2
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp6
-rw-r--r--plugins/UserInfoEx/src/stdafx.h1
-rw-r--r--plugins/UserInfoEx/src/svc_refreshci.cpp5
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp2
-rw-r--r--protocols/CloudFile/src/utils.cpp2
-rw-r--r--protocols/ConnectionNotify/src/ConnectionNotify.cpp2
-rw-r--r--protocols/FacebookRM/src/events.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/popups.cpp6
-rwxr-xr-xprotocols/JabberG/src/jabber_misc.cpp8
-rw-r--r--protocols/MSN/src/msn_misc.cpp6
-rw-r--r--protocols/Sametime/src/utils.cpp6
-rw-r--r--protocols/SkypeWeb/src/skype_popups.cpp6
-rw-r--r--protocols/Steam/src/steam_utils.cpp2
-rw-r--r--protocols/Tox/src/tox_utils.cpp2
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp6
-rw-r--r--protocols/YAMN/src/browser/badconnect.cpp5
-rw-r--r--protocols/YAMN/src/browser/mailbrowser.cpp4
-rw-r--r--src/core/stdpopup/src/options.cpp8
-rw-r--r--src/core/stdpopup/src/services.cpp49
-rw-r--r--src/core/stdpopup/src/stdafx.h2
-rw-r--r--src/core/stdpopup/src/yapp.cpp4
-rw-r--r--src/mir_app/src/chat_tools.cpp2
-rw-r--r--src/mir_app/src/mir_app.def21
-rw-r--r--src/mir_app/src/mir_app64.def21
-rw-r--r--src/mir_app/src/popups.cpp147
-rw-r--r--src/mir_app/src/stdafx.h54
77 files changed, 561 insertions, 702 deletions
diff --git a/include/m_popup.h b/include/m_popup.h
index fb771a2498..6c0b168224 100644
--- a/include/m_popup.h
+++ b/include/m_popup.h
@@ -18,10 +18,11 @@ them!
#ifndef M_POPUP_H
#define M_POPUP_H
-#include <m_database.h>
+EXTERN_C MIR_APP_DLL(void) Popup_Enable(bool bEnable);
+EXTERN_C MIR_APP_DLL(bool) Popup_Enabled();
/*
-NOTE! Since Popup 1.0.1.2 there is a main meun group called "Popups" where I
+NOTE! Since Popup 1.0.1.2 there is a main menu group called "Popups" where I
have put a "Enable/Disable" item. You can add your own "enable/disable" items
by adding these lines before you call MS_CLIST_ADDMAINMENUITEM:
mi.pszPopupName = Translate("Popups");
@@ -38,7 +39,7 @@ mi.position = 0; //You don't need it and it's better if you put it to zero.
// popup you are requesting
// ANSI Popup Action
-typedef struct
+struct POPUPACTION
{
int cbSize; // sizeof(POPUPACTION)
HICON lchIcon; // Action Icon
@@ -49,7 +50,7 @@ typedef struct
DWORD flags; // set of PAF_* flags
WPARAM wParam; // wParam for UM_POPUPACTION message
LPARAM lParam; // lParam for UM_POPUPACTION message
-} POPUPACTION, *LPPOPUPACTION;
+};
///////////////////////////////////////////////////////////////
// Few notes about new popup api
@@ -65,7 +66,7 @@ typedef struct
#define PU2_UNICODE 0x01
#define PU2_CUSTOM_POPUP 0x02
-typedef struct
+struct POPUPDATA2
{
// general
int cbSize;
@@ -80,18 +81,9 @@ typedef struct
COLORREF colorText;
HICON lchIcon;
HBITMAP hbmAvatar;
- union
- {
- char *lpzTitle;
- wchar_t *lpwzTitle;
- wchar_t *lptzTitle;
- };
- union
- {
- char *lpzText;
- wchar_t *lpwzText;
- wchar_t *lptzText;
- };
+ MAllStrings szTitle;
+ MAllStrings szText;
+
char *lpzSkin;
// time and timeout
@@ -107,42 +99,20 @@ typedef struct
POPUPACTION *lpActions;
HANDLE lchNotification;
-} POPUPDATA2, *LPPOPUPDATA2;
-
-// Creates new popup
-// wParam = (WPARAM)(LPPOPUPDATA2)&ppd2
-// lParam = (LPARAM)(combination of APF_* flags)
-// returns: window handle (if requested) of NULL on success, -1 on failure.
-#define MS_POPUP_ADDPOPUP2 "Popup/AddPopup2"
-
-// Update an popup
-// wParam = (WPARAM)(HWND)hwndPopup
-// lParam = (LPARAM)(LPPOPUPDATA2)&ppd2
-// returns: zero on success, -1 on failure.
-#define MS_POPUP_CHANGEPOPUP2 "Popup/ChangePopup2"
-
-// deprecatet !!! (only for compatibility) use new POPUPDATA2 struct for extended popup
-// Unicode version of POPUPDATAEX_V2
-struct POPUPDATAW_V2
-{
- MCONTACT lchContact;
- HICON lchIcon;
- wchar_t lpwzContactName[MAX_CONTACTNAME];
- wchar_t lpwzText[MAX_SECONDLINE];
- COLORREF colorBack;
- COLORREF colorText;
- WNDPROC PluginWindowProc;
- void * PluginData;
- int iSeconds;
- // +2.1.0.3
- // you *MUST* pass APF_NEWDATA flag for services to take care of this data
- HANDLE hNotification;
- int actionCount;
- LPPOPUPACTION lpActions;
- int cbSize;
};
-// Extended popup data
+#define APF_RETURN_HWND 0x1
+#define APF_CUSTOM_POPUP 0x2
+#define APF_NO_HISTORY 0x04 // do not log this popup in popup history (useful for previews)
+#define APF_NO_POPUP 0x08 // do not show popup. this is useful if you want popup yo be stored in history only
+
+EXTERN_C MIR_APP_DLL(HWND) Popup_Add(const POPUPDATA2 *pData, int flags = 0 /* combination of APF_* */);
+EXTERN_C MIR_APP_DLL(void) Popup_Change(HWND hwndPopup, const POPUPDATA2 *pData);
+
+// Creates, adds and shows a popup, given a (valid) POPUPDATA structure pointer.
+// Returns: > 0 on success, 0 if creation went bad, INVALID_HANDLE if the PopupData contained unacceptable values.
+// NOTE: it returns -1 if the PopupData was not valid, if there were already too many popups, if the module was disabled.
+
struct POPUPDATA
{
MCONTACT lchContact;
@@ -153,11 +123,9 @@ struct POPUPDATA
COLORREF colorText;
WNDPROC PluginWindowProc;
void *PluginData;
- int iSeconds; // Custom delay time in seconds. -1 means "forever", 0 means "default time".
- char cZero[16]; // Some unused bytes which may come useful in the future.
+ int iSeconds; // Custom delay time in seconds. -1 means "forever", 0 means "default time".
};
-// Unicode version of POPUPDATA
struct POPUPDATAW
{
MCONTACT lchContact;
@@ -168,172 +136,55 @@ struct POPUPDATAW
COLORREF colorText;
WNDPROC PluginWindowProc;
void *PluginData;
- int iSeconds;
- char cZero[16];
+ int iSeconds; // Custom delay time in seconds. -1 means "forever", 0 means "default time".
+ HANDLE hNotification;
+ int actionCount;
+ POPUPACTION *lpActions;
};
-/* Popup/AddPopup
-Creates, adds and shows a popup, given a (valid) POPUPDATA structure pointer.
-
-wParam = (WPARAM)(*POPUPDATA)PopupDataAddress
-lParam = 0
-
-Returns: > 0 on success, 0 if creation went bad, -1 if the PopupData contained unacceptable values.
-NOTE: it returns -1 if the PopupData was not valid, if there were already too many popups, if the module was disabled.
-Otherwise, it can return anything else...
-
-Popup Plus 2.0.4.0+
-You may pass additional creation flags via lParam:
- APF_RETURN_HWND ....... function returns handle to newly created popup window (however this calls are a bit slower)
- APF_CUSTOM_POPUP ...... new popup is created in hidden state and doesn't obey to popup queue rules.
- you may control it via UM_* messages and custom window procedure
-*/
-#define APF_RETURN_HWND 0x1
-#define APF_CUSTOM_POPUP 0x2
-#define APF_NO_HISTORY 0x04 //do not log this popup in popup history (useful for previews)
-#define APF_NO_POPUP 0x08 //do not show popup. this is useful if you want popup yo be stored in history only
-#define APF_NEWDATA 0x10 //deprecatet!! only for use with old POPUPDATAEX_V2/POPUPDATAW_V2 structs
-
-#define MS_POPUP_ADDPOPUP "Popup/AddPopupEx"
-__forceinline INT_PTR PUAddPopup(POPUPDATA *ppdp, int flags = 0)
-{
- return CallService(MS_POPUP_ADDPOPUP, (WPARAM)ppdp, flags);
-}
-
-#define MS_POPUP_ADDPOPUPW "Popup/AddPopupW"
-__forceinline INT_PTR PUAddPopupW(POPUPDATAW *ppdp, int flags = 0)
-{
- return CallService(MS_POPUP_ADDPOPUPW, (WPARAM)ppdp, flags);
-}
-
-__forceinline INT_PTR PUAddPopupW(POPUPDATAW_V2 *ppdp, int flags = 0)
-{
- return CallService(MS_POPUP_ADDPOPUPW, (WPARAM)ppdp, flags);
-}
-
-/* Popup/GetContact
-Returns the handle to the contact associated to the specified PopupWindow.
-
-wParam = (WPARAM)(HWND)hPopupWindow
-lParam = 0;
-
-Returns: the HANDLE of the contact. Can return NULL, meaning it's the main contact. -1 means failure.
-*/
-#define MS_POPUP_GETCONTACT "Popup/GetContact"
-__forceinline MCONTACT PUGetContact(HWND hPopupWindow)
-{
- return (MCONTACT)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopupWindow, 0);
-}
-
-/* Popup/GetPluginData
-Returns custom plugin date associated with popup
-
-wParam = (WPARAM)(HWND)hPopupWindow
-lParam = (LPARAM)(PLUGINDATA*)PluginDataAddress;
-
-Returns: the address of the PLUGINDATA structure. Can return NULL, meaning nothing was given. -1 means failure.
-
-IMPORTANT NOTE: it doesn't seem to work if you do:
-CallService(..., (LPARAM)aPointerToAStruct);
-and then use that struct.
-Do this, instead:
-aPointerToStruct = CallService(..., (LPARAM)aPointerToAStruct);
-and it will work. Just look at the example I've written above (PopupDlgProc).
-
-*/
-#define MS_POPUP_GETPLUGINDATA "Popup/GetPluginData"
-__forceinline void* PUGetPluginData(HWND hPopupWindow)
-{
- return (void*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hPopupWindow, 0);
-}
-
-/* Popup/Query
+EXTERN_C MIR_APP_DLL(HWND) PUAddPopup(POPUPDATA *ppdp, int flags = 0 /* combination of APF_* */);
+EXTERN_C MIR_APP_DLL(HWND) PUAddPopupW(POPUPDATAW *ppdp, int flags = 0 /* combination of APF_* */);
-Requests an action or an answer from Popup module.
+// Deletes a popup window
+EXTERN_C MIR_APP_DLL(int) PUDeletePopup(HWND hWndPopup);
-wParam = (WPARAM)wpQuery
+// Returns the handle to the contact associated to the specified PopupWindow or -1 on failure
+EXTERN_C MIR_APP_DLL(MCONTACT) PUGetContact(HWND hPopupWindow);
-returns 0 on success, -1 on error, 1 on stupid calls ;-)
-*/
+// Returns custom plugin date associated with popup
+EXTERN_C MIR_APP_DLL(void*) PUGetPluginData(HWND hPopupWindow);
-#define PUQS_ENABLEPOPUPS 1 // returns 0 if state was changed, 1 if state wasn't changed
-#define PUQS_DISABLEPOPUPS 2 // " "
-#define PUQS_GETSTATUS 3 //Returns 1 (TRUE) if popups are enabled, 0 (FALSE) if popups are disabled.
+// Changes the entire popup
+EXTERN_C MIR_APP_DLL(int) PUChangeW(HWND hWndPopup, POPUPDATAW *newData);
-#define MS_POPUP_QUERY "Popup/Query"
+// Changes the text displayed in the second line of the popup.
+EXTERN_C MIR_APP_DLL(int) PUChangeTextW(HWND hWndPopup, const wchar_t *lpwzNewText);
-/* UM_FREEPLUGINDATA
-Process this message if you have allocated your own memory. (i.e.: POPUPDATA.PluginData != NULL)
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup messages
-wParam = 0
-lParam = 0
-*/
+// UM_FREEPLUGINDATA
+// Process this message if you have allocated your own memory. (i.e.: POPUPDATA.PluginData != NULL)
#define UM_FREEPLUGINDATA (WM_USER + 0x0200)
-/* UM_DESTROYPOPUP
-Send this message when you want to destroy the popup, or use the function below.
-
-wParam = 0
-lParam = 0
-*/
-#define MS_POPUP_DESTROYPOPUP "Popup/Delete"
+// UM_DESTROYPOPUP
+// Send this message when you want to destroy the popup, or use the function below.
+// wParam = 0
+// lParam = HWND
#define UM_DESTROYPOPUP (WM_USER + 0x0201)
-__forceinline int PUDeletePopup(HWND hWndPopup)
-{
- return (int)CallService(MS_POPUP_DESTROYPOPUP, 0, (LPARAM)hWndPopup);
-}
-
-/* UM_INITPOPUP
-This message is sent to the Popup when its creation has been finished, so POPUPDATA (and thus your PluginData) is reachable.
-Catch it if you needed to catch WM_CREATE or WM_INITDIALOG, which you'll never ever get in your entire popup-life.
-Return value: if you process this message, return 0. If you don't process it, return 0. Do whatever you like ;-)
-wParam = (WPARAM)(HWND)hPopupWindow (this is useless, you get message inside your popup window)
-lParam = 0
-*/
+// UM_INITPOPUP
+// This message is sent to the Popup when its creation has been finished, so POPUPDATA (and thus your PluginData) is reachable.
+// Catch it if you needed to catch WM_CREATE or WM_INITDIALOG, which you'll never ever get in your entire popup-life.
+// Return value: if you process this message, return 0. If you don't process it, return 0. Do whatever you like ;-)
+// wParam = (WPARAM)(HWND)hPopupWindow (this is useless, you get message inside your popup window)
+// lParam = 0
#define UM_INITPOPUP (WM_USER + 0x0202)
-/* Popup/Changetext
-Changes the text displayed in the second line of the popup.
-
-wParam = (WPARAM)(HWND)hPopupWindow
-lParam = (LPARAM)(char*)lpzNewText
-
-returns: > 0 for success, -1 for failure, 0 if the failure is due to second line not being shown. (but you could call
-PUIsSecondLineShown() before changing the text...)
-*/
-
-#define MS_POPUP_CHANGETEXTW "Popup/ChangetextW"
-
-__forceinline int PUChangeTextW(HWND hWndPopup, LPCWSTR lpwzNewText)
-{
- return (int)CallService(MS_POPUP_CHANGETEXTW, (WPARAM)hWndPopup, (LPARAM)lpwzNewText);
-}
-
-/* Popup/Change
-Changes the entire popup
-
-wParam = (WPARAM)(HWND)hPopupWindow
-lParam = (LPARAM)(POPUPDATA*)newData
-*/
-
-#define MS_POPUP_CHANGEW "Popup/ChangeW"
-__forceinline int PUChangeW(HWND hWndPopup, POPUPDATAW *newData)
-{
- return (int)CallService(MS_POPUP_CHANGEW, (WPARAM)hWndPopup, (LPARAM)newData);
-}
-
-__forceinline int PUChangeW(HWND hWndPopup, POPUPDATAW_V2 *newData)
-{
- return (int)CallService(MS_POPUP_CHANGEW, (WPARAM)hWndPopup, (LPARAM)newData);
-}
-
-/* UM_CHANGEPOPUP
-This message is triggered by Change/ChangeText services. You also may post it directly :)
-
-wParam = Modification type
-lParam = value of type defined by wParam
-*/
+// UM_CHANGEPOPUP
+// This message is triggered by Change/ChangeText services. You also may post it directly :)
+// wParam = Modification type
+// lParam = value of type defined by wParam
#define CPT_TEXTW 2 // lParam = (wchar_t *)text
#define CPT_TITLEW 4 // lParam = (wchar_t *)title
@@ -342,21 +193,16 @@ lParam = value of type defined by wParam
#define UM_CHANGEPOPUP (WM_USER + 0x0203)
-/* UM_POPUPACTION
-Popup Action notification
-
-wParam and lParam are specified bu plugin.
-wParam = 0 is used buy popup plus internally!
-*/
-
+// UM_POPUPACTION
+// Popup Action notification
+// wParam and lParam are specified bu plugin.
+// wParam = 0 is used buy popup plus internally!
#define UM_POPUPACTION (WM_USER + 0x0204)
-/* UM_POPUPMODIFYACTIONICON
-Modify Popup Action Icon
-
-wParam = (WPARAM)(LPPOPUPACTIONID)&actionId
-lParam = (LPARAM)(HICON)hIcon
-*/
+// UM_POPUPMODIFYACTIONICON
+// Modify Popup Action Icon
+// wParam = (WPARAM)(LPPOPUPACTIONID)&actionId
+// lParam = (LPARAM)(HICON)hIcon
struct POPUPACTIONID
{
@@ -371,38 +217,21 @@ __forceinline int PUModifyActionIcon(HWND hWndPopup, WPARAM wParam, LPARAM lPara
return (int)SendMessage(hWndPopup, UM_POPUPMODIFYACTIONICON, (WPARAM)&actionId, (LPARAM)hIcon);
}
-/* UM_POPUPSHOW
-Show popup at position
-
-wParam = x
-lParam = y
-*/
+// UM_POPUPSHOW
+// Show popup at position
+// wParam = x
+// lParam = y
#define UM_POPUPSHOW (WM_USER + 0x0206)
-/* Popup/RegisterActions
-Registers your action in popup action list
+// Registers your action in popup action list
-wParam = (WPARAM)(LPPOPUPACTION)actions
-lParam = (LPARAM)actionCount
+EXTERN_C MIR_APP_DLL(int) PURegisterActions(POPUPACTION *actions, int count);
-Returns: 0 if the popup was shown, -1 in case of failure.
-*/
-#define MS_POPUP_REGISTERACTIONS "Popup/RegisterActions"
-
-__forceinline int PURegisterActions(LPPOPUPACTION actions, int count)
-{
- return (int)CallService(MS_POPUP_REGISTERACTIONS, (WPARAM)actions, (LPARAM)count);
-}
-
-/* Popup/RegisterNotification
-Registers your action in popup action list
-
-wParam = (WPARAM)(LPPOPUPNOTIFICATION)info
-lParam = 0
-
-Returns: handle of registered notification or sero on failure
-*/
-#define MS_POPUP_REGISTERNOTIFICATION "Popup/RegisterNotification"
+// Popup/RegisterNotification
+// Registers your action in popup action list
+// wParam = (WPARAM)(LPPOPUPNOTIFICATION)info
+// lParam = 0
+// Returns: handle of registered notification or sero on failure
#define PNAF_CALLBACK 0x01
@@ -452,10 +281,7 @@ typedef struct
DLGPROC pfnReserved2; // reserved for future use
} POPUPNOTIFICATION, *LPPOPUPNOTIFICATION;
-__forceinline HANDLE PURegisterNotification(LPPOPUPNOTIFICATION notification)
-{
- return (HANDLE)CallService(MS_POPUP_REGISTERNOTIFICATION, (WPARAM)notification, 0);
-}
+EXTERN_C MIR_APP_DLL(HANDLE) PURegisterNotification(LPPOPUPNOTIFICATION notification);
/* Popup/UnhookEventAsync
Using of "UnhookEvent" inside PluginWindowProc in conjunction with HookEventMessage
@@ -499,13 +325,6 @@ __forceinline int PUUnhookEventAsync(HWND hwndPopup, HANDLE hEvent)
return 0;
}
-/* Popup/GetStatus
-Returns 1 when popups are showen and 0 when not
-wParam = 0
-lParam = 0
-*/
-#define MS_POPUP_GETSTATUS "Popup/GetStatus"
-
#ifdef __cplusplus
/* Popup/RegisterVfx
Register new animation (fade in/out) effect
@@ -550,31 +369,21 @@ Returns: 0 if the popup was shown, -1 in case of failure.
#define SM_WARNING 0x01 //Triangle icon.
#define SM_NOTIFY 0x02 //Exclamation mark icon.
#define SM_ERROR 0x03 //Cross icon.
-#define MS_POPUP_SHOWMESSAGE "Popup/ShowMessage"
-#define MS_POPUP_SHOWMESSAGEW "Popup/ShowMessageW"
-
-__forceinline int PUShowMessage(const char *lpzText, DWORD kind)
-{
- return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText, (LPARAM)kind);
-}
-
-__forceinline int PUShowMessageW(const wchar_t *lpwzText, DWORD kind)
-{
- return (int)CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)lpwzText, (LPARAM)kind);
-}
-/* Popup/Filter
-Filters popups out
+EXTERN_C MIR_APP_DLL(int) PUShowMessage(const char *lpzText, DWORD kind);
+EXTERN_C MIR_APP_DLL(int) PUShowMessageW(const wchar_t *lpwzText, DWORD kind);
-wParam = (HANDLE)hContact
-lParam = (void*)pWindowProc;
-
-returns: 0 = popup allowed, 1 = popup filtered out
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup/Filter
+// Filters popups out
+// wParam = (MCONTACT)hContact
+// lParam = (void*)pWindowProc;
+// returns: 0 = popup allowed, 1 = popup filtered out
#define ME_POPUP_FILTER "Popup/Filter"
-//------------- Class API ----------------//
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup classes API
#define PCF_UNICODE 0x0001
@@ -596,58 +405,25 @@ struct POPUPCLASS
LPARAM lParam; //APF_RETURN_HWND, APF_CUSTOM_POPUP ... as above
};
-// wParam = 0
-// lParam = (POPUPCLASS *)&pc
-#define MS_POPUP_REGISTERCLASS "Popup/RegisterClass"
+EXTERN_C MIR_APP_DLL(HANDLE) Popup_RegisterClass(POPUPCLASS *pc);
+EXTERN_C MIR_APP_DLL(void) Popup_UnregisterClass(HANDLE ppc);
-__forceinline HANDLE Popup_RegisterClass(POPUPCLASS *pc)
-{
- if (!ServiceExists(MS_POPUP_REGISTERCLASS))
- return nullptr;
- return (HANDLE)CallService(MS_POPUP_REGISTERCLASS, 0, LPARAM(pc));
-}
+/////////////////////////////////////////////////////////////////////////////////////////
+// structure to add a popup using given class
-#define MS_POPUP_UNREGISTERCLASS "Popup/UnregisterClass"
-
-__forceinline void Popup_UnregisterClass(HANDLE ppc)
+struct POPUPDATACLASS
{
- if (ppc)
- CallService(MS_POPUP_UNREGISTERCLASS, 0, LPARAM(ppc));
-}
-
-typedef struct {
int cbSize;
const char *pszClassName;
- union {
- const char *pszTitle;
- const wchar_t *pwszTitle;
- };
- union {
- const char *pszText;
- const wchar_t *pwszText;
- };
+ MAllCStrings szTitle;
+ MAllCStrings szText;
void *PluginData;
MCONTACT hContact;
-} POPUPDATACLASS;
-
-// wParam = 0
-// lParam = (POPUPDATACLASS *)&pdc
-#define MS_POPUP_ADDPOPUPCLASS "Popup/AddPopupClass"
+};
-__forceinline INT_PTR ShowClassPopup(const char *name, const char *title, const char *text)
-{
- POPUPDATACLASS d = {sizeof(d), name};
- d.pszTitle = title;
- d.pszText = text;
- return CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
-}
+EXTERN_C MIR_APP_DLL(HWND) Popup_AddClass(POPUPDATACLASS*);
-__forceinline INT_PTR ShowClassPopupW(const char *name, const wchar_t *title, const wchar_t *text)
-{
- POPUPDATACLASS d = {sizeof(d), name};
- d.pwszTitle = title;
- d.pwszText = text;
- return CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
-}
+EXTERN_C MIR_APP_DLL(HWND) ShowClassPopup(const char *name, const char *title, const char *text);
+EXTERN_C MIR_APP_DLL(HWND) ShowClassPopupW(const char *name, const wchar_t *title, const wchar_t *text);
#endif // __m_popup_h__
diff --git a/include/m_popup_int.h b/include/m_popup_int.h
new file mode 100644
index 0000000000..b241f7bebe
--- /dev/null
+++ b/include/m_popup_int.h
@@ -0,0 +1,43 @@
+#ifndef M_POPUP_INT_H
+#define M_POPUP_INT_H
+
+#include <m_popup.h>
+
+// Creates new popup
+// wParam = (WPARAM)(POPUPDATA2*)&ppd2
+// lParam = (LPARAM)(combination of APF_* flags)
+// returns: window handle (if requested) of NULL on success, -1 on failure.
+#define MS_POPUP_ADDPOPUP2 "Popup/AddPopup2"
+
+// Update an popup
+// wParam = (WPARAM)(HWND)hwndPopup
+// lParam = (LPARAM)(POPUPDATA2*)&ppd2
+// returns: zero on success, -1 on failure.
+#define MS_POPUP_CHANGEPOPUP2 "Popup/ChangePopup2"
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Compatibility services
+
+#define MS_POPUP_ADDPOPUP "Popup/AddPopup"
+#define MS_POPUP_ADDPOPUPW "Popup/AddPopupW"
+
+#define MS_POPUP_CHANGEW "Popup/ChangeW"
+#define MS_POPUP_CHANGETEXTW "Popup/ChangetextW"
+
+#define MS_POPUP_DESTROYPOPUP "Popup/Delete"
+
+#define MS_POPUP_GETPLUGINDATA "Popup/GetPluginData"
+
+#define MS_POPUP_GETCONTACT "Popup/GetContact"
+
+#define MS_POPUP_REGISTERACTIONS "Popup/RegisterActions"
+#define MS_POPUP_REGISTERNOTIFICATION "Popup/RegisterNotification"
+
+#define MS_POPUP_SHOWMESSAGE "Popup/ShowMessage"
+#define MS_POPUP_SHOWMESSAGEW "Popup/ShowMessageW"
+
+#define MS_POPUP_REGISTERCLASS "Popup/RegisterClass"
+#define MS_POPUP_UNREGISTERCLASS "Popup/UnregisterClass"
+#define MS_POPUP_ADDPOPUPCLASS "Popup/AddPopupClass"
+
+#endif // M_POPUP_INT_H
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index 957fa57793..8a35106058 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 40aaf1b95d..ff1011c12c 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp
index 14063d7a5a..1492a0f36b 100755
--- a/plugins/Alarms/src/alarmlist.cpp
+++ b/plugins/Alarms/src/alarmlist.cpp
@@ -562,7 +562,7 @@ static LRESULT CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam
switch (message) {
case WM_COMMAND: // snooze
if (HIWORD(wParam) == STN_CLICKED) { //It was a click on the Popup.
- ALARM *mpd = (ALARM *)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
+ ALARM *mpd = (ALARM *)PUGetPluginData(hWnd);
if (mpd->flags & ALF_NOSNOOZE || !options.snooze_minutes)
return TRUE;
@@ -599,7 +599,7 @@ static LRESULT CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam
return TRUE;
case UM_FREEPLUGINDATA:
- ALARM *mpd = (ALARM *)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
+ ALARM *mpd = (ALARM *)PUGetPluginData(hWnd);
if (mpd > 0) {
free_alarm_data(mpd);
delete mpd;
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp
index f2212539c2..b247bb4ef6 100644
--- a/plugins/BossKeyPlus/src/BossKey.cpp
+++ b/plugins/BossKeyPlus/src/BossKey.cpp
@@ -262,7 +262,7 @@ static void CreateTrayIcon(bool create)
static void RestoreOldSettings(void)
{
if (g_bOldSetting & OLD_POPUP)
- CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0);
+ Popup_Enable(true);
if (g_bOldSetting & OLD_SOUND)
db_set_b(0, "Skin", "UseSound", 1);
@@ -331,10 +331,10 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
CreateTrayIcon(true);
// disable popups
- if (CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == 1) {
+ if (Popup_Enabled()) {
// save current
g_bOldSetting |= OLD_POPUP;
- CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
+ Popup_Enable(false);
}
// disable sounds
@@ -667,13 +667,13 @@ int CMPlugin::Load()
if ((g_bOldSetting & OLD_POPUP) && !(g_wMaskAdv & OPT_RESTORE)) // Restore popup settings if Miranda was crushed or killed in hidden mode and "Restore hiding on startup after failure" option is disabled
{
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 0)
- db_set_b(0, "Popup", "ModuleIsEnabled", 1);
+ if (Popup_Enabled() == 0)
+ Popup_Enable(true);
}
- if (g_wMaskAdv & OPT_HIDEONSTART && db_get_b(0, "Popup", "ModuleIsEnabled", 0)) // hack for disabling popup on startup if "Hide Miranda on startup" is enabled
+ if (g_wMaskAdv & OPT_HIDEONSTART && Popup_Enabled()) // hack for disabling popup on startup if "Hide Miranda on startup" is enabled
{
g_bOldSetting |= OLD_POPUP;
- db_set_b(0, "Popup", "ModuleIsEnabled", 0);
+ Popup_Enable(false);
}
g_plugin.registerIcon("BossKey", iconList);
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
index 57b73cecbc..46acde4e81 100644
--- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp
+++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
@@ -224,8 +224,7 @@ bool isContactGoneFor(MCONTACT hContact, int days)
if (options.hideInactive)
if (daysSinceMessage >= options.iSilencePeriod)
if (!db_get_b(hContact, "CList", "Hidden", 0) && !g_plugin.getByte(hContact, "NeverHide", 0)) {
- POPUPDATAW_V2 ppd = { 0 };
- ppd.cbSize = sizeof(ppd);
+ POPUPDATAW ppd = { 0 };
ppd.lchContact = hContact;
ppd.lchIcon = IcoLib_GetIcon("enabled_icon");
@@ -243,7 +242,7 @@ bool isContactGoneFor(MCONTACT hContact, int days)
ppd.lpActions = hideactions;
ppd.actionCount = 2;
- PUAddPopupW(&ppd, APF_NEWDATA);
+ PUAddPopupW(&ppd);
Skin_PlaySound("buddyExpectatorHide");
}
@@ -478,9 +477,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam)
if (prevStatus == ID_STATUS_OFFLINE) {
if (g_plugin.getByte(hContact, "MissYou", 0)) {
// Display Popup
- POPUPDATAW_V2 ppd = { 0 };
- ppd.cbSize = sizeof(ppd);
-
+ POPUPDATAW ppd = { 0 };
ppd.lchContact = hContact;
ppd.lchIcon = IcoLib_GetIcon("enabled_icon");
wcsncpy(ppd.lpwzContactName, Clist_GetContactDisplayName(hContact), MAX_CONTACTNAME);
@@ -496,8 +493,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam)
missyouactions[0].flags = PAF_ENABLED;
ppd.lpActions = missyouactions;
ppd.actionCount = 1;
-
- PUAddPopupW(&ppd, APF_NEWDATA);
+ PUAddPopupW(&ppd);
Skin_PlaySound("buddyExpectatorMissYou");
}
diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp
index 9cdf91d010..884182159e 100644
--- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp
+++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp
@@ -80,7 +80,7 @@ void RegPopupActions()
poOptions.paActions[0].flags = PAF_ENABLED;
poOptions.paActions[0].wParam = poOptions.paActions[0].lParam = 0;
poOptions.paActions[0].lchIcon = hCopyIcon;
- CallService(MS_POPUP_REGISTERACTIONS, (WPARAM)&poOptions.paActions, 1);
+ PURegisterActions(poOptions.paActions, 1);
}
int OnIconsChanged(WPARAM, LPARAM)
@@ -187,7 +187,7 @@ LRESULT CALLBACK Keyboard_Hook(int code, WPARAM wParam, LPARAM lParam)
int CALLBACK CKLPopupDlgProc(HWND hWnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)
{
- LPTSTR ptszPopupText = (LPTSTR)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)&ptszPopupText);
+ LPTSTR ptszPopupText = (LPTSTR)PUGetPluginData(hWnd);
switch (uiMessage) {
case WM_COMMAND:
diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp
index a8a4e11be5..257acb225f 100644
--- a/plugins/ChangeKeyboardLayout/src/options.cpp
+++ b/plugins/ChangeKeyboardLayout/src/options.cpp
@@ -352,8 +352,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam,
if ((HIWORD(wParam) == BN_CLICKED )) {
ptszPopupPreviewText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
- POPUPDATAW_V2 pdtData = { 0 };
- pdtData.cbSize = sizeof(pdtData);
+ POPUPDATAW pdtData = { 0 };
wcsncpy(pdtData.lpwzContactName, TranslateT(MODULENAME), MAX_CONTACTNAME);
wcsncpy(pdtData.lpwzText, L"Ghbdtn? rfr ltkf&", MAX_SECONDLINE);
@@ -389,8 +388,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam,
pdtData.lpActions = poOptions.paActions;
pdtData.actionCount = 1;
pdtData.PluginWindowProc = (WNDPROC)CKLPopupDlgProc;
-
- if (PUAddPopupW( &pdtData, APF_NEWDATA) < 0)
+ if (PUAddPopupW(&pdtData) < 0)
mir_free(ptszPopupPreviewText);
}
break;
diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp
index d1d2d05a65..094edd431f 100644
--- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp
+++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp
@@ -448,8 +448,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
LPTSTR ptszPopupText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(wchar_t));
mir_wstrcpy(ptszPopupText, ptszMBox);
- POPUPDATAW_V2 pdtData = { 0 };
- pdtData.cbSize = sizeof(pdtData);
+ POPUPDATAW pdtData = { 0 };
wcsncpy(pdtData.lpwzContactName, TranslateT(MODULENAME), MAX_CONTACTNAME);
wcsncpy(pdtData.lpwzText, ptszPopupText, MAX_SECONDLINE);
@@ -486,7 +485,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord)
pdtData.lpActions = poOptions.paActions;
pdtData.actionCount = 1;
- if (PUAddPopupW(&pdtData, APF_NEWDATA) < 0) {
+ if (PUAddPopupW(&pdtData) < 0) {
mir_free(ptszPopupText);
MessageBox(nullptr, ptszMBox, TranslateT(MODULENAME), MB_ICONINFORMATION);
}
diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
index e209a877ca..78186287cb 100644
--- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
+++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp
@@ -77,7 +77,7 @@ static VOID CALLBACK ShowContactMenu(void *param)
void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA*)
{
- MCONTACT hContact = (MCONTACT)CallService(MS_POPUP_GETCONTACT, (WPARAM)hWnd, 0);
+ MCONTACT hContact = PUGetContact(hWnd);
switch (Action) {
case PCA_OPENMESSAGEWND: // open message window
if (hContact && hContact != INVALID_CONTACT_ID)
@@ -110,7 +110,7 @@ void Popup_DoAction(HWND hWnd, BYTE Action, PLUGIN_DATA*)
static LRESULT CALLBACK PopupWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- PLUGIN_DATA *pdata = (PLUGIN_DATA*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
+ PLUGIN_DATA *pdata = (PLUGIN_DATA*)PUGetPluginData(hWnd);
if (pdata) {
switch (message) {
case WM_COMMAND:
diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp
index eafd2961f3..3ac2a26b0a 100644
--- a/plugins/CmdLine/src/mimcmd_handlers.cpp
+++ b/plugins/CmdLine/src/mimcmd_handlers.cpp
@@ -386,29 +386,29 @@ void Set2StateReply(PReply reply, int state, int failure, wchar_t *successTrue,
void HandlePopupsCommand(PCommand command, TArgument *argv, int argc, PReply reply)
{
- int state, failure;
+ int state, failure = 0;
switch (argc) {
case 2:
- state = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0);
+ state = Popup_Enabled();
Set2StateReply(reply, state, 0, LPGENW("Popups are currently enabled."), L"", LPGENW("Popups are currently disabled."), L"");
break;
case 3:
switch (Get2StateValue(argv[2])) {
case STATE_ON:
- failure = CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0);
+ Popup_Enable(true);
state = TRUE;
break;
case STATE_OFF:
- failure = CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
+ Popup_Enable(false);
state = FALSE;
break;
case STATE_TOGGLE:
- state = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0);
- failure = CallService(MS_POPUP_QUERY, (state) ? PUQS_DISABLEPOPUPS : PUQS_ENABLEPOPUPS, 0);
+ state = Popup_Enabled();
+ Popup_Enable(!state);
state = !state;
break;
diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp
index 993e1ccc88..93e5f1d19a 100644
--- a/plugins/Exchange/src/emails.cpp
+++ b/plugins/Exchange/src/emails.cpp
@@ -312,7 +312,7 @@ int ShowPopupMessage(wchar_t *title, wchar_t *message, int cUnreadEmails)
wcsncpy_s(popup.lpwzText, MAX_SECONDLINE, message, _TRUNCATE);
popup.PluginWindowProc = DlgProcPopup;
popup.PluginData = (int *) cUnreadEmails;
- return PUAddPopupW(&popup);
+ return (int)PUAddPopupW(&popup);
}
int ShowMessageBoxMessage(wchar_t *title, wchar_t *message, int cUnreadEmails)
diff --git a/plugins/MirLua/Modules/m_popup/src/main.cpp b/plugins/MirLua/Modules/m_popup/src/main.cpp
index 0699967031..6980e38587 100644
--- a/plugins/MirLua/Modules/m_popup/src/main.cpp
+++ b/plugins/MirLua/Modules/m_popup/src/main.cpp
@@ -41,7 +41,7 @@ static int lua_AddPopup(lua_State *L)
mir_ptr<POPUPDATAW> ppd(MakePopupData(L));
- INT_PTR res = ::PUAddPopupW(ppd);
+ INT_PTR res = (INT_PTR)::PUAddPopupW(ppd);
lua_pushinteger(L, res);
return 1;
@@ -60,11 +60,11 @@ static POPUPDATA2* MakePopupData2(lua_State *L)
ppd->flags |= PU2_UNICODE;
lua_getfield(L, -1, "Title");
- ppd->lptzTitle = mir_utf8decodeW(lua_tostring(L, -1));
+ ppd->szTitle.w = mir_utf8decodeW(lua_tostring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "Text");
- ppd->lpwzText = mir_utf8decodeW(luaL_checkstring(L, -1));
+ ppd->szText.w = mir_utf8decodeW(luaL_checkstring(L, -1));
lua_pop(L, 1);
lua_getfield(L, -1, "hContact");
@@ -104,11 +104,11 @@ static int lua_AddPopup2(lua_State *L)
mir_ptr<POPUPDATA2> ppd(MakePopupData2(L));
- INT_PTR res = ::CallService(MS_POPUP_ADDPOPUP2, (WPARAM)ppd, 0);
+ INT_PTR res = (INT_PTR)Popup_Add(ppd.get());
lua_pushinteger(L, res);
- mir_free(ppd->lptzTitle);
- mir_free(ppd->lpwzText);
+ mir_free(ppd->szTitle.w);
+ mir_free(ppd->szText.w);
return 1;
}
diff --git a/plugins/MirLua/Modules/m_popup/src/stdafx.h b/plugins/MirLua/Modules/m_popup/src/stdafx.h
index e6f48ac834..88ef46230a 100644
--- a/plugins/MirLua/Modules/m_popup/src/stdafx.h
+++ b/plugins/MirLua/Modules/m_popup/src/stdafx.h
@@ -7,6 +7,7 @@
#include <m_core.h>
#include <m_utils.h>
+#include <m_database.h>
#include <m_popup.h>
#endif //_COMMON_H_ \ No newline at end of file
diff --git a/plugins/MirLua/src/utils.cpp b/plugins/MirLua/src/utils.cpp
index d17301214e..d5d7658f3c 100644
--- a/plugins/MirLua/src/utils.cpp
+++ b/plugins/MirLua/src/utils.cpp
@@ -21,7 +21,7 @@ void ShowNotification(const char *caption, const char *message, int flags, MCONT
if (Miranda_IsTerminated())
return;
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (Popup_Enabled()) {
POPUPDATA ppd = { 0 };
ppd.lchContact = hContact;
mir_strncpy(ppd.lpzContactName, caption, MAX_CONTACTNAME);
diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp
index bc02f0a47a..c51aa1bb8a 100644
--- a/plugins/MsgPopup/src/main.cpp
+++ b/plugins/MsgPopup/src/main.cpp
@@ -101,11 +101,8 @@ void popupMessage(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
MessageBeep(uType);
}
-int WINAPI newMessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
+int WINAPI newMessageBox(HWND, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType)
{
- if (CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) == CALLSERVICE_NOTFOUND || (uType & 0x0F))
- return prevMessageBox(hWnd, lpText, lpCaption, uType);
-
popupMessage(lpText, lpCaption, uType);
return IDOK;
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index cd52dde535..c2bfa62a6e 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -816,21 +816,15 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam)
BYTE hlpDisablePopup = g_plugin.getByte(szSetting, 0);
if (hlpDisablePopup != opt.PopupAutoDisabled) {
- BYTE hlpPopupStatus = (BYTE)CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0);
+ bool hlpPopupStatus = Popup_Enabled();
opt.PopupAutoDisabled = hlpDisablePopup;
if (hlpDisablePopup) {
g_plugin.setByte("OldPopupStatus", hlpPopupStatus);
- CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
- }
- else {
- if (hlpPopupStatus == FALSE) {
- if (g_plugin.getByte("OldPopupStatus", TRUE) == TRUE)
- CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS, 0);
- else
- CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS, 0);
- }
+ Popup_Enable(false);
}
+ else if (!hlpPopupStatus)
+ Popup_Enable(g_plugin.getByte("OldPopupStatus", true));
}
}
diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp
index 1d1eb93a93..f6bc0cbd79 100644
--- a/plugins/NotifyAnything/src/main.cpp
+++ b/plugins/NotifyAnything/src/main.cpp
@@ -498,7 +498,7 @@ int showMessage(const popup_t &msg)
g_anon_popups.insert(msgp);
ppd.PluginData = msgp;
- return PUAddPopupW(&ppd);
+ return (int)PUAddPopupW(&ppd);
}
void replaceMessage(const popup_t &msg)
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp
index 0d389c99f2..ef5d07d993 100644
--- a/plugins/Nudge/src/main.cpp
+++ b/plugins/Nudge/src/main.cpp
@@ -279,10 +279,10 @@ void Nudge_ShowPopup(CNudgeElement*, MCONTACT hContact, wchar_t * Message)
POPUPDATACLASS NudgePopup = { 0 };
NudgePopup.cbSize = sizeof(NudgePopup);
NudgePopup.hContact = hContact;
- NudgePopup.pwszText = Message;
- NudgePopup.pwszTitle = lpzContactName;
+ NudgePopup.szText.w = Message;
+ NudgePopup.szTitle.w = lpzContactName;
NudgePopup.pszClassName = "nudge";
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&NudgePopup);
+ Popup_AddClass(&NudgePopup);
}
void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact)
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp
index 83ce348095..72562fef04 100644
--- a/plugins/PackUpdater/Src/Notifications.cpp
+++ b/plugins/PackUpdater/Src/Notifications.cpp
@@ -111,8 +111,7 @@ void show_popup(HWND hDlg, LPCTSTR pszTitle, LPCTSTR pszText, int iNumber, int A
if (!pmpd)
return;
- POPUPDATAW_V2 pd = { 0 };
- pd.cbSize = sizeof(pd);
+ POPUPDATAW pd = { 0 };
pd.lchContact = NULL; //(HANDLE)wParam;
pd.lchIcon = Skin_LoadIcon(PopupsList[iNumber].Icon);
mir_wstrncpy(pd.lpwzText, pszText, _countof(pd.lpwzText));
@@ -147,8 +146,7 @@ void show_popup(HWND hDlg, LPCTSTR pszTitle, LPCTSTR pszText, int iNumber, int A
MakePopupAction(pmpd->pa[pd.actionCount++], IDYES);
MakePopupAction(pmpd->pa[pd.actionCount++], IDNO);
}
-
- PUAddPopupW(&pd, APF_NEWDATA);
+ PUAddPopupW(&pd);
}
INT_PTR CALLBACK DlgDownload(HWND hDlg, UINT message, WPARAM, LPARAM)
@@ -176,7 +174,7 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM)
static void __stdcall CreateDownloadDialog(void*)
{
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups3", DEFAULT_POPUP_ENABLED))
+ if (Popup_Enabled() && g_plugin.getByte("Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgDownloadPop);
else if (g_plugin.getByte("Popups3M", DEFAULT_MESSAGE_ENABLED)) {
mir_wstrncpy(tszDialogMsg, Text, _countof(tszDialogMsg));
@@ -195,7 +193,7 @@ void DlgDownloadProc()
if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) {
Title = TranslateT("Pack Updater");
Text = TranslateT("An error occurred while downloading the update.");
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (Popup_Enabled() && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
@@ -420,7 +418,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
INT rc = -1;
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (ServiceExists(MS_POPUP_REGISTERACTIONS) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(0, "Popup", "Actions", 0) & 1))
+ if (Popup_Enabled() && g_plugin.getByte("Popups0", DEFAULT_POPUP_ENABLED) && (db_get_dw(0, "Popup", "Actions", 0) & 1))
rc = DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgMsgPop);
else
rc = MessageBox(nullptr, tszBuff, Title, MB_YESNO | MB_ICONQUESTION);
@@ -508,7 +506,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
mir_snwprintf(tszBuff, TranslateT("You have chosen not to install the pack update immediately.\nYou can install it manually from this location:\n\n%s"), arFilePath[0].c_str());
Title = TranslateT("Pack Updater");
Text = tszBuff;
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (Popup_Enabled() && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
diff --git a/plugins/PackUpdater/Src/Options.cpp b/plugins/PackUpdater/Src/Options.cpp
index 628bad6ee5..e2c86fdd6f 100644
--- a/plugins/PackUpdater/Src/Options.cpp
+++ b/plugins/PackUpdater/Src/Options.cpp
@@ -192,7 +192,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
else if (i > 0)
EnableWindow(GetDlgItem(hdlg, (i + 1024)), TRUE);
}
- if (!(db_get_dw(0, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(0, "Popup", "Actions", 0) & 1))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
@@ -200,7 +200,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam)
return TRUE;
case WM_SHOWWINDOW:
- if (!(db_get_dw(0, "Popup", "Actions", 0) & 1) || !ServiceExists(MS_POPUP_REGISTERACTIONS))
+ if (!(db_get_dw(0, "Popup", "Actions", 0) & 1))
EnableWindow(GetDlgItem(hdlg, (40071)), FALSE);
else
EnableWindow(GetDlgItem(hdlg, (40071)), TRUE);
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp
index 29e1974917..a65e5073e3 100644
--- a/plugins/PackUpdater/Src/Utils.cpp
+++ b/plugins/PackUpdater/Src/Utils.cpp
@@ -193,7 +193,7 @@ static void CheckUpdates(void *)
if (!tszDownloadURL) { // URL is not set
Title = TranslateT("Pack Updater");
Text = TranslateT("URL for checking updates not found.");
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (Popup_Enabled() && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
@@ -248,7 +248,7 @@ static void CheckUpdates(void *)
if (wcsstr(tszBuff, L"\\")) { //check update name
Title = TranslateT("Pack Updater");
Text = TranslateT("Name of Update's file is not supported.");
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
+ if (Popup_Enabled() && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) {
Number = 1;
show_popup(nullptr, Title, Text, Number, 0);
}
@@ -339,7 +339,7 @@ static void CheckUpdates(void *)
if (!UpdatesCount && !Silent) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No updates found.");
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (Popup_Enabled() && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
@@ -350,7 +350,7 @@ static void CheckUpdates(void *)
if (!FileCount) {
Title = TranslateT("Pack Updater");
Text = TranslateT("No files for update.");
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (Popup_Enabled() && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
@@ -365,7 +365,7 @@ void DoCheck(int iFlag)
if (hCheckThread != nullptr) {
Title = TranslateT("Pack Updater");
Text = TranslateT("Update checking already started!");
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
+ if (Popup_Enabled() && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) {
Number = 2;
show_popup(nullptr, Title, Text, Number, 0);
}
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 98842ed9d6..ca7a1e6095 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -469,7 +469,7 @@ static void DlgUpdateSilent(void *param)
wchar_t tszTitle[100];
mir_snwprintf(tszTitle, TranslateT("%d component(s) was updated"), count);
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1))
+ if (Popup_Enabled())
ShowPopup(tszTitle,TranslateT("You need to restart your Miranda to apply installed updates."),POPUP_TYPE_MSG);
else {
if (Clist_TrayNotifyW(MODULEA, tszTitle, TranslateT("You need to restart your Miranda to apply installed updates."), NIIF_INFO, 30000)) {
diff --git a/plugins/PluginUpdater/src/Notifications.cpp b/plugins/PluginUpdater/src/Notifications.cpp
index e2d37d95bd..d18f409196 100644
--- a/plugins/PluginUpdater/src/Notifications.cpp
+++ b/plugins/PluginUpdater/src/Notifications.cpp
@@ -95,7 +95,7 @@ static LRESULT CALLBACK PopupDlgProcRestart(HWND hPopup, UINT uMsg, WPARAM wPara
void ShowPopup(LPCTSTR ptszTitle, LPCTSTR ptszText, int Number)
{
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (Popup_Enabled()) {
char setting[100];
mir_snprintf(setting, "Popups%d", Number);
diff --git a/plugins/Popup/src/config.cpp b/plugins/Popup/src/config.cpp
index ecc5a02e78..e137b9d722 100644
--- a/plugins/Popup/src/config.cpp
+++ b/plugins/Popup/src/config.cpp
@@ -71,23 +71,22 @@ void PopupPreview()
LPGENW("This is a special test preview for the popup plugin settings. The text and title are quite long so you can tweak your skin and plugin settings to best fit your needs :)")
);
- POPUPDATA2 ppd = { 0 };
-
- memset(&ppd, 0, sizeof(ppd));
+ POPUPDATA2 ppd = {};
ppd.cbSize = sizeof(ppd);
ppd.flags = PU2_UNICODE;
- ppd.lptzTitle = lptzTitle1Eng;
- ppd.lpwzText = lptzText1Eng;
+ ppd.szTitle.w = lptzTitle1Eng;
+ ppd.szText.w = lptzText1Eng;
ppd.lchIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
CallService(MS_POPUP_ADDPOPUP2, (WPARAM)&ppd, APF_NO_HISTORY);
- if (PopupOptions.UseAnimations || PopupOptions.UseEffect) Sleep((ANIM_TIME * 2) / 3); // Pause
+ if (PopupOptions.UseAnimations || PopupOptions.UseEffect)
+ Sleep((ANIM_TIME * 2) / 3); // Pause
memset(&ppd, 0, sizeof(ppd));
ppd.cbSize = sizeof(ppd);
ppd.flags = PU2_UNICODE;
- ppd.lptzTitle = lptzTitle2;
- ppd.lpwzText = lptzText2;
+ ppd.szTitle.w = lptzTitle2;
+ ppd.szText.w = lptzText2;
ppd.lchIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
ppd.hbmAvatar = hbmNoAvatar;
diff --git a/plugins/Popup/src/config.h b/plugins/Popup/src/config.h
index 2819fd52f3..ec7f7bafca 100644
--- a/plugins/Popup/src/config.h
+++ b/plugins/Popup/src/config.h
@@ -48,7 +48,6 @@ typedef struct tagPOPUPOPTIONS {
BYTE ReorderPopups;
BYTE ReorderPopupsWarning;
//Disable when
- BOOL ModuleIsEnabled;
BYTE DisableWhenFullscreen;
//others
BYTE debug;
diff --git a/plugins/Popup/src/history.cpp b/plugins/Popup/src/history.cpp
index d0e745da64..c4da220b9c 100644
--- a/plugins/Popup/src/history.cpp
+++ b/plugins/Popup/src/history.cpp
@@ -37,8 +37,8 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
static void FreeHistoryItem(POPUPDATA2 *ppd)
{
- mir_free(ppd->lpzTitle);
- mir_free(ppd->lpzText);
+ mir_free(ppd->szTitle.w);
+ mir_free(ppd->szText.w);
mir_free(ppd->lpzSkin);
mir_free(ppd);
}
@@ -74,12 +74,12 @@ void PopupHistoryAdd(POPUPDATA2 *ppdNew)
POPUPDATA2 *ppd = (POPUPDATA2*)mir_alloc(sizeof(POPUPDATA2));
*ppd = *ppdNew;
if (ppd->flags & PU2_UNICODE) {
- ppd->lptzTitle = mir_wstrdup(ppd->lpwzTitle);
- ppd->lpwzText = mir_wstrdup(ppd->lpwzText);
+ ppd->szTitle.w = mir_wstrdup(ppd->szTitle.w);
+ ppd->szText.w = mir_wstrdup(ppd->szText.w);
}
else {
- ppd->lpzTitle = mir_strdup(ppd->lpzTitle);
- ppd->lpzText = mir_strdup(ppd->lpzText);
+ ppd->szTitle.a = mir_strdup(ppd->szTitle.a);
+ ppd->szText.a = mir_strdup(ppd->szText.a);
}
ppd->lpzSkin = mir_strdup(ppd->lpzSkin);
ppd->dwTimestamp = time(0);
@@ -187,14 +187,14 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara
ieData.color = ppd->colorText;
if (ppd->flags & PU2_UNICODE) {
ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
- ieData.pszNickW = ppd->lptzTitle;
- ieData.pszTextW = ppd->lpwzText;
+ ieData.pszNickW = ppd->szTitle.w;
+ ieData.pszTextW = ppd->szText.w;
ieData.pszText2W = nullptr;
}
else {
ieData.dwFlags |= 0;
- ieData.pszNick = ppd->lpzTitle;
- ieData.pszText = ppd->lpzText;
+ ieData.pszNick = ppd->szTitle.a;
+ ieData.pszText = ppd->szText.a;
ieData.pszText2 = nullptr;
}
ieData.bIsMe = FALSE;
@@ -371,14 +371,14 @@ static INT_PTR CALLBACK HistoryDlgProc(HWND hwnd, UINT msg, WPARAM, LPARAM lPara
ieData.color = ppd->colorText;
if (ppd->flags & PU2_UNICODE) {
ieData.dwFlags |= IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
- ieData.pszNickW = ppd->lptzTitle;
- ieData.pszTextW = ppd->lpwzText;
+ ieData.pszNickW = ppd->szTitle.w;
+ ieData.pszTextW = ppd->szText.w;
ieData.pszText2W = nullptr;
}
else {
ieData.dwFlags |= 0;
- ieData.pszNick = ppd->lpzTitle;
- ieData.pszText = ppd->lpzText;
+ ieData.pszNick = ppd->szTitle.a;
+ ieData.pszText = ppd->szText.a;
ieData.pszText2 = nullptr;
}
ieData.bIsMe = FALSE;
diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp
index 2a84de3e69..6f7348bb01 100644
--- a/plugins/Popup/src/main.cpp
+++ b/plugins/Popup/src/main.cpp
@@ -109,9 +109,7 @@ static int IconsChanged(WPARAM, LPARAM)
{
LoadActions();
- HANDLE hIcon = PopupOptions.ModuleIsEnabled == TRUE
- ? GetIconHandle(IDI_POPUP)
- : GetIconHandle(IDI_NOPOPUP);
+ HANDLE hIcon = Popup_Enabled() ? GetIconHandle(IDI_POPUP) : GetIconHandle(IDI_NOPOPUP);
Menu_ModifyItem(hMenuItem, nullptr, hIcon);
Menu_ModifyItem(hMenuRoot, nullptr, hIcon);
@@ -126,7 +124,7 @@ static int TTBLoaded(WPARAM, LPARAM)
ttb.pszService = MENUCOMMAND_SVC;
ttb.lParamUp = 1;
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
- if (PopupOptions.ModuleIsEnabled)
+ if (Popup_Enabled())
ttb.dwFlags |= TTBBF_PUSHED;
ttb.name = LPGEN("Toggle Popups");
ttb.hIconHandleUp = GetIconHandle(IDI_NOPOPUP);
@@ -141,25 +139,23 @@ static int TTBLoaded(WPARAM, LPARAM)
INT_PTR svcEnableDisableMenuCommand(WPARAM, LPARAM)
{
HANDLE hIcon;
- if (PopupOptions.ModuleIsEnabled) {
+ if (Popup_Enabled()) {
// The module is enabled.
// The action to do is "disable popups" (show disabled) and we must write "enable popup" in the new item.
- PopupOptions.ModuleIsEnabled = FALSE;
- db_set_b(0, "Popup", "ModuleIsEnabled", FALSE);
+ Popup_Enable(false);
Menu_ModifyItem(hMenuItem, LPGENW("Enable Popups"), hIcon = GetIconHandle(IDI_NOPOPUP));
}
else {
// The module is disabled.
// The action to do is enable popups (show enabled), then write "disable popup" in the new item.
- PopupOptions.ModuleIsEnabled = TRUE;
- db_set_b(0, "Popup", "ModuleIsEnabled", TRUE);
+ Popup_Enable(true);
Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), hIcon = GetIconHandle(IDI_POPUP));
}
Menu_ModifyItem(hMenuRoot, nullptr, hIcon);
if (hTTButton)
- CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (PopupOptions.ModuleIsEnabled) ? TTBST_PUSHED : 0);
+ CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, (Popup_Enabled()) ? TTBST_PUSHED : 0);
return 0;
}
@@ -175,7 +171,7 @@ void InitMenuItems(void)
CMenuItem mi(&g_plugin);
mi.flags = CMIF_UNICODE;
- HANDLE hIcon = GetIconHandle(PopupOptions.ModuleIsEnabled ? IDI_POPUP : IDI_NOPOPUP);
+ HANDLE hIcon = GetIconHandle(Popup_Enabled() ? IDI_POPUP : IDI_NOPOPUP);
// Build main menu
hMenuRoot = mi.root = g_plugin.addRootMenu(MO_MAIN, MODULNAME_PLUW, -1000000000, hIcon);
@@ -185,7 +181,7 @@ void InitMenuItems(void)
SET_UID(mi, 0x4353d44e, 0x177, 0x4843, 0x88, 0x30, 0x25, 0x5d, 0x91, 0xad, 0xdf, 0x3f);
mi.pszService = MENUCOMMAND_SVC;
CreateServiceFunction(mi.pszService, svcEnableDisableMenuCommand);
- mi.name.w = PopupOptions.ModuleIsEnabled ? LPGENW("Disable Popups") : LPGENW("Enable Popups");
+ mi.name.w = Popup_Enabled() ? LPGENW("Disable Popups") : LPGENW("Enable Popups");
mi.hIcolibItem = hIcon;
hMenuItem = Menu_AddMainMenuItem(&mi);
@@ -199,12 +195,6 @@ void InitMenuItems(void)
hMenuItemHistory = Menu_AddMainMenuItem(&mi);
}
-//===== GetStatus =======================================================================
-INT_PTR GetStatus(WPARAM, LPARAM)
-{
- return PopupOptions.ModuleIsEnabled;
-}
-
// register Hotkey
void LoadHotkey()
{
@@ -324,8 +314,6 @@ static int OnShutdown(WPARAM, LPARAM)
int CMPlugin::Load()
{
- CreateServiceFunction(MS_POPUP_GETSTATUS, GetStatus);
-
#if defined(_DEBUG)
PopupOptions.debug = g_plugin.getByte("debug", FALSE);
#else
@@ -377,7 +365,6 @@ int CMPlugin::Load()
CreateServiceFunction(MS_POPUP_SHOWMESSAGE, Popup_ShowMessage);
CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, Popup_ShowMessageW);
- CreateServiceFunction(MS_POPUP_QUERY, Popup_Query);
CreateServiceFunction(MS_POPUP_REGISTERACTIONS, Popup_RegisterActions);
CreateServiceFunction(MS_POPUP_REGISTERNOTIFICATION, Popup_RegisterNotification);
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp
index b3fbfe469a..f68cca8e11 100644
--- a/plugins/Popup/src/opt_class.cpp
+++ b/plugins/Popup/src/opt_class.cpp
@@ -341,8 +341,8 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
POPUPDATA2 ppd = { 0 };
ppd.cbSize = sizeof(ppd);
ppd.flags = PU2_UNICODE;
- ppd.lptzTitle = ptd->pszDescription;
- ppd.lpwzText = TranslateT("Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!");
+ ppd.szTitle.w = ptd->pszDescription;
+ ppd.szText.w = TranslateT("Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn!");
ppd.iSeconds = ptd->timeoutValue;
ppd.colorBack = ptd->colorBack;
ppd.colorText = ptd->colorText;
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp
index 80620f84dd..ebe0c4d6e0 100644
--- a/plugins/Popup/src/opt_gen.cpp
+++ b/plugins/Popup/src/opt_gen.cpp
@@ -121,7 +121,6 @@ void LoadOption_General()
PopupOptions.ReorderPopupsWarning = g_plugin.getByte("ReorderPopupsWarning", TRUE);
// disable When
- PopupOptions.ModuleIsEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", TRUE);
PopupOptions.DisableWhenFullscreen = g_plugin.getByte("DisableWhenFullscreen", TRUE);
}
@@ -195,10 +194,13 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
CheckDlgButton(hwnd, IDC_REORDERPOPUPS, PopupOptions.ReorderPopups ? BST_CHECKED : BST_UNCHECKED);
// Popup enabled
- CheckDlgButton(hwnd, IDC_POPUPENABLED, PopupOptions.ModuleIsEnabled ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled);
- EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled);
+ {
+ bool bEnabled = Popup_Enabled();
+ CheckDlgButton(hwnd, IDC_POPUPENABLED, bEnabled ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwnd, IDC_DISABLEINFS, PopupOptions.DisableWhenFullscreen ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), bEnabled);
+ EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), bEnabled);
+ }
// new status options
{
@@ -341,11 +343,12 @@ INT_PTR CALLBACK DlgProcPopupGeneral(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case IDC_POPUPENABLED:
{
+ bool bEnabled = Popup_Enabled();
int chk = IsDlgButtonChecked(hwnd, IDC_POPUPENABLED);
- if (PopupOptions.ModuleIsEnabled&&chk || !PopupOptions.ModuleIsEnabled && !chk)
+ if (bEnabled && chk || !bEnabled && !chk)
svcEnableDisableMenuCommand(0, 0);
- EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), PopupOptions.ModuleIsEnabled);
- EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), PopupOptions.ModuleIsEnabled);
+ EnableWindow(GetDlgItem(hwnd, IDC_STATUSES), bEnabled);
+ EnableWindow(GetDlgItem(hwnd, IDC_DISABLEINFS), bEnabled);
}
break;
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp
index 7dc2ac93f7..45418a6e6a 100644
--- a/plugins/Popup/src/opt_skins.cpp
+++ b/plugins/Popup/src/opt_skins.cpp
@@ -76,8 +76,8 @@ static void updatePreviewImage(HWND hwndBox)
ppd.cbSize = sizeof(ppd);
ppd.flags = PU2_UNICODE;
ppd.lchIcon = Skin_LoadIcon(SKINICON_STATUS_ONLINE);
- ppd.lptzTitle = TranslateT("Skin preview");
- ppd.lpwzText = TranslateT("Just take a look at this skin... ;)");
+ ppd.szTitle.w = TranslateT("Skin preview");
+ ppd.szText.w = TranslateT("Just take a look at this skin... ;)");
POPUPOPTIONS customOptions = PopupOptions;
customOptions.DynamicResize = FALSE;
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp
index 0b41e89e3c..e2dcc6bfce 100644
--- a/plugins/Popup/src/popup_wnd2.cpp
+++ b/plugins/Popup/src/popup_wnd2.cpp
@@ -677,7 +677,7 @@ void PopupWnd2::setIcon(HICON hNewIcon)
}
}
-void PopupWnd2::updateData(POPUPDATAW_V2 *ppd)
+void PopupWnd2::updateData(POPUPDATAW *ppd)
{
m_hContact = ppd->lchContact;
@@ -717,8 +717,8 @@ void PopupWnd2::updateData(POPUPDATA2 *ppd)
if (ppd->flags & PU2_UNICODE) {
if (m_textType == TT_NONE)
m_textType = TT_UNICODE;
- replaceStrW(m_lptzTitle, ppd->lptzTitle);
- replaceStrW(m_lptzText, ppd->lpwzText);
+ replaceStrW(m_lptzTitle, ppd->szTitle.w);
+ replaceStrW(m_lptzText, ppd->szText.w);
}
else {
replaceStrW(m_lptzTitle, nullptr);
@@ -1127,7 +1127,7 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara
switch (wParam) {
case CPT_TEXTW: updateText((wchar_t *)lParam); mir_free((void *)lParam); break;
case CPT_TITLEW: updateTitle((wchar_t *)lParam); mir_free((void *)lParam); break;
- case CPT_DATAW: updateData((POPUPDATAW_V2 *)lParam); mir_free((void *)lParam); break;
+ case CPT_DATAW: updateData((POPUPDATAW *)lParam); mir_free((void *)lParam); break;
}
update();
break;
diff --git a/plugins/Popup/src/popup_wnd2.h b/plugins/Popup/src/popup_wnd2.h
index bed4bd7ba2..45b940fbb6 100644
--- a/plugins/Popup/src/popup_wnd2.h
+++ b/plugins/Popup/src/popup_wnd2.h
@@ -128,7 +128,7 @@ public:
void setIcon(HICON);
- void updateData(POPUPDATAW_V2 *ppd);
+ void updateData(POPUPDATAW *ppd);
void updateData(POPUPDATA2 *ppd);
void buildMText();
void updateText(wchar_t *text);
@@ -208,7 +208,7 @@ public:
SendMessage(m_hwnd, UM_CALLMETHOD, (WPARAM)method_copy, (LPARAM)lParam);
}
- LRESULT m_updateData_POPUPDATAW_V2(LPARAM arg) { updateData((POPUPDATAW_V2 *)arg); update(); return 0; }
+ LRESULT m_updateData_POPUPDATAW_V2(LPARAM arg) { updateData((POPUPDATAW *)arg); update(); return 0; }
LRESULT m_updateData_POPUPDATA2(LPARAM arg) { updateData((POPUPDATA2 *)arg); update(); return 0; }
LRESULT m_updateText(LPARAM arg) { updateText((wchar_t *)arg); update(); return 0; }
LRESULT m_updateTitle(LPARAM arg) { updateTitle((wchar_t *)arg); update(); return 0; }
diff --git a/plugins/Popup/src/services.cpp b/plugins/Popup/src/services.cpp
index d14f0aa622..9a87bbcf81 100644
--- a/plugins/Popup/src/services.cpp
+++ b/plugins/Popup/src/services.cpp
@@ -41,8 +41,8 @@ INT_PTR Popup_AddPopup(WPARAM wParam, LPARAM lParam)
ppd2.flags = PU2_UNICODE;
ppd2.lchContact = ppd->lchContact;
ppd2.lchIcon = ppd->lchIcon;
- ppd2.lpwzTitle = wszTitle;
- ppd2.lpwzText = wszText;
+ ppd2.szTitle.w = wszTitle;
+ ppd2.szText.w = wszText;
ppd2.colorBack = ppd->colorBack;
ppd2.colorText = ppd->colorText;
ppd2.PluginWindowProc = ppd->PluginWindowProc;
@@ -57,7 +57,7 @@ INT_PTR Popup_AddPopupW(WPARAM wParam, LPARAM lParam)
if (!gbPopupLoaded)
return -1;
- POPUPDATAW_V2 *ppd = (POPUPDATAW_V2*)wParam;
+ POPUPDATAW *ppd = (POPUPDATAW*)wParam;
if (!ppd)
return -1;
@@ -66,19 +66,16 @@ INT_PTR Popup_AddPopupW(WPARAM wParam, LPARAM lParam)
ppd2.flags = PU2_UNICODE;
ppd2.lchContact = ppd->lchContact;
ppd2.lchIcon = ppd->lchIcon;
- ppd2.lpwzTitle = ppd->lpwzContactName;
- ppd2.lpwzText = ppd->lpwzText;
+ ppd2.szTitle.w = ppd->lpwzContactName;
+ ppd2.szText.w = ppd->lpwzText;
ppd2.colorBack = ppd->colorBack;
ppd2.colorText = ppd->colorText;
ppd2.PluginWindowProc = ppd->PluginWindowProc;
ppd2.PluginData = ppd->PluginData;
ppd2.iSeconds = ppd->iSeconds;
-
- if (lParam & APF_NEWDATA) {
- ppd2.lchNotification = ppd->hNotification;
- ppd2.actionCount = ppd->actionCount;
- ppd2.lpActions = ppd->lpActions;
- }
+ ppd2.lchNotification = ppd->hNotification;
+ ppd2.actionCount = ppd->actionCount;
+ ppd2.lpActions = ppd->lpActions;
return Popup_AddPopup2((WPARAM)&ppd2, lParam);
}
@@ -132,7 +129,7 @@ INT_PTR Popup_AddPopup2(WPARAM wParam, LPARAM lParam)
return -1;
if (bShowMode != PU_SHOWMODE_FAVORITE) {
- if (!PopupOptions.ModuleIsEnabled)
+ if (!Popup_Enabled())
return -1;
if (PopupOptions.DisableWhenFullscreen && (bShowMode != PU_SHOWMODE_FULLSCREEN) && IsFullScreen())
@@ -237,28 +234,28 @@ INT_PTR Popup_ShowMessageW(WPARAM wParam, LPARAM lParam)
POPUPDATA2 ppd2 = { 0 };
ppd2.cbSize = sizeof(ppd2);
ppd2.flags = PU2_UNICODE;
- ppd2.lpwzText = (wchar_t*)wParam;
+ ppd2.szText.w = (wchar_t*)wParam;
switch (lParam & 0x7fffffff) {
case SM_ERROR:
ppd2.lchIcon = LoadIconEx(IDI_MB_STOP, 0);
ppd2.colorBack = RGB(191, 0, 0);
ppd2.colorText = RGB(255, 245, 225);
ppd2.lchNotification = g_hntfError;
- ppd2.lptzTitle = TranslateT("Error");
+ ppd2.szTitle.w = TranslateT("Error");
break;
case SM_WARNING:
ppd2.lchIcon = LoadIconEx(IDI_MB_WARN, 0);
ppd2.colorBack = RGB(210, 210, 150);
ppd2.colorText = RGB(0, 0, 0);
ppd2.lchNotification = g_hntfWarning;
- ppd2.lptzTitle = TranslateT("Warning");
+ ppd2.szTitle.w = TranslateT("Warning");
break;
case SM_NOTIFY:
ppd2.lchIcon = LoadIconEx(IDI_MB_INFO, 0);
ppd2.colorBack = RGB(230, 230, 230);
ppd2.colorText = RGB(0, 0, 0);
ppd2.lchNotification = g_hntfNotification;
- ppd2.lptzTitle = TranslateT("Notify");
+ ppd2.szTitle.w = TranslateT("Notify");
break;
default: // No no no... you must give me a good value.
return -1;
@@ -275,42 +272,11 @@ INT_PTR Popup_ShowMessage(WPARAM wParam, LPARAM lParam)
return Popup_ShowMessageW(wszMsg, lParam);
}
-//===== Popup/Query
-INT_PTR Popup_Query(WPARAM wParam, LPARAM)
-{
- if (!gbPopupLoaded) return -1;
-
- if (closing)
- return 0;
-
- switch (wParam) {
- case PUQS_ENABLEPOPUPS:
- if (PopupOptions.ModuleIsEnabled)
- return 1; // They're already ON!!!
-
- // Module was disabled.
- svcEnableDisableMenuCommand(0, 0);
- return 0;
-
- case PUQS_DISABLEPOPUPS:
- if (!(PopupOptions.ModuleIsEnabled))
- return 1; // They're already OFF!!!
-
- svcEnableDisableMenuCommand(0, 0);
- return 0;
-
- case PUQS_GETSTATUS:
- return (PopupOptions.ModuleIsEnabled);
-
- default:
- return -1;
- }
-}
//===== Popup/RegisterActions
INT_PTR Popup_RegisterActions(WPARAM wParam, LPARAM lParam)
{
- LPPOPUPACTION actions = (LPPOPUPACTION)wParam;
+ POPUPACTION *actions = (POPUPACTION*)wParam;
for (int i = 0; i < lParam; ++i)
RegisterAction(&actions[i]);
return 0;
@@ -458,13 +424,13 @@ INT_PTR Popup_CreateClassPopup(WPARAM wParam, LPARAM lParam)
ppd2.PluginWindowProc = pc->PluginWindowProc;
if (pc->flags & PCF_UNICODE) {
ppd2.flags = PU2_UNICODE;
- ppd2.lptzTitle = (wchar_t*)pdc->pwszTitle;
- ppd2.lpwzText = (wchar_t*)pdc->pwszText;
+ ppd2.szTitle.w = (wchar_t*)pdc->szTitle.w;
+ ppd2.szText.w = (wchar_t*)pdc->szText.w;
}
else {
ppd2.flags = PU2_ANSI;
- ppd2.lpzTitle = (char *)pdc->pszTitle;
- ppd2.lpzText = (char *)pdc->pszText;
+ ppd2.szTitle.a = (char *)pdc->szTitle.a;
+ ppd2.szText.a = (char *)pdc->szText.a;
}
ppd2.lchContact = pdc->hContact;
ppd2.PluginData = pdc->PluginData;
diff --git a/plugins/Popup/src/stdafx.h b/plugins/Popup/src/stdafx.h
index 74e34acc48..d91eb951ec 100644
--- a/plugins/Popup/src/stdafx.h
+++ b/plugins/Popup/src/stdafx.h
@@ -80,7 +80,7 @@ https://miranda-ng.org/distr/
#include <m_fontservice.h>
#include <m_avatars.h>
#include <m_extraicons.h>
-#include <m_popup.h>
+#include <m_popup_int.h>
#include <m_imgsrvc.h>
#include <m_timezones.h>
diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp
index 7773035073..82abf159d9 100644
--- a/plugins/SeenPlugin/src/options.cpp
+++ b/plugins/SeenPlugin/src/options.cpp
@@ -89,7 +89,7 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp
case WM_INITDIALOG:
TranslateDialogDefault(hdlg);
{
- int hasPopups = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0);
+ int hasPopups = Popup_Enabled();
ShowWindow(GetDlgItem(hdlg, IDC_POPUPS), hasPopups ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP), hasPopups ? SW_SHOW : SW_HIDE);
ShowWindow(GetDlgItem(hdlg, IDC_LABTEXT), hasPopups ? SW_SHOW : SW_HIDE);
diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp
index fc9d77978f..1e2faa997b 100644
--- a/plugins/SendScreenshotPlus/src/Main.cpp
+++ b/plugins/SendScreenshotPlus/src/Main.cpp
@@ -227,7 +227,6 @@ CMPlugin::CMPlugin() :
int hook_ModulesLoaded(WPARAM, LPARAM)
{
- g_myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS);
g_myGlobals.PluginHTTPExist = ServiceExists(MS_HTTP_ACCEPT_CONNECTIONS);
g_myGlobals.PluginFTPExist = ServiceExists(MS_FTPFILE_UPLOAD);
g_myGlobals.PluginCloudFileExist = ServiceExists(MS_CLOUDFILE_UPLOAD);
diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
index ee80a0a07a..82a7c22ddb 100644
--- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
+++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
@@ -499,8 +499,7 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam)
MoveWindow(hDlg, -10, -10, 0, 0, FALSE);
LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
if (pmpd) {
- POPUPDATAW_V2 pd = { 0 };
- pd.cbSize = sizeof(pd);
+ POPUPDATAW pd = { 0 };
pd.lchContact = NULL; // (HANDLE)wParam;
// icon
pd.lchIcon = MsgLoadIcon(pMsgBox);
@@ -576,7 +575,7 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam)
}
// create popup
- PUAddPopupW(&pd, APF_NEWDATA);
+ PUAddPopupW(&pd);
if (MB_TYPE(pMsgBox->uType) == MB_OK)
EndDialog(hDlg, IDOK);
}
diff --git a/plugins/SmileyAdd/src/general.cpp b/plugins/SmileyAdd/src/general.cpp
index 84c6c01fae..7a1582daa3 100644
--- a/plugins/SmileyAdd/src/general.cpp
+++ b/plugins/SmileyAdd/src/general.cpp
@@ -201,6 +201,6 @@ void ReportError(const wchar_t *errmsg)
mir_wstrcpy(pd.lpwzContactName, title);
mir_wstrcpy(pd.lpwzText, errmsg);
pd.iSeconds = -1;
- if (PUAddPopupW(&pd) == CALLSERVICE_NOTFOUND)
+ if (PUAddPopupW(&pd) == INVALID_HANDLE_VALUE)
MessageBox(nullptr, errmsg, title, MB_OK | MB_ICONWARNING | MB_TOPMOST);
}
diff --git a/plugins/Spamotron/src/popups.cpp b/plugins/Spamotron/src/popups.cpp
index dd53817a52..305f0abf0c 100644
--- a/plugins/Spamotron/src/popups.cpp
+++ b/plugins/Spamotron/src/popups.cpp
@@ -188,8 +188,7 @@ int ShowPopupPreview(HWND optDlg, BYTE popupType, wchar_t *line1, wchar_t *line2
wcsncpy_s(ppdp.lpwzContactName, (line1 ? line1 : _A2W(MODULENAME)), _TRUNCATE);
if (line2)
wcsncpy_s(ppdp.lpwzText, line2, _TRUNCATE);
- return PUAddPopupW(&ppdp);
-
+ return (int)PUAddPopupW(&ppdp);
}
int ShowPopup(MCONTACT hContact, BYTE popupType, wchar_t *line1, wchar_t *line2)
@@ -237,5 +236,5 @@ int ShowPopup(MCONTACT hContact, BYTE popupType, wchar_t *line1, wchar_t *line2)
wcsncpy_s(ppdp.lpwzContactName, (line1 ? line1 : _A2W(MODULENAME)), _TRUNCATE);
if (line2)
wcsncpy_s(ppdp.lpwzText, line2, _TRUNCATE);
- return PUAddPopupW(&ppdp);
+ return (int)PUAddPopupW(&ppdp);
} \ No newline at end of file
diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp
index 8b7e69fa90..b2a0e9af05 100644
--- a/plugins/StartupSilence/src/main.cpp
+++ b/plugins/StartupSilence/src/main.cpp
@@ -34,7 +34,6 @@ HANDLE Buttons = nullptr;
int DisablePopup(WPARAM wParam, LPARAM lParam);
void RemoveTTButtons();
-void EnablePopupModule();
BYTE Enabled;
DWORD delay;
BYTE PopUp;
@@ -90,7 +89,7 @@ static void __cdecl AdvSt(void*)
POPUPDATAW ppd = { 0 };
wchar_t *lpwzText = L"";
db_set_b(0, "Skin", "UseSound", 0);
- EnablePopupModule();
+ Popup_Enable(true);
if (PopUp == 1) {
lpwzText = NonStatusAllow == 1 ? ALL_DISABLED_FLT : ALL_DISABLED;
@@ -143,11 +142,6 @@ int DisablePopup(WPARAM wParam, LPARAM)
return 0; //---> just allow all popups with this return
}
-void EnablePopupModule()
-{
- CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS);
-}
-
void InitSettings()
{
if (gethostname(hostname, _countof(hostname)) == 0) {
diff --git a/plugins/StatusManager/src/keepstatus.cpp b/plugins/StatusManager/src/keepstatus.cpp
index e68f2c4a56..0d9f74e08d 100644
--- a/plugins/StatusManager/src/keepstatus.cpp
+++ b/plugins/StatusManager/src/keepstatus.cpp
@@ -798,7 +798,7 @@ static INT_PTR ShowPopup(const wchar_t *msg, HICON hIcon)
ppd.iSeconds = 0;
break;
}
- return PUAddPopupW(&ppd);
+ return (int)PUAddPopupW(&ppd);
}
static wchar_t* GetHumanName(LPARAM lParam)
diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp
index cb22e44284..937c460af7 100644
--- a/plugins/TabSRMM/src/chat_tools.cpp
+++ b/plugins/TabSRMM/src/chat_tools.cpp
@@ -124,7 +124,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa
pd.PluginWindowProc = PopupDlgProc;
pd.PluginData = si;
- return PUAddPopupW(&pd);
+ return (int)PUAddPopupW(&pd);
}
BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 694f823531..75e826a44e 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -248,7 +248,7 @@ void CTabBaseDlg::NotifyDeliveryFailure() const
if (M.GetByte("adv_noErrorPopups", 0))
return;
- if (CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) != 1)
+ if (!Popup_Enabled())
return;
POPUPDATAW ppd = { 0 };
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp
index f65d1f8965..353d45f7cb 100644
--- a/plugins/TabSRMM/src/typingnotify.cpp
+++ b/plugins/TabSRMM/src/typingnotify.cpp
@@ -96,8 +96,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode)
}
int notyping;
- POPUPDATAW_V2 ppd = { 0 };
- ppd.cbSize = sizeof(ppd);
+ POPUPDATAW ppd = { 0 };
if (iMode == PROTOTYPE_CONTACTTYPING_OFF) {
if (StopDisabled)
@@ -164,7 +163,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode)
ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING];
ppd.lchContact = hContact;
ppd.PluginWindowProc = PopupDlgProc;
- PUAddPopupW(&ppd, APF_NEWDATA);
+ PUAddPopupW(&ppd);
}
static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
diff --git a/plugins/Toaster/src/options.cpp b/plugins/Toaster/src/options.cpp
index 7c1e446042..be08b5cf16 100644
--- a/plugins/Toaster/src/options.cpp
+++ b/plugins/Toaster/src/options.cpp
@@ -13,7 +13,7 @@ COptions::COptions()
bool COptions::OnInitDialog()
{
- m_enabled.SetState(CallService(MS_POPUP_QUERY, PUQS_GETSTATUS));
+ m_enabled.SetState(Popup_Enabled());
return true;
}
@@ -34,10 +34,7 @@ void COptions::Preview_OnClick(CCtrlBase*)
void COptions::Enabled_OnChange(CCtrlCheck* chk)
{
- if (chk->GetState())
- CallService(MS_POPUP_QUERY, PUQS_ENABLEPOPUPS);
- else
- CallService(MS_POPUP_QUERY, PUQS_DISABLEPOPUPS);
+ Popup_Enable(chk->GetState());
}
/////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp
index 6bc3e1b8e4..fe5bd912fd 100644
--- a/plugins/Toaster/src/services.cpp
+++ b/plugins/Toaster/src/services.cpp
@@ -9,7 +9,7 @@ void __stdcall ShowToastNotification(void* p)
{
std::unique_ptr<ToastData> td((ToastData*)p);
- if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1))
+ if (!Popup_Enabled())
return;
ptrW imagePath;
@@ -80,13 +80,13 @@ static INT_PTR CreatePopup2(WPARAM wParam, LPARAM)
ptrW text, title;
if (ppd->flags & PU2_UNICODE)
{
- text = mir_wstrdup(ppd->lpwzText);
- title = mir_wstrdup(ppd->lpwzTitle);
+ text = mir_wstrdup(ppd->szText.w);
+ title = mir_wstrdup(ppd->szTitle.w);
}
else
{
- text = mir_a2u(ppd->lpzText);
- title = mir_a2u(ppd->lpzTitle);
+ text = mir_a2u(ppd->szText.a);
+ title = mir_a2u(ppd->szTitle.a);
}
ToastData *td = nullptr;
@@ -122,16 +122,11 @@ static INT_PTR CreateClassPopup(WPARAM, LPARAM lParam)
auto it = mp_Classes.find(ppc->pszClassName);
if (it != mp_Classes.end())
{
- ToastData *td = nullptr;
-
+ ToastData *td;
if (it->second->iFlags & PCF_UNICODE)
- {
- td = new ToastData(ppc->hContact, ppc->pwszTitle, ppc->pwszText, it->second->hIcon);
- }
+ td = new ToastData(ppc->hContact, ppc->szTitle.w, ppc->szText.w, it->second->hIcon);
else
- {
- td = new ToastData(ppc->hContact, ptrW(mir_utf8decodeW(ppc->pszTitle)), ptrW(mir_utf8decodeW(ppc->pszText)), it->second->hIcon);
- }
+ td = new ToastData(ppc->hContact, ptrW(mir_utf8decodeW(ppc->szTitle.a)), ptrW(mir_utf8decodeW(ppc->szText.a)), it->second->hIcon);
td->vPopupData = ppc->PluginData;
td->pPopupProc = it->second->pPopupProc;
@@ -163,30 +158,6 @@ void CleanupClasses()
mp_Classes.clear();
}
-static INT_PTR PopupQuery(WPARAM wParam, LPARAM)
-{
- switch (wParam)
- {
- case PUQS_ENABLEPOPUPS:
- {
- bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0;
- if (!enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 1);
- return !enabled;
- }
- case PUQS_DISABLEPOPUPS:
- {
- bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0;
- if (enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 0);
- CallFunctionAsync(HideAllToasts, nullptr);
- return enabled;
- }
- case PUQS_GETSTATUS:
- return db_get_b(0, "Popup", "ModuleIsEnabled", 1);
- default:
- return 1;
- }
-}
-
static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam)
{
HICON hIcon = nullptr;
@@ -239,8 +210,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, RegisterPopupClass);
CreateServiceFunction(MS_POPUP_UNREGISTERCLASS, UnRegisterPopupClass);
diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h
index aecd986516..c5204df533 100644
--- a/plugins/Toaster/src/stdafx.h
+++ b/plugins/Toaster/src/stdafx.h
@@ -16,7 +16,7 @@
#include <m_langpack.h>
#include <m_avatars.h>
#include <m_protocols.h>
-#include <m_popup.h>
+#include <m_popup_int.h>
#include <m_message.h>
#include <m_chat.h>
#include <m_skin.h>
diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp
index 4adbd1fdeb..8e67dff833 100644
--- a/plugins/UserInfoEx/src/dlg_msgbox.cpp
+++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp
@@ -490,8 +490,7 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam)
MoveWindow(hDlg, -10, -10, 0, 0, FALSE);
LPMSGPOPUPDATA pmpd = (LPMSGPOPUPDATA)mir_alloc(sizeof(MSGPOPUPDATA));
if (pmpd) {
- POPUPDATAW_V2 pd = { 0 };
- pd.cbSize = sizeof(pd);
+ POPUPDATAW pd = { 0 };
pd.lchContact = NULL; //(HANDLE)wParam;
// icon
pd.lchIcon = MsgLoadIcon(pMsgBox);
@@ -567,7 +566,7 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam)
}
// create popup
- PUAddPopupW(&pd, APF_NEWDATA);
+ PUAddPopupW(&pd);
if (MB_TYPE(pMsgBox->uType) == MB_OK)
EndDialog(hDlg, IDOK);
}
@@ -642,7 +641,6 @@ INT_PTR MsgBoxService(WPARAM, LPARAM lParam)
if (PtrIsValid(pMsgBox) && pMsgBox->cbSize == sizeof(MSGBOX)) {
// Shall the MessageBox displayed as popup?
if (!(pMsgBox->uType & (MB_INFOBAR | MB_NOPOPUP)) // message box can be a popup?
- && myGlobals.PopupActionsExist == 1 // popup support ext stuct?
&& (db_get_dw(0, "Popup", "Actions", 0) & 1) // popup++ actions on?
&& g_plugin.getByte(SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups?
return DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_MSGBOXDUMMI), pMsgBox->hParent, MsgBoxPop, lParam);
diff --git a/plugins/UserInfoEx/src/init.cpp b/plugins/UserInfoEx/src/init.cpp
index 2259a892b0..6d017b966f 100644
--- a/plugins/UserInfoEx/src/init.cpp
+++ b/plugins/UserInfoEx/src/init.cpp
@@ -94,8 +94,6 @@ static int OnTopToolBarLoaded(WPARAM, LPARAM)
**/
static int OnModulesLoaded(WPARAM, LPARAM)
{
- myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS);
-
// create services to receive string lists of languages and timezones
SvcConstantsLoadModule();
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index ca4830974c..f173ec77c9 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -784,11 +784,7 @@ static INT_PTR CALLBACK DlgProc_Popups(HWND hDlg, UINT uMsg, WPARAM wParam, LPAR
DBGetCheckBtn(hDlg, CHECK_OPT_POPUP_MSGBOX, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX);
DBGetCheckBtn(hDlg, CHECK_OPT_POPUP_PROGRESS, "PopupProgress", FALSE);
// disable if popup plugin dos not sopport buttons inside popop
- if (!myGlobals.PopupActionsExist) {
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_MSGBOX, FALSE);
- EnableDlgItem(hDlg, CHECK_OPT_POPUP_PROGRESS, FALSE);
- }
- else if (!(db_get_dw(0, "Popup","Actions", 0) & 1))
+ if (!(db_get_dw(0, "Popup","Actions", 0) & 1))
EnableDlgItem(hDlg, CHECK_OPT_POPUP_MSGBOX, FALSE);
// enable/disable popups
diff --git a/plugins/UserInfoEx/src/stdafx.h b/plugins/UserInfoEx/src/stdafx.h
index c15c141fe9..34d81f6cec 100644
--- a/plugins/UserInfoEx/src/stdafx.h
+++ b/plugins/UserInfoEx/src/stdafx.h
@@ -165,7 +165,6 @@ typedef struct _MGLOBAL
{
BYTE CanChangeDetails : 1; // is service to upload own contact information for icq present?
BYTE TzIndexExist : 1; // Win Reg has Timzone Index Info
- BYTE PopupActionsExist : 1; // Popup++ or MS_POPUP_REGISTERACTIONS exist
BYTE ShowPropsheetColours : 1; // cached SET_PROPSHEET_SHOWCOLOURS database value
BYTE WantAeroAdaption : 1; // reserved for later use
} MGLOBAL, *LPMGLOBAL;
diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp
index f7a11d62c4..533989a1ab 100644
--- a/plugins/UserInfoEx/src/svc_refreshci.cpp
+++ b/plugins/UserInfoEx/src/svc_refreshci.cpp
@@ -393,8 +393,7 @@ public:
**/
virtual HWND Create(LPCTSTR szTitle, PUpdCallback pFnCallBack)
{
- POPUPDATAW_V2 pd = { 0 };
- pd.cbSize = sizeof(pd);
+ POPUPDATAW pd = { 0 };
pd.lchIcon = IcoLib_GetIcon(ICO_BTN_UPDATE);
pd.iSeconds = -1;
pd.PluginData = this;
@@ -409,7 +408,7 @@ public:
mir_wstrcpy(pd.lpwzText, L" ");
_pFnCallBack = pFnCallBack;
- _hWnd = (HWND)PUAddPopupW(&pd, APF_RETURN_HWND | APF_NEWDATA);
+ _hWnd = PUAddPopupW(&pd, APF_RETURN_HWND);
return _hWnd;
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 4dc19b4602..7b9a57e0e0 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -291,7 +291,7 @@ static int NotifyWithPopup(MCONTACT hContact, CEvent::EType eventType, int DaysT
break;
}
}
- return PUAddPopupW(&ppd);
+ return (INT_PTR)PUAddPopupW(&ppd);
}
/**
diff --git a/protocols/CloudFile/src/utils.cpp b/protocols/CloudFile/src/utils.cpp
index b386afe597..3e02092e9a 100644
--- a/protocols/CloudFile/src/utils.cpp
+++ b/protocols/CloudFile/src/utils.cpp
@@ -5,7 +5,7 @@ void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags,
if (Miranda_IsTerminated())
return;
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (Popup_Enabled()) {
POPUPDATAW ppd = { 0 };
ppd.lchContact = hContact;
wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
diff --git a/protocols/ConnectionNotify/src/ConnectionNotify.cpp b/protocols/ConnectionNotify/src/ConnectionNotify.cpp
index 01f00983ca..9a2a3d5122 100644
--- a/protocols/ConnectionNotify/src/ConnectionNotify.cpp
+++ b/protocols/ConnectionNotify/src/ConnectionNotify.cpp
@@ -737,7 +737,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
case UM_INITPOPUP:
//struct CONNECTON *conn=NULL;
- //conn = (struct CONNECTION*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)conn);
+ //conn = (struct CONNECTION*)PUGetPluginData(hWnd,(LPARAM)conn);
//MessageBox(NULL,conn->extIp);
//PUDeletePopUp(hWnd);
break;
diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp
index fdcc2029af..d04cbb38ad 100644
--- a/protocols/FacebookRM/src/events.cpp
+++ b/protocols/FacebookRM/src/events.cpp
@@ -69,8 +69,8 @@ HWND FacebookProto::NotifyEvent(const wchar_t* title, const wchar_t* text, MCONT
if (!getByte(FACEBOOK_KEY_SYSTRAY_NOTIFY, DEFAULT_SYSTRAY_NOTIFY)) {
POPUPDATACLASS pd = { sizeof(pd) };
- pd.pwszTitle = title;
- pd.pwszText = text;
+ pd.szTitle.w = title;
+ pd.szText.w = text;
pd.pszClassName = name;
pd.hContact = contact;
@@ -82,7 +82,7 @@ HWND FacebookProto::NotifyEvent(const wchar_t* title, const wchar_t* text, MCONT
data->notification_id = *notification_id;
pd.PluginData = data;
}
- return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&pd);
+ return Popup_AddClass(&pd);
}
else {
if (!Clist_TrayNotifyW(m_szModuleName, title, text, type == EVENT_CLIENT ? NIIF_WARNING : NIIF_INFO, 10000))
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp
index 962c570002..8fcf1a00ff 100644
--- a/protocols/Gadu-Gadu/src/popups.cpp
+++ b/protocols/Gadu-Gadu/src/popups.cpp
@@ -110,8 +110,8 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam)
char szName[256];
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = puData->title;
- ppd.pwszText = puData->text;
+ ppd.szTitle.w = puData->title;
+ ppd.szText.w = puData->text;
ppd.PluginData = puData;
ppd.pszClassName = szName;
@@ -119,7 +119,7 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam)
mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Error");
else
mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Notify");
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
+ Popup_AddClass(&ppd);
}
void GaduProto::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags)
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index beb3ad7389..3417f7195b 100755
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -426,14 +426,14 @@ void CJabberProto::InitPopups(void)
void CJabberProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle)
{
char name[256];
+ mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = szTitle;
- ppd.pwszText = szMsg;
+ ppd.szTitle.w = szTitle;
+ ppd.szText.w = szMsg;
ppd.pszClassName = name;
ppd.hContact = hContact;
- mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
+ Popup_AddClass(&ppd);
}
CMStringA CJabberProto::ExtractImage(const TiXmlElement *node)
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 51c75757c1..8d62b4984d 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -849,8 +849,8 @@ void CALLBACK sttMainThreadCallback(void *param)
char name[256];
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = pud->title;
- ppd.pwszText = pud->text;
+ ppd.szTitle.w = pud->title;
+ ppd.szText.w = pud->text;
ppd.PluginData = pud;
ppd.pszClassName = name;
@@ -861,7 +861,7 @@ void CALLBACK sttMainThreadCallback(void *param)
else
mir_snprintf(name, "%s_%s", pud->proto->m_szModuleName, "Notify");
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
+ Popup_AddClass(&ppd);
}
void CMsnProto::MSN_ShowPopup(const wchar_t* nickname, const wchar_t* msg, int flags, const char* url)
diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp
index b83b46ea68..368a9cc093 100644
--- a/protocols/Sametime/src/utils.cpp
+++ b/protocols/Sametime/src/utils.cpp
@@ -79,14 +79,14 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam)
if (disp == ED_POP) {
POPUPDATACLASS ppd = { sizeof(ppd) };
char szName[256];
- ppd.pwszTitle = puData->title;
- ppd.pwszText = puData->text;
+ ppd.szTitle.w = puData->title;
+ ppd.szText.w = puData->text;
if (puData->flag == SAMETIME_POPUP_ERROR)
mir_snprintf(szName, "%s_%s", proto->m_szModuleName, "Error");
else
mir_snprintf(szName, "%s_%s", proto->m_szModuleName, "Notify");
ppd.pszClassName = szName;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
+ Popup_AddClass(&ppd);
}
else if (disp == ED_BAL) {
int flags, timeout;
diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp
index ba00d60709..f279a936b5 100644
--- a/protocols/SkypeWeb/src/skype_popups.cpp
+++ b/protocols/SkypeWeb/src/skype_popups.cpp
@@ -64,11 +64,11 @@ void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *messag
}
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = caption;
- ppd.pwszText = message;
+ ppd.szTitle.w = caption;
+ ppd.szText.w = message;
ppd.pszClassName = className.GetBuffer();
ppd.hContact = hContact;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
+ Popup_AddClass(&ppd);
}
void CSkypeProto::ShowNotification(const wchar_t *message, MCONTACT hContact)
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp
index 901fc4089d..ea3c6d20ed 100644
--- a/protocols/Steam/src/steam_utils.cpp
+++ b/protocols/Steam/src/steam_utils.cpp
@@ -51,7 +51,7 @@ void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *messag
if (Miranda_IsTerminated())
return;
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (Popup_Enabled()) {
POPUPDATAW ppd = { 0 };
ppd.lchContact = hContact;
wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp
index 421f16e09e..e2839a8a55 100644
--- a/protocols/Tox/src/tox_utils.cpp
+++ b/protocols/Tox/src/tox_utils.cpp
@@ -104,7 +104,7 @@ void CToxProto::ShowNotification(const wchar_t *caption, const wchar_t *message,
return;
}
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (Popup_Enabled()) {
POPUPDATAW ppd = { 0 };
ppd.lchContact = hContact;
wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index ffe457b3ad..10e1a2693f 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -436,13 +436,13 @@ void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *wszMsg, const wchar_t
char name[256];
POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = wszTitle;
- ppd.pwszText = wszMsg;
+ ppd.szTitle.w = wszTitle;
+ ppd.szText.w = wszMsg;
ppd.pszClassName = name;
ppd.hContact = hContact;
ppd.PluginData = new CVkSendMsgParam(hContact);
mir_snprintf(name, "%s_%s", m_szModuleName, err ? "Error" : "Notification");
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
+ Popup_AddClass(&ppd);
}
void CVkProto::MsgPopup(const wchar_t *wszMsg, const wchar_t *wszTitle, bool err)
diff --git a/protocols/YAMN/src/browser/badconnect.cpp b/protocols/YAMN/src/browser/badconnect.cpp
index aacae630d7..29b1fd285c 100644
--- a/protocols/YAMN/src/browser/badconnect.cpp
+++ b/protocols/YAMN/src/browser/badconnect.cpp
@@ -13,16 +13,15 @@
LRESULT CALLBACK BadConnectPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- DWORD PluginParam;
switch (msg) {
case WM_COMMAND:
// if clicked and it's new mail popup window
- if ((HIWORD(wParam) == STN_CLICKED) && (CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)&PluginParam))) {
+ if ((HIWORD(wParam) == STN_CLICKED) && (PUGetPluginData(hWnd))) {
PROCESS_INFORMATION pi;
STARTUPINFOW si;
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
- HACCOUNT ActualAccount = (HACCOUNT)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, 0);
+ HACCOUNT ActualAccount = (HACCOUNT)PUGetPluginData(hWnd);
#ifdef DEBUG_SYNCHRO
DebugLog(SynchroFile, "PopupProc:LEFTCLICK:ActualAccountSO-read wait\n");
#endif
diff --git a/protocols/YAMN/src/browser/mailbrowser.cpp b/protocols/YAMN/src/browser/mailbrowser.cpp
index bbac178d15..d9c3af6f6c 100644
--- a/protocols/YAMN/src/browser/mailbrowser.cpp
+++ b/protocols/YAMN/src/browser/mailbrowser.cpp
@@ -790,8 +790,8 @@ LRESULT CALLBACK NewMailPopupProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPa
INT_PTR PluginParam = 0;
switch (msg) {
case WM_COMMAND:
- //if clicked and it's new mail popup window
- if ((HIWORD(wParam) == STN_CLICKED) && (-1 != (PluginParam = CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd, (LPARAM)&PluginParam)))) {
+ // if clicked and it's new mail popup window
+ if ((HIWORD(wParam) == STN_CLICKED) && (-1 != (PluginParam = (INT_PTR)PUGetPluginData(hWnd)))) {
MCONTACT hContact = 0;
HACCOUNT Account;
if (PluginParam) {
diff --git a/src/core/stdpopup/src/options.cpp b/src/core/stdpopup/src/options.cpp
index c30ed0635e..1bb5d199f1 100644
--- a/src/core/stdpopup/src/options.cpp
+++ b/src/core/stdpopup/src/options.cpp
@@ -429,16 +429,16 @@ static INT_PTR CALLBACK DlgProcOptsClasses(HWND hwndDlg, UINT msg, WPARAM wParam
POPUPCLASS pc = *arNewClasses[i];
pc.PluginWindowProc = nullptr;
POPUPDATACLASS d = {sizeof(d), pc.pszName};
- d.pwszTitle = L"Preview";
- d.pwszText = L"The quick brown fox jumps over the lazy dog.";
+ d.szTitle.w = L"Preview";
+ d.szText.w = L"The quick brown fox jumps over the lazy dog.";
CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
}
else {
POPUPCLASS pc = *arNewClasses[i];
pc.PluginWindowProc = nullptr;
POPUPDATACLASS d = {sizeof(d), pc.pszName};
- d.pszTitle = "Preview";
- d.pszText = "The quick brown fox jumps over the lazy dog.";
+ d.szTitle.a = "Preview";
+ d.szText.a = "The quick brown fox jumps over the lazy dog.";
CallService(MS_POPUP_ADDPOPUPCLASS, (WPARAM)&pc, (LPARAM)&d);
}
break;
diff --git a/src/core/stdpopup/src/services.cpp b/src/core/stdpopup/src/services.cpp
index f01f16e83a..ce8650f2ce 100644
--- a/src/core/stdpopup/src/services.cpp
+++ b/src/core/stdpopup/src/services.cpp
@@ -70,7 +70,7 @@ static INT_PTR CreatePopup(WPARAM wParam, LPARAM)
pd_out->timeout = pd_in->iSeconds;
lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
- if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (!Popup_Enabled()) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
mir_free(pd_out);
@@ -111,7 +111,7 @@ static INT_PTR CreatePopupW(WPARAM wParam, LPARAM)
pd_out->timeout = pd_in->iSeconds;
lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
- if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (!Popup_Enabled()) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
mir_free(pd_out);
@@ -151,7 +151,7 @@ void ShowPopup(PopupData &pd_in)
lstPopupHistory.Add(pd_out->pwzTitle, pd_out->pwzText, time(0));
- if (!db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (!Popup_Enabled()) {
mir_free(pd_out->pwzTitle);
mir_free(pd_out->pwzText);
mir_free(pd_out);
@@ -193,7 +193,7 @@ static INT_PTR GetOpaque(WPARAM wParam, LPARAM)
void UpdateMenu()
{
- bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1;
+ bool isEnabled = Popup_Enabled() == 1;
if (isEnabled) {
Menu_ModifyItem(hMenuItem, LPGENW("Disable Popups"), IcoLib_GetIcon(ICO_POPUP_ON));
Menu_ModifyItem(hMenuRoot, nullptr, IcoLib_GetIcon(ICO_POPUP_ON));
@@ -207,38 +207,10 @@ void UpdateMenu()
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)hTTButton, isEnabled ? TTBST_PUSHED : 0);
}
-INT_PTR PopupQuery(WPARAM wParam, LPARAM)
-{
- switch(wParam) {
- case PUQS_ENABLEPOPUPS:
- {
- bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0;
- if (!enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 1);
- UpdateMenu();
- return !enabled;
- }
- break;
- case PUQS_DISABLEPOPUPS:
- {
- bool enabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0;
- if (enabled) db_set_b(0, "Popup", "ModuleIsEnabled", 0);
- UpdateMenu();
- return enabled;
- }
- break;
-
- case PUQS_GETSTATUS:
- return db_get_b(0, "Popup", "ModuleIsEnabled", 1);
- default:
- UpdateMenu();
- return 1;
- }
-}
-
static INT_PTR TogglePopups(WPARAM, LPARAM)
{
- BYTE val = db_get_b(0, "Popup", "ModuleIsEnabled", 1);
- db_set_b(0, "Popup", "ModuleIsEnabled", !val);
+ BYTE val = Popup_Enabled();
+ Popup_Enable(!val);
UpdateMenu();
return 0;
}
@@ -287,7 +259,7 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam)
if (bShutdown)
return -1;
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (Popup_Enabled()) {
POPUPDATAW pd = {0};
mir_wstrcpy(pd.lpwzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
pd.lchIcon = LoadIcon(nullptr, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
@@ -302,7 +274,7 @@ static INT_PTR ShowMessageW(WPARAM wParam, LPARAM lParam)
if (bShutdown)
return -1;
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (Popup_Enabled()) {
POPUPDATAW pd = {0};
mir_wstrcpy(pd.lpwzContactName, lParam == SM_WARNING ? L"Warning" : L"Notification");
pd.lchIcon = LoadIcon(nullptr, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION);
@@ -399,8 +371,8 @@ static INT_PTR CreateClassPopup(WPARAM wParam, LPARAM lParam)
pd.hContact = pdc->hContact;
pd.opaque = pdc->PluginData;
- pd.pszTitle = (char *)pdc->pszTitle;
- pd.pszText = (char *)pdc->pszText;
+ pd.pszTitle = (char *)pdc->szTitle.a;
+ pd.pszText = (char *)pdc->szText.a;
ShowPopup(pd);
}
@@ -428,7 +400,6 @@ void InitServices()
CreateServiceFunction(MS_POPUP_CHANGEW, PopupChangeW);
CreateServiceFunction(MS_POPUP_GETCONTACT, GetContact);
CreateServiceFunction(MS_POPUP_GETPLUGINDATA, GetOpaque);
- CreateServiceFunction(MS_POPUP_QUERY, PopupQuery);
CreateServiceFunction(MS_POPUP_SHOWMESSAGE, ShowMessage);
CreateServiceFunction(MS_POPUP_SHOWMESSAGEW, ShowMessageW);
diff --git a/src/core/stdpopup/src/stdafx.h b/src/core/stdpopup/src/stdafx.h
index 0255cba2d7..6cb4378305 100644
--- a/src/core/stdpopup/src/stdafx.h
+++ b/src/core/stdpopup/src/stdafx.h
@@ -21,7 +21,7 @@
#include <m_clistint.h>
#include <m_fontservice.h>
#include <m_avatars.h>
-#include <m_popup.h>
+#include <m_popup_int.h>
#include <m_icolib.h>
#include <m_toptoolbar.h>
#include <win2k.h>
diff --git a/src/core/stdpopup/src/yapp.cpp b/src/core/stdpopup/src/yapp.cpp
index 047c33502f..b440675cf6 100644
--- a/src/core/stdpopup/src/yapp.cpp
+++ b/src/core/stdpopup/src/yapp.cpp
@@ -77,7 +77,7 @@ static int TTBLoaded(WPARAM, LPARAM)
ttb.pszService = "Popup/EnableDisableMenuCommand";
ttb.lParamUp = 1;
ttb.dwFlags = TTBBF_VISIBLE | TTBBF_SHOWTOOLTIP | TTBBF_ASPUSHBUTTON;
- if (db_get_b(0, "Popup", "ModuleIsEnabled", 1))
+ if (Popup_Enabled())
ttb.dwFlags |= TTBBF_PUSHED;
ttb.name = LPGEN("Toggle Popups");
ttb.hIconHandleUp = IcoLib_GetIconHandle(ICO_TB_POPUP_OFF);
@@ -157,7 +157,7 @@ static void InitFonts()
static void InitMenuItems(void)
{
- bool isEnabled = db_get_b(0, "Popup", "ModuleIsEnabled", 1) == 1;
+ bool isEnabled = Popup_Enabled() == 1;
hMenuRoot = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 500010000, IcoLib_GetIcon(isEnabled ? ICO_POPUP_ON : ICO_POPUP_OFF, 0));
Menu_ConfigureItem(hMenuRoot, MCI_OPT_UID, "043A641A-2767-4C57-AA57-9233D6F9DC54");
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 12e33f87eb..9762f03ee1 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -203,7 +203,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa
pd.PluginWindowProc = PopupDlgProc;
pd.PluginData = si;
- return PUAddPopupW(&pd);
+ return (INT_PTR)PUAddPopupW(&pd);
}
BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce)
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 314a530e15..26df34bbb4 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -652,3 +652,24 @@ db_mc_tryMeta @732
?setUString@PROTO_INTERFACE@@QAEXPBD0@Z @742 NONAME
?setUString@CMPluginBase@@QAEXIPBD0@Z @743 NONAME
?setUString@CMPluginBase@@QAEXPBD0@Z @744 NONAME
+?getKeyList@GCSessionInfoBase@@QAEAAU?$LIST@UUSERINFO@@@@XZ @745 NONAME
+PUAddPopup @746
+PUAddPopupW @747
+PUChangeTextW @748
+PUChangeW @749
+PUDeletePopup @750
+PUGetContact @751
+PUGetPluginData @752
+PURegisterActions @753
+PURegisterNotification @754
+PUShowMessage @755
+PUShowMessageW @756
+Popup_RegisterClass @757
+Popup_UnregisterClass @758
+ShowClassPopup @759
+ShowClassPopupW @760
+Popup_Enable @761
+Popup_Enabled @762
+Popup_AddClass @763
+Popup_Add @764
+Popup_Change @765
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index b770ff95c3..44315b8df0 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -652,3 +652,24 @@ db_mc_tryMeta @732
?setUString@PROTO_INTERFACE@@QEAAXPEBD0@Z @742 NONAME
?setUString@CMPluginBase@@QEAAXIPEBD0@Z @743 NONAME
?setUString@CMPluginBase@@QEAAXPEBD0@Z @744 NONAME
+?getKeyList@GCSessionInfoBase@@QEAAAEAU?$LIST@UUSERINFO@@@@XZ @745 NONAME
+PUAddPopup @746
+PUAddPopupW @747
+PUChangeTextW @748
+PUChangeW @749
+PUDeletePopup @750
+PUGetContact @751
+PUGetPluginData @752
+PURegisterActions @753
+PURegisterNotification @754
+PUShowMessage @755
+PUShowMessageW @756
+Popup_RegisterClass @757
+Popup_UnregisterClass @758
+ShowClassPopup @759
+ShowClassPopupW @760
+Popup_Enable @761
+Popup_Enabled @762
+Popup_AddClass @763
+Popup_Add @764
+Popup_Change @765
diff --git a/src/mir_app/src/popups.cpp b/src/mir_app/src/popups.cpp
new file mode 100644
index 0000000000..67bee51a6e
--- /dev/null
+++ b/src/mir_app/src/popups.cpp
@@ -0,0 +1,147 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (C) 2012-19 Miranda NG team (https://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "stdafx.h"
+
+MIR_APP_DLL(bool) Popup_Enabled()
+{
+ return db_get_b(0, "Popup", "ModuleIsEnabled", 1) != 0;
+}
+
+MIR_APP_DLL(void) Popup_Enable(bool bEnable)
+{
+ db_set_b(0, "Popup", "ModuleIsEnabled", bEnable);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup v2.0
+
+MIR_APP_DLL(HWND) Popup_Add(const POPUPDATA2 *ppdp, int flags)
+{
+ return (HWND)CallService(MS_POPUP_ADDPOPUP2, (WPARAM)ppdp, flags);
+}
+
+MIR_APP_DLL(void) Popup_Change(HWND hwndPopup, const POPUPDATA2 *pData)
+{
+ CallService(MS_POPUP_CHANGEPOPUP2, (WPARAM)hwndPopup, (LPARAM)pData);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popups v1.0
+
+MIR_APP_DLL(HWND) PUAddPopup(POPUPDATA *ppdp, int flags)
+{
+ return (HWND)CallService(MS_POPUP_ADDPOPUP, (WPARAM)ppdp, flags);
+}
+
+MIR_APP_DLL(HWND) PUAddPopupW(POPUPDATAW *ppdp, int flags)
+{
+ return (HWND)CallService(MS_POPUP_ADDPOPUPW, (WPARAM)ppdp, flags);
+}
+
+MIR_APP_DLL(int) PUChangeW(HWND hWndPopup, POPUPDATAW *newData)
+{
+ return (int)CallService(MS_POPUP_CHANGEW, (WPARAM)hWndPopup, (LPARAM)newData);
+}
+
+MIR_APP_DLL(int) PUChangeTextW(HWND hWndPopup, const wchar_t *lpwzNewText)
+{
+ return (int)CallService(MS_POPUP_CHANGETEXTW, (WPARAM)hWndPopup, (LPARAM)lpwzNewText);
+}
+
+MIR_APP_DLL(int) PUDeletePopup(HWND hWndPopup)
+{
+ return (int)CallService(MS_POPUP_DESTROYPOPUP, 0, (LPARAM)hWndPopup);
+}
+
+MIR_APP_DLL(MCONTACT) PUGetContact(HWND hPopupWindow)
+{
+ return (MCONTACT)CallService(MS_POPUP_GETCONTACT, (WPARAM)hPopupWindow, 0);
+}
+
+MIR_APP_DLL(void*) PUGetPluginData(HWND hPopupWindow)
+{
+ return (void*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hPopupWindow, 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Messages
+
+MIR_APP_DLL(int) PUShowMessage(const char *lpzText, DWORD kind)
+{
+ return (int)CallService(MS_POPUP_SHOWMESSAGE, (WPARAM)lpzText, (LPARAM)kind);
+}
+
+MIR_APP_DLL(int) PUShowMessageW(const wchar_t *lpwzText, DWORD kind)
+{
+ return (int)CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)lpwzText, (LPARAM)kind);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Actions
+
+MIR_APP_DLL(int) PURegisterActions(POPUPACTION *actions, int count)
+{
+ return (int)CallService(MS_POPUP_REGISTERACTIONS, (WPARAM)actions, (LPARAM)count);
+}
+
+MIR_APP_DLL(HANDLE) PURegisterNotification(LPPOPUPNOTIFICATION notification)
+{
+ return (HANDLE)CallService(MS_POPUP_REGISTERNOTIFICATION, (WPARAM)notification, 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Popup classes
+
+MIR_APP_DLL(HANDLE) Popup_RegisterClass(POPUPCLASS *pc)
+{
+ return (HANDLE)CallService(MS_POPUP_REGISTERCLASS, 0, LPARAM(pc));
+}
+
+MIR_APP_DLL(void) Popup_UnregisterClass(HANDLE ppc)
+{
+ if (ppc)
+ CallService(MS_POPUP_UNREGISTERCLASS, 0, LPARAM(ppc));
+}
+
+MIR_APP_DLL(HWND) Popup_AddClass(POPUPDATACLASS *pData)
+{
+ return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)pData);
+}
+
+MIR_APP_DLL(HWND) ShowClassPopup(const char *name, const char *title, const char *text)
+{
+ POPUPDATACLASS d = { sizeof(d), name };
+ d.szTitle.a = title;
+ d.szText.a = text;
+ return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+}
+
+MIR_APP_DLL(HWND) ShowClassPopupW(const char *name, const wchar_t *title, const wchar_t *text)
+{
+ POPUPDATACLASS d = { sizeof(d), name };
+ d.szTitle.w = title;
+ d.szText.w = text;
+ return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&d);
+}
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h
index de011d93a3..9d369695a0 100644
--- a/src/mir_app/src/stdafx.h
+++ b/src/mir_app/src/stdafx.h
@@ -60,48 +60,46 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __NO_CMPLUGIN_NEEDED
#include <win2k.h>
-#include <m_system.h>
#include <newpluginapi.h>
-#include <m_database.h>
-#include <m_db_int.h>
-#include <m_clc.h>
-#include <m_crypto.h>
-#include <m_langpack.h>
-#include <m_clistint.h>
#include <m_avatars.h>
+#include <m_awaymsg.h>
#include <m_button.h>
+#include <m_clc.h>
+#include <m_clistint.h>
+#include <m_cluiframes.h>
+#include <m_contacts.h>
+#include <m_crypto.h>
+#include <m_db_int.h>
+#include <m_extraicons.h>
+#include <m_file.h>
+#include <m_findadd.h>
+#include <m_gui.h>
+#include <m_icolib.h>
#include <m_idle.h>
-#include <m_protosvc.h>
-#include <m_protocols.h>
-#include <m_protoint.h>
+#include <m_ignore.h>
+#include <m_imgsrvc.h>
#include <m_hotkeys.h>
#include <m_fontservice.h>
+#include <m_langpack.h>
+#include <m_metacontacts.h>
+#include <m_netlib.h>
#include <m_options.h>
-#include <m_skin.h>
-#include <m_contacts.h>
#include <m_message.h>
-#include <m_userinfo.h>
-#include <m_findadd.h>
-#include <m_file.h>
-#include <m_awaymsg.h>
-#include <m_ignore.h>
-#include <m_icolib.h>
-#include <m_timezones.h>
-#include <m_extraicons.h>
-#include <m_xstatus.h>
-#include <m_cluiframes.h>
-#include <m_metacontacts.h>
-#include <m_gui.h>
+#include <m_popup_int.h>
+#include <m_protosvc.h>
+#include <m_protocols.h>
+#include <m_protoint.h>
+#include <m_skin.h>
#include <m_srmm_int.h>
-#include <m_imgsrvc.h>
+#include <m_ssl.h>
+#include <m_timezones.h>
#include <m_toptoolbar.h>
+#include <m_userinfo.h>
#include <m_version.h>
+#include <m_xstatus.h>
#include "miranda.h"
-#include <m_ssl.h>
-#include <m_netlib.h>
-
typedef struct GlobalLogSettingsBase GlobalLogSettings;
#include <m_chat_int.h>