diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-06 16:15:45 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-06 16:15:55 +0300 |
commit | f580be3d9dcccb14831d6bed9e7dfca600f5b6f8 (patch) | |
tree | 468913d477b9d2a9fb430df9a886d24a8cf41887 /plugins | |
parent | 827dbce0a554ccc313fd0b14b45bd57dffeead95 (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;
Diffstat (limited to 'plugins')
51 files changed, 158 insertions, 275 deletions
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);
}
/**
|