From d9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 5 Mar 2019 21:10:22 +0300 Subject: Popup: - wiping out checks for service presence; - code cleaning --- plugins/Alarms/src/alarmlist.cpp | 28 ++-- plugins/Alarms/src/alarms.cpp | 30 ++-- plugins/Alarms/src/options.cpp | 15 +- plugins/AvatarHistory/src/options.cpp | 14 +- plugins/AvatarHistory/src/popup.cpp | 126 +++++++------- plugins/BasicHistory/src/Options.cpp | 4 - plugins/BasicHistory/src/Scheduler.cpp | 13 +- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 4 +- plugins/BuddyExpectator/src/options.cpp | 20 +-- plugins/ChangeKeyboardLayout/src/hook_events.cpp | 26 ++- plugins/ChangeKeyboardLayout/src/options.cpp | 2 +- .../ChangeKeyboardLayout/src/text_operations.cpp | 2 +- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 43 +++-- plugins/ClientChangeNotify/src/Misc.h | 22 +-- plugins/ClientChangeNotify/src/OptDlg.cpp | 18 +- plugins/ClientChangeNotify/src/stdafx.h | 2 +- plugins/CmdLine/src/utils.cpp | 9 - plugins/CrashDumper/src/ui.cpp | 14 +- plugins/Db_autobackups/src/options.cpp | 2 +- plugins/Exchange/src/dlg_handlers.cpp | 1 - plugins/Exchange/src/emails.cpp | 2 +- plugins/MenuItemEx/src/main.cpp | 19 +-- plugins/MenuItemEx/src/options.cpp | 16 +- plugins/MirFox/src/MirandaUtils.cpp | 186 ++++++++++----------- plugins/MirLua/Modules/m_popup/src/main.cpp | 2 +- plugins/MirLua/src/utils.cpp | 3 +- plugins/MirOTR/src/options.cpp | 2 - plugins/MirOTR/src/options.h | 2 +- plugins/MirOTR/src/utils.cpp | 44 +---- plugins/MsgPopup/src/main.cpp | 16 +- plugins/NewAwaySysMod/src/Notification.cpp | 19 +-- plugins/NewEventNotify/src/options.cpp | 17 +- plugins/NewEventNotify/src/popup.cpp | 10 +- plugins/NewXstatusNotify/src/main.cpp | 5 +- plugins/NewXstatusNotify/src/options.cpp | 35 ++-- plugins/NotifyAnything/src/main.cpp | 2 +- plugins/Nudge/src/main.cpp | 32 +--- plugins/PackUpdater/Src/Notifications.cpp | 10 +- plugins/PackUpdater/Src/Options.cpp | 39 ++--- plugins/PackUpdater/Src/Utils.cpp | 10 +- plugins/Ping/src/options.cpp | 7 +- plugins/Ping/src/pingthread.cpp | 2 +- plugins/Ping/src/utils.cpp | 33 +--- plugins/PluginUpdater/src/DlgUpdate.cpp | 2 +- plugins/PluginUpdater/src/Notifications.cpp | 2 +- plugins/PluginUpdater/src/Options.cpp | 12 +- plugins/ProxySwitch/src/main.cpp | 38 ++--- plugins/ProxySwitch/src/opt.cpp | 11 +- plugins/ProxySwitch/src/stdafx.h | 2 - plugins/Scriver/src/globals.h | 1 - plugins/Scriver/src/msgoptions.cpp | 17 +- plugins/Scriver/src/msgs.cpp | 1 - plugins/SecureIM/src/commonheaders.cpp | 1 - plugins/SecureIM/src/commonheaders.h | 1 - plugins/SecureIM/src/crypt_popups.cpp | 2 - plugins/SecureIM/src/main.cpp | 9 - plugins/SecureIM/src/options.cpp | 10 +- plugins/SeenPlugin/src/options.cpp | 77 ++++----- plugins/SeenPlugin/src/utils.cpp | 3 - plugins/SendScreenshotPlus/src/Main.cpp | 1 - plugins/SendScreenshotPlus/src/dlg_msgbox.cpp | 3 +- plugins/SendScreenshotPlus/src/stdafx.h | 1 - plugins/Spamotron/src/options.cpp | 12 +- plugins/StartupSilence/src/main.cpp | 7 +- plugins/StatusManager/src/keepstatus.cpp | 2 +- plugins/StatusManager/src/ks_options.cpp | 30 ++-- plugins/TabSRMM/res/resource.rc | 1 - plugins/TabSRMM/src/chat_options.cpp | 2 +- plugins/TabSRMM/src/eventpopups.cpp | 21 +-- plugins/TabSRMM/src/globals.cpp | 5 +- plugins/TabSRMM/src/globals.h | 2 +- plugins/TabSRMM/src/msgoptions.cpp | 9 +- plugins/TabSRMM/src/resource.h | 1 - plugins/TabSRMM/src/sendlater.cpp | 12 +- plugins/TabSRMM/src/typingnotify.cpp | 159 ++++++++---------- plugins/Toaster/src/main.cpp | 4 + plugins/Toaster/src/options.cpp | 14 +- plugins/Toaster/src/services.cpp | 32 ++-- plugins/TrafficCounter/src/TrafficCounter.cpp | 5 +- plugins/TrafficCounter/src/options.cpp | 14 +- plugins/TrafficCounter/src/stdafx.h | 2 +- plugins/TranslitSwitcher/src/Layoutproc.cpp | 4 +- plugins/UserInfoEx/src/dlg_msgbox.cpp | 3 +- plugins/UserInfoEx/src/psp_options.cpp | 14 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 8 +- plugins/UserInfoEx/src/svc_reminder.cpp | 2 +- plugins/WhenWasIt/src/dlg_handlers.cpp | 10 +- plugins/WhoUsesMyFiles/src/options.cpp | 10 +- plugins/WhoUsesMyFiles/src/wumfplug.cpp | 5 - 89 files changed, 574 insertions(+), 918 deletions(-) (limited to 'plugins') diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 515383f672..14063d7a5a 100755 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -611,20 +611,18 @@ static LRESULT CALLBACK PopupAlarmDlgProc(HWND hWnd, UINT message, WPARAM wParam void ShowPopup(ALARM *alarm) { - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - ALARM *data = new ALARM; - memset(data, 0, sizeof(ALARM)); - copy_alarm_data(data, alarm); - - POPUPDATAW ppd = { 0 }; - ppd.lchIcon = hIconMenuSet; - mir_wstrncpy(ppd.lpwzContactName, data->szTitle, MAX_CONTACTNAME); - mir_wstrncpy(ppd.lpwzText, data->szDesc, MAX_SECONDLINE); - ppd.PluginWindowProc = PopupAlarmDlgProc; - ppd.PluginData = data; - ppd.iSeconds = -1; - PUAddPopupW(&ppd); - } + ALARM *data = new ALARM; + memset(data, 0, sizeof(ALARM)); + copy_alarm_data(data, alarm); + + POPUPDATAW ppd = { 0 }; + ppd.lchIcon = hIconMenuSet; + mir_wstrncpy(ppd.lpwzContactName, data->szTitle, MAX_CONTACTNAME); + mir_wstrncpy(ppd.lpwzText, data->szDesc, MAX_SECONDLINE); + ppd.PluginWindowProc = PopupAlarmDlgProc; + ppd.PluginData = data; + ppd.iSeconds = -1; + PUAddPopupW(&ppd); } void DoAlarm(ALARM *alarm) @@ -658,7 +656,7 @@ void DoAlarm(ALARM *alarm) } if (alarm->action & AAF_POPUP) { - if (options.use_popup_module && ServiceExists(MS_POPUP_ADDPOPUPW)) + if (options.use_popup_module) ShowPopup(alarm); else { HWND hwndDlg = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ALARM), GetDesktopWindow(), DlgProcAlarm); diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index d75f9688c4..3985bd50fc 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -60,23 +60,19 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA void ShowPopup(MCONTACT hContact, const wchar_t *msg) { - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - wchar_t *lpzContactName = Clist_GetContactDisplayName(hContact); - - POPUPDATAW ppd = { 0 }; - ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked. - ppd.lchIcon = hIconList1; - mir_wstrncpy(ppd.lpwzContactName, lpzContactName, MAX_CONTACTNAME); - mir_wstrncpy(ppd.lpwzText, msg, MAX_SECONDLINE); - ppd.colorBack = GetSysColor(COLOR_BTNFACE); - ppd.colorText = RGB(0, 0, 0); - ppd.PluginWindowProc = PopupDlgProc; - ppd.PluginData = nullptr; - ppd.iSeconds = 3; - - // Now that every field has been filled, we want to see the popup. - PUAddPopupW(&ppd); - } + wchar_t *lpzContactName = Clist_GetContactDisplayName(hContact); + + POPUPDATAW ppd = { 0 }; + ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked. + ppd.lchIcon = hIconList1; + mir_wstrncpy(ppd.lpwzContactName, lpzContactName, MAX_CONTACTNAME); + mir_wstrncpy(ppd.lpwzText, msg, MAX_SECONDLINE); + ppd.colorBack = GetSysColor(COLOR_BTNFACE); + ppd.colorText = RGB(0, 0, 0); + ppd.PluginWindowProc = PopupDlgProc; + ppd.PluginData = nullptr; + ppd.iSeconds = 3; + PUAddPopupW(&ppd); } HBITMAP LoadBmpFromIcon(int IdRes) diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index 387275294a..177dd5a2af 100755 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -941,17 +941,10 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg, IDC_DEL), FALSE); } - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - CheckDlgButton(hwndDlg, IDC_CHK_POPUPS, temp_options.use_popup_module ? BST_CHECKED : BST_UNCHECKED); - if (options.use_popup_module) - bChecked = FALSE; - else { - CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? BST_CHECKED : BST_UNCHECKED); - bChecked = TRUE; - } - } + CheckDlgButton(hwndDlg, IDC_CHK_POPUPS, temp_options.use_popup_module ? BST_CHECKED : BST_UNCHECKED); + if (options.use_popup_module) + bChecked = FALSE; else { - EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_POPUPS), FALSE); CheckDlgButton(hwndDlg, IDC_CHK_LOOPSOUND, temp_options.loop_sound ? BST_CHECKED : BST_UNCHECKED); bChecked = TRUE; } @@ -1179,7 +1172,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int reminder_period = GetDlgItemInt(hwndDlg, IDC_ED_PERIOD, &translated, FALSE); if (translated) temp_options.reminder_period = reminder_period; - if (!ServiceExists(MS_POPUP_ADDPOPUPW) || !options.use_popup_module) + if (!options.use_popup_module) temp_options.loop_sound = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOOPSOUND) ? true : false; options = temp_options; diff --git a/plugins/AvatarHistory/src/options.cpp b/plugins/AvatarHistory/src/options.cpp index e0ee99b963..d3a93e1fe3 100644 --- a/plugins/AvatarHistory/src/options.cpp +++ b/plugins/AvatarHistory/src/options.cpp @@ -154,14 +154,12 @@ int OptInit(WPARAM wParam, LPARAM) odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; g_plugin.addOptions(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.szGroup.w = LPGENW("Popups"); - odp.szTitle.w = LPGENW("Avatar change"); - odp.pfnDlgProc = PopupsDlgProc; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS); - odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; - g_plugin.addOptions(wParam, &odp); - } + odp.szGroup.w = LPGENW("Popups"); + odp.szTitle.w = LPGENW("Avatar change"); + odp.pfnDlgProc = PopupsDlgProc; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS); + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp index e45c2aa43b..29c33cfa7e 100644 --- a/plugins/AvatarHistory/src/popup.cpp +++ b/plugins/AvatarHistory/src/popup.cpp @@ -90,81 +90,75 @@ PopupDataType; void ShowPopupEx(MCONTACT hContact, const wchar_t *title, const wchar_t *description, void *plugin_data, int type, const Options *op) { - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - // Make popup - POPUPDATAW ppd = { 0 }; - - ppd.lchContact = hContact; - ppd.lchIcon = createProtoOverlayedIcon(hContact); - - ppd.PluginData = mir_alloc(sizeof(PopupDataType)); - ((PopupDataType*)ppd.PluginData)->plugin_data = plugin_data; - ((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon; - - if (title != nullptr) - mir_wstrncpy(ppd.lpwzContactName, title, _countof(ppd.lpwzContactName)); - else if (hContact != NULL) - mir_wstrncpy(ppd.lpwzContactName, Clist_GetContactDisplayName(hContact), _countof(ppd.lpwzContactName)); - - if (description != nullptr) - mir_wstrncpy(ppd.lpwzText, description, _countof(ppd.lpwzText)); - - if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST) { - if (op->popup_use_default_colors) { - ppd.colorBack = 0; - ppd.colorText = 0; - } - else if (op->popup_use_win_colors) { - ppd.colorBack = GetSysColor(COLOR_BTNFACE); - ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); - } - else { - ppd.colorBack = op->popup_bkg_color; - ppd.colorText = op->popup_text_color; - } - } - else // if (type == POPUP_TYPE_ERROR) - { - ppd.colorBack = RGB(200, 0, 0); - ppd.colorText = RGB(255, 255, 255); - } + // Make popup + POPUPDATAW ppd = { 0 }; + + ppd.lchContact = hContact; + ppd.lchIcon = createProtoOverlayedIcon(hContact); + + ppd.PluginData = mir_alloc(sizeof(PopupDataType)); + ((PopupDataType*)ppd.PluginData)->plugin_data = plugin_data; + ((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon; - if (type == POPUP_TYPE_NORMAL) { - ppd.PluginWindowProc = PopupDlgProc; + if (title != nullptr) + mir_wstrncpy(ppd.lpwzContactName, title, _countof(ppd.lpwzContactName)); + else if (hContact != NULL) + mir_wstrncpy(ppd.lpwzContactName, Clist_GetContactDisplayName(hContact), _countof(ppd.lpwzContactName)); + + if (description != nullptr) + mir_wstrncpy(ppd.lpwzText, description, _countof(ppd.lpwzText)); + + if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST) { + if (op->popup_use_default_colors) { + ppd.colorBack = 0; + ppd.colorText = 0; } - else // if (type == POPUP_TYPE_TEST || type == POPUP_TYPE_ERROR) - { - ppd.PluginWindowProc = DumbPopupDlgProc; + else if (op->popup_use_win_colors) { + ppd.colorBack = GetSysColor(COLOR_BTNFACE); + ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); } - - if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST) { - switch (op->popup_delay_type) { - case POPUP_DELAY_CUSTOM: - ppd.iSeconds = opts.popup_timeout; - break; - - case POPUP_DELAY_PERMANENT: - ppd.iSeconds = -1; - break; - - case POPUP_DELAY_DEFAULT: - default: - ppd.iSeconds = 0; - break; - } + else { + ppd.colorBack = op->popup_bkg_color; + ppd.colorText = op->popup_text_color; } - else // if (type == POPUP_TYPE_ERROR) - { + } + else // if (type == POPUP_TYPE_ERROR) + { + ppd.colorBack = RGB(200, 0, 0); + ppd.colorText = RGB(255, 255, 255); + } + + if (type == POPUP_TYPE_NORMAL) { + ppd.PluginWindowProc = PopupDlgProc; + } + else // if (type == POPUP_TYPE_TEST || type == POPUP_TYPE_ERROR) + { + ppd.PluginWindowProc = DumbPopupDlgProc; + } + + if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST) { + switch (op->popup_delay_type) { + case POPUP_DELAY_CUSTOM: + ppd.iSeconds = opts.popup_timeout; + break; + + case POPUP_DELAY_PERMANENT: + ppd.iSeconds = -1; + break; + + case POPUP_DELAY_DEFAULT: + default: ppd.iSeconds = 0; + break; } - - // Now that every field has been filled, we want to see the popup. - PUAddPopupW(&ppd); } - else { - MessageBox(nullptr, description, title ? title : Clist_GetContactDisplayName(hContact), MB_OK); + else // if (type == POPUP_TYPE_ERROR) + { + ppd.iSeconds = 0; } + // Now that every field has been filled, we want to see the popup. + PUAddPopupW(&ppd); } diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 82fe319919..8e97f38438 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -21,7 +21,6 @@ along with this program. If not, see . #include "resource.h" extern bool g_SmileyAddAvail; -extern bool bPopupsEnabled; Options *Options::instance; @@ -1431,9 +1430,6 @@ INT_PTR CALLBACK Options::DlgProcOptsScheduler(HWND hwndDlg, UINT msg, WPARAM wP for (std::list::iterator it = tasks->begin(); it != tasks->end(); ++it) ListBox_AddString(listTasks, it->taskName.c_str()); - if (!bPopupsEnabled) - EnableWindow(GetDlgItem(hwndDlg, IDC_SCHEDULER_ALERTS), FALSE); - CheckDlgButton(hwndDlg, IDC_SCHEDULER_ALERTS, instance->schedulerAlerts ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SCHEDULER_HISTORY_ALERTS, instance->schedulerHistoryAlerts ? BST_CHECKED : BST_UNCHECKED); diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 9a6ceaee02..a080d18e0e 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -21,7 +21,6 @@ along with this program. If not, see . #include "ExportManager.h" #include "HistoryWindow.h" -bool bPopupsEnabled; bool DoTask(TaskOptions& to); bool IsValidTask(TaskOptions& to, std::list* top = nullptr, std::wstring* err = nullptr, std::wstring* errDescr = nullptr); std::wstring GetFileName(const std::wstring &baseName, std::wstring contactName, std::map& existingContacts, bool replaceContact); @@ -65,8 +64,6 @@ static int OnShutdown(WPARAM, LPARAM) void InitScheduler() { - bPopupsEnabled = ServiceExists(MS_POPUP_ADDPOPUPW) || ServiceExists(MS_POPUP_ADDPOPUPCLASS); - POPUPCLASS test = { sizeof(test) }; test.flags = PCF_UNICODE; test.hIcon = Skin_LoadIcon(SKINICON_OTHER_HISTORY); @@ -1297,14 +1294,6 @@ void DoError(const TaskOptions& to, const std::wstring _error) if (Miranda_IsTerminated()) return; - if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) - ShowClassPopupW(MODULENAME, msg, _error.c_str()); - else if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - POPUPDATAW ppd = { 0 }; - ppd.lchIcon = Skin_LoadIcon(SKINICON_OTHER_HISTORY); - wcscpy_s(ppd.lpwzContactName, msg); - wcscpy_s(ppd.lpwzText, _error.c_str()); - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, 0); - } + ShowClassPopupW(MODULENAME, msg, _error.c_str()); } } diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 03e7537982..57b73cecbc 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -243,7 +243,7 @@ bool isContactGoneFor(MCONTACT hContact, int days) ppd.lpActions = hideactions; ppd.actionCount = 2; - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, APF_NEWDATA); + PUAddPopupW(&ppd, APF_NEWDATA); Skin_PlaySound("buddyExpectatorHide"); } @@ -497,7 +497,7 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) ppd.lpActions = missyouactions; ppd.actionCount = 1; - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, APF_NEWDATA); + PUAddPopupW(&ppd, APF_NEWDATA); Skin_PlaySound("buddyExpectatorMissYou"); } diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index 48d768140b..96e2dd0856 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -94,10 +94,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - if (!ServiceExists(MS_POPUP_ADDPOPUPW)) - EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_POPUP), FALSE); - - //iAbsencePeriod + // iAbsencePeriod SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD, CB_ADDSTRING, 0, (LPARAM)TranslateT("days")); SendDlgItemMessage(hwndDlg, IDC_COMBO_PERIOD, CB_ADDSTRING, 0, (LPARAM)TranslateT("weeks")); @@ -344,12 +341,12 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP ppd.PluginData = nullptr; ppd.iSeconds = options.iPopupDelay; - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, APF_NO_HISTORY); + PUAddPopupW(&ppd, APF_NO_HISTORY); wcsncpy(ppd.lpwzText, TranslateT("You awaited this contact!"), MAX_SECONDLINE); ppd.lchIcon = IcoLib_GetIcon("enabled_icon"); - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, APF_NO_HISTORY); + PUAddPopupW(&ppd, APF_NO_HISTORY); } else { if ((HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == CBN_SELCHANGE) || ((HIWORD(wParam) == EN_CHANGE) && !ChangeLock)) @@ -439,13 +436,10 @@ int OptionsInit(WPARAM wParam, LPARAM) odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; g_plugin.addOptions(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.szGroup.w = LPGENW("Popups"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPPANEL); - odp.pfnDlgProc = PopupOptionsFrameProc; - g_plugin.addOptions(wParam, &odp); - } - + odp.szGroup.w = LPGENW("Popups"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPPANEL); + odp.pfnDlgProc = PopupOptionsFrameProc; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index 7f8ef8a952..9cdf91d010 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -74,15 +74,13 @@ void WritePopupOptions() void RegPopupActions() { - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - poOptions.paActions[0].cbSize = sizeof(POPUPACTION); - strncpy_s(poOptions.paActions[0].lpzTitle, MODULENAME, _TRUNCATE); - strncat_s(poOptions.paActions[0].lpzTitle, _countof(poOptions.paActions[0].lpzTitle), "/Copy to clipboard", _TRUNCATE); - 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); - } + poOptions.paActions[0].cbSize = sizeof(POPUPACTION); + strncpy_s(poOptions.paActions[0].lpzTitle, MODULENAME, _TRUNCATE); + strncat_s(poOptions.paActions[0].lpzTitle, _countof(poOptions.paActions[0].lpzTitle), "/Copy to clipboard", _TRUNCATE); + 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); } int OnIconsChanged(WPARAM, LPARAM) @@ -148,12 +146,10 @@ int OnOptionsInitialise(WPARAM wParam, LPARAM) odp.pfnDlgProc = DlgMainProcOptions; g_plugin.addOptions(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP_OPTION_FORM); - odp.szGroup.a = LPGEN("Popups"); - odp.pfnDlgProc = DlgPopupsProcOptions; - g_plugin.addOptions(wParam, &odp); - } + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP_OPTION_FORM); + odp.szGroup.a = LPGEN("Popups"); + odp.pfnDlgProc = DlgPopupsProcOptions; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index 32261377bd..a8a4e11be5 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -390,7 +390,7 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, pdtData.actionCount = 1; pdtData.PluginWindowProc = (WNDPROC)CKLPopupDlgProc; - if ( CallService(MS_POPUP_ADDPOPUPW, (WPARAM) &pdtData, APF_NEWDATA) < 0) + if (PUAddPopupW( &pdtData, APF_NEWDATA) < 0) mir_free(ptszPopupPreviewText); } break; diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index ae0f47645f..d1d2d05a65 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -486,7 +486,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) pdtData.lpActions = poOptions.paActions; pdtData.actionCount = 1; - if (CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pdtData, APF_NEWDATA) < 0) { + if (PUAddPopupW(&pdtData, APF_NEWDATA) < 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 3c9bd66d4f..e209a877ca 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -24,7 +24,7 @@ HGENMENU g_hTogglePopupsMenuItem; CMPlugin g_plugin; COptPage *g_PreviewOptPage; // we need to show popup even for the NULL contact if g_PreviewOptPage is not NULL (used for popup preview) -BOOL bPopupExists = FALSE, bFingerprintExists = FALSE, bVariablesExists = FALSE; +BOOL bFingerprintExists = FALSE, bVariablesExists = FALSE; ///////////////////////////////////////////////////////////////////////////////////////// @@ -268,12 +268,10 @@ static INT_PTR srvTogglePopups(WPARAM, LPARAM) static int PrebuildMainMenu(WPARAM, LPARAM) { // we have to use ME_CLIST_PREBUILDMAINMENU instead of updating menu items only on settings change, because "popup_enabled" and "popup_disabled" icons are not always available yet in ModulesLoaded - if (bPopupExists) { - if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) - Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENW("Disable c&lient change notification"), IcoLib_GetIcon("popup_enabled")); - else - Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENW("Enable c&lient change notification"), IcoLib_GetIcon("popup_disabled")); - } + if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) + Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENW("Disable c&lient change notification"), IcoLib_GetIcon("popup_enabled")); + else + Menu_ModifyItem(g_hTogglePopupsMenuItem, LPGENW("Enable c&lient change notification"), IcoLib_GetIcon("popup_disabled")); return 0; } @@ -301,7 +299,6 @@ INT_PTR CALLBACK CCNErrorDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM) static int ModuleLoad(WPARAM, LPARAM) { - bPopupExists = ServiceExists(MS_POPUP_ADDPOPUPW); bFingerprintExists = ServiceExists(MS_FP_SAMECLIENTST) && ServiceExists(MS_FP_GETCLIENTICONT); bVariablesExists = ServiceExists(MS_VARS_FORMATSTRING); return 0; @@ -316,22 +313,20 @@ static int MirandaLoaded(WPARAM, LPARAM) g_plugin.addSound(CLIENTCHANGED_SOUND, nullptr, LPGENW("ClientChangeNotify: Client changed")); - if (bPopupExists) { - CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups); - HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu); - - CMenuItem mi(&g_plugin); - SET_UID(mi, 0xfabb9181, 0xdb92, 0x43f4, 0x86, 0x40, 0xca, 0xb6, 0x4c, 0x93, 0x34, 0x27); - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); - mi.flags = CMIF_UNICODE; - if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) - mi.name.w = LPGENW("Disable c&lient change notification"); - else - mi.name.w = LPGENW("Enable c&lient change notification"); - - mi.pszService = MS_CCN_TOGGLEPOPUPS; - g_hTogglePopupsMenuItem = Menu_AddMainMenuItem(&mi); - } + CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups); + HookEvent(ME_CLIST_PREBUILDMAINMENU, PrebuildMainMenu); + + CMenuItem mi(&g_plugin); + SET_UID(mi, 0xfabb9181, 0xdb92, 0x43f4, 0x86, 0x40, 0xca, 0xb6, 0x4c, 0x93, 0x34, 0x27); + mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); + mi.flags = CMIF_UNICODE; + if (g_PopupOptPage.GetDBValueCopy(IDC_POPUPOPTDLG_POPUPNOTIFY)) + mi.name.w = LPGENW("Disable c&lient change notification"); + else + mi.name.w = LPGENW("Enable c&lient change notification"); + + mi.pszService = MS_CCN_TOGGLEPOPUPS; + g_hTogglePopupsMenuItem = Menu_AddMainMenuItem(&mi); // seems that Fingerprint is not installed if (!bFingerprintExists && !g_plugin.getByte(DB_NO_FINGERPRINT_ERROR, 0)) diff --git a/plugins/ClientChangeNotify/src/Misc.h b/plugins/ClientChangeNotify/src/Misc.h index ccd6df194e..4b08bf9dab 100644 --- a/plugins/ClientChangeNotify/src/Misc.h +++ b/plugins/ClientChangeNotify/src/Misc.h @@ -20,23 +20,17 @@ #pragma once #include "stdafx.h" -extern BOOL bPopupExists; __inline void ShowMsg(wchar_t *FirstLine, wchar_t *SecondLine = L"", bool IsErrorMsg = false, int Timeout = 0) { - if (bPopupExists) { - POPUPDATAW ppd = { 0 }; - ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION); - mir_wstrcpy(ppd.lpwzContactName, FirstLine); - mir_wstrcpy(ppd.lpwzText, SecondLine); - ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD; - ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000; - ppd.iSeconds = Timeout; - PUAddPopupW(&ppd); - } - else { - MessageBox(NULL, SecondLine, FirstLine, MB_OK | (IsErrorMsg ? MB_ICONEXCLAMATION : MB_ICONINFORMATION)); - } + POPUPDATAW ppd = { 0 }; + ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION); + mir_wstrcpy(ppd.lpwzContactName, FirstLine); + mir_wstrcpy(ppd.lpwzText, SecondLine); + ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD; + ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000; + ppd.iSeconds = Timeout; + PUAddPopupW(&ppd); } __inline void ShowLog(TCString &LogFilePath) diff --git a/plugins/ClientChangeNotify/src/OptDlg.cpp b/plugins/ClientChangeNotify/src/OptDlg.cpp index 5c6dfc3e99..536334e4a4 100644 --- a/plugins/ClientChangeNotify/src/OptDlg.cpp +++ b/plugins/ClientChangeNotify/src/OptDlg.cpp @@ -160,16 +160,14 @@ INT_PTR CALLBACK PopupOptDlg(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara int OptionsDlgInit(WPARAM wParam, LPARAM) { - if (bPopupExists) { - OPTIONSDIALOGPAGE optDi = {}; - optDi.position = 920000000; - optDi.szGroup.a = LPGEN("Popups"); - optDi.szTitle.a = LPGEN("ClientChangeNotify"); - optDi.pfnDlgProc = PopupOptDlg; - optDi.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPOPTDLG); - optDi.flags = ODPF_BOLDGROUPS; - g_plugin.addOptions(wParam, &optDi); - } + OPTIONSDIALOGPAGE optDi = {}; + optDi.position = 920000000; + optDi.szGroup.a = LPGEN("Popups"); + optDi.szTitle.a = LPGEN("ClientChangeNotify"); + optDi.pfnDlgProc = PopupOptDlg; + optDi.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPOPTDLG); + optDi.flags = ODPF_BOLDGROUPS; + g_plugin.addOptions(wParam, &optDi); return 0; } diff --git a/plugins/ClientChangeNotify/src/stdafx.h b/plugins/ClientChangeNotify/src/stdafx.h index 7a95b54140..676c1bbeaf 100644 --- a/plugins/ClientChangeNotify/src/stdafx.h +++ b/plugins/ClientChangeNotify/src/stdafx.h @@ -110,7 +110,7 @@ struct CMPlugin : public PLUGIN #define CLIENTCHANGED_SOUND "ClientChanged" -extern BOOL bPopupExists, bFingerprintExists; +extern BOOL bFingerprintExists; extern COptPage g_PopupOptPage; extern COptPage *g_PreviewOptPage; diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index c4b742db8b..e877aa6477 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -34,15 +34,6 @@ int Info(char *title, char *format, ...) return MessageBoxA(nullptr, str, title, MB_OK | MB_ICONINFORMATION); } -int MyPUShowMessage(char *lpzText, BYTE kind) -{ - if (ServiceExists(MS_POPUP_SHOWMESSAGE)) - return PUShowMessage(lpzText, kind); - - char *title = (kind == SM_NOTIFY) ? Translate("Notify") : Translate("Warning"); - return MessageBoxA(nullptr, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION); -} - #define HEX_SIZE 8 char *BinToHex(int size, PBYTE data) diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index 390d0af67e..01e9c52a7d 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -316,13 +316,9 @@ void ShowMessage(int type, const wchar_t *format, ...) pi.lpwzText[len] = 0; va_end(va); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - mir_wstrcpy(pi.lpwzContactName, _A2W(MODULENAME)); - pi.lchIcon = LoadIconEx(IDI_VI); - pi.PluginWindowProc = DlgProcPopup; - pi.PluginData = (void*)type; - - PUAddPopupW(&pi); - } - else MessageBox(nullptr, pi.lpwzText, _A2W(MODULENAME), MB_OK | MB_ICONINFORMATION); + mir_wstrcpy(pi.lpwzContactName, _A2W(MODULENAME)); + pi.lchIcon = LoadIconEx(IDI_VI); + pi.PluginWindowProc = DlgProcPopup; + pi.PluginData = (void*)type; + PUAddPopupW(&pi); } diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 0365fc5393..760ed9832a 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -194,7 +194,7 @@ public: CreateToolTip(tszTooltipText, TranslateT("Variables")); } - m_disablePopups.Show(ServiceExists(MS_POPUP_ADDPOPUPW)); + m_disablePopups.Show(); m_useCloudFile.Enable(ServiceExists(MS_CLOUDFILE_UPLOAD)); if (ServiceExists(MS_CLOUDFILE_ENUMSERVICES)) { diff --git a/plugins/Exchange/src/dlg_handlers.cpp b/plugins/Exchange/src/dlg_handlers.cpp index 0b084374cc..c3b3858326 100644 --- a/plugins/Exchange/src/dlg_handlers.cpp +++ b/plugins/Exchange/src/dlg_handlers.cpp @@ -58,7 +58,6 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara SetDlgItemInt(hWnd, IDC_RECONNECT_INTERVAL, g_plugin.getDword("ReconnectInterval", DEFAULT_RECONNECT_INTERVAL), FALSE); CheckDlgButton(hWnd, IDC_USE_POPUPS, (BOOL)g_plugin.getByte("UsePopups", 0) ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), ServiceExists(MS_POPUP_ADDPOPUPW)); //disable the popups checkbox if no popup module is present CheckDlgButton(hWnd, IDC_CHECK_EMAILS, (bCheck) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hWnd, IDC_INTERVAL_EDIT), bCheck); diff --git a/plugins/Exchange/src/emails.cpp b/plugins/Exchange/src/emails.cpp index 58d0459db6..993e1ccc88 100644 --- a/plugins/Exchange/src/emails.cpp +++ b/plugins/Exchange/src/emails.cpp @@ -294,7 +294,7 @@ int CExchangeServer::Check(int bNoEmailsNotify) int ShowMessage(wchar_t *message, int cUnreadEmails) { - int usePopups = ServiceExists(MS_POPUP_ADDPOPUPW) ? g_plugin.getByte("UsePopups", 0) : 0; + int usePopups = g_plugin.getByte("UsePopups", 0); if (usePopups) return ShowPopupMessage(TranslateT("Exchange email"), message, cUnreadEmails); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index b96e3cdd2b..a988fb13ef 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -18,7 +18,6 @@ HGENMENU hmenuVis, hmenuOff, hmenuHide, hmenuIgnore, hmenuProto; HGENMENU hmenuCopyID, hmenuRecvFiles, hmenuStatusMsg, hmenuCopyIP, hmenuCopyMirVer; static HGENMENU hIgnoreItem[9], hProtoItem[MAX_PROTOS]; HICON hIcons[5]; -BOOL bPopupService = FALSE; PROTOACCOUNT **accs; int protoCount; CMPlugin g_plugin; @@ -514,7 +513,7 @@ static INT_PTR onCopyID(WPARAM hContact, LPARAM) else wcsncpy_s(buffer, szID, _TRUNCATE); CopyToClipboard(buffer); - if (CTRL_IS_PRESSED && bPopupService) + if (CTRL_IS_PRESSED) ShowPopup(buffer, hContact); return 0; @@ -550,7 +549,7 @@ static INT_PTR onCopyStatusMsg(WPARAM hContact, LPARAM) } CopyToClipboard(wszBuffer); - if (CTRL_IS_PRESSED && bPopupService) + if (CTRL_IS_PRESSED) ShowPopup(wszBuffer, hContact); return 0; @@ -570,7 +569,7 @@ static INT_PTR onCopyIP(WPARAM hContact, LPARAM) wszBuffer.AppendFormat(L"Internal IP: %d.%d.%d.%d\r\n", rIP >> 24, (rIP >> 16) & 0xFF, (rIP >> 8) & 0xFF, rIP & 0xFF); CopyToClipboard(wszBuffer); - if (CTRL_IS_PRESSED && bPopupService) + if (CTRL_IS_PRESSED) ShowPopup(wszBuffer, hContact); return 0; @@ -581,7 +580,7 @@ static INT_PTR onCopyMirVer(WPARAM hContact, LPARAM) LPWSTR msg = getMirVer(hContact); if (msg) { CopyToClipboard(msg); - if (CTRL_IS_PRESSED && bPopupService) + if (CTRL_IS_PRESSED) ShowPopup(msg, hContact); mir_free(msg); @@ -844,19 +843,11 @@ static int ContactWindowOpen(WPARAM, LPARAM lParam) return 0; } -static int ModuleLoad(WPARAM, LPARAM) -{ - bPopupService = ServiceExists(MS_POPUP_ADDPOPUPW); - return 0; -} - // called when all modules are loaded static int PluginInit(WPARAM, LPARAM) { int pos = 1000; - ModuleLoad(0, 0); - CMenuItem mi(&g_plugin); mi.flags = CMIF_UNICODE; @@ -967,8 +958,6 @@ int CMPlugin::Load() CreateServiceFunction(MS_OPENIGNORE, OpenIgnoreOptions); HookEvent(ME_SYSTEM_MODULESLOADED, PluginInit); - HookEvent(ME_SYSTEM_MODULELOAD, ModuleLoad); - HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, BuildMenu); HookEvent(ME_OPT_INITIALISE, OptionsInit); HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtoSubmenu); diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp index 2fc76947a7..203ee9669d 100644 --- a/plugins/MenuItemEx/src/options.cpp +++ b/plugins/MenuItemEx/src/options.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" -extern BOOL bPopupService; - struct { int idc; int flag; @@ -78,16 +76,12 @@ public: item.SetState(m_flags & it.flag); } - if (bPopupService) { - for (int i = 0; i < 4; i++) { - CCtrlCheck &item = *(CCtrlCheck*)FindControl(checkboxes[i].idc); - CMStringW buffer; - buffer.Format(L"%s *", item.GetText()); - item.SetText(buffer); - } + for (int i = 0; i < 4; i++) { + CCtrlCheck &item = *(CCtrlCheck*)FindControl(checkboxes[i].idc); + CMStringW buffer; + buffer.Format(L"%s *", item.GetText()); + item.SetText(buffer); } - else - m_lblHint.Hide(); EnableWindowChecks(); return true; diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index 5f829db480..61db5b1b9f 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -6,7 +6,7 @@ // private constructor MirandaUtils::MirandaUtils() - : logger(MFLogger::getInstance()) + : logger(MFLogger::getInstance()) { netlibHandle = nullptr; @@ -14,11 +14,11 @@ MirandaUtils::MirandaUtils() } -void MirandaUtils::netlibLog(const wchar_t* szText){ +void MirandaUtils::netlibLog(const wchar_t* szText) { MirandaUtils::getInstance()->netlibLog_int(szText); } -void MirandaUtils::netlibLog_int(const wchar_t* szText){ +void MirandaUtils::netlibLog_int(const wchar_t* szText) { if (netlibHandle) { Netlib_LogfW(netlibHandle, szText); } @@ -27,7 +27,7 @@ void MirandaUtils::netlibLog_int(const wchar_t* szText){ #endif //_DEBUG } -void MirandaUtils::netlibRegister(){ +void MirandaUtils::netlibRegister() { // Register netlib user for logging function NETLIBUSER nlu = {}; nlu.flags = NUF_UNICODE | NUF_NOOPTIONS; @@ -37,7 +37,7 @@ void MirandaUtils::netlibRegister(){ netlibHandle = Netlib_RegisterUser(&nlu); } -void MirandaUtils::netlibUnregister(){ +void MirandaUtils::netlibUnregister() { Netlib_CloseHandle(netlibHandle); netlibHandle = nullptr; } @@ -45,12 +45,12 @@ void MirandaUtils::netlibUnregister(){ std::wstring& MirandaUtils::getProfileName() { - if (profileName.size()>0){ + if (profileName.size() > 0) { //profileName is now inited return profileName; } - - wchar_t mirandaProfileNameW[128] = {0}; + + wchar_t mirandaProfileNameW[128] = { 0 }; Profile_GetNameW(_countof(mirandaProfileNameW), mirandaProfileNameW); profileName.append(mirandaProfileNameW); @@ -60,7 +60,7 @@ std::wstring& MirandaUtils::getProfileName() std::wstring& MirandaUtils::getDisplayName() { - if (displayName.size()>0){ + if (displayName.size() > 0) { //displayName is now inited return displayName; } @@ -82,24 +82,26 @@ void MirandaUtils::userActionThread(void* threadArg) Thread_Push(nullptr); ActionThreadArgStruct* actionThreadArgPtr = (ActionThreadArgStruct*)threadArg; - if (actionThreadArgPtr->mirfoxDataPtr == nullptr){ + if (actionThreadArgPtr->mirfoxDataPtr == nullptr) { MFLogger::getInstance()->log(L"MirandaUtils::userActionThread: ERROR mirfoxDataPtr == NULL"); return; } - if (actionThreadArgPtr->mirfoxDataPtr->Plugin_Terminated){ + if (actionThreadArgPtr->mirfoxDataPtr->Plugin_Terminated) { MFLogger::getInstance()->log(L"MirandaUtils::userActionThread: Plugin_Terminated return"); return; } actionThreadArgPtr->mirfoxDataPtr->workerThreadsCount++; - if (actionThreadArgPtr->menuItemType == 'C'){ + if (actionThreadArgPtr->menuItemType == 'C') { actionThreadArgPtr->instancePtr->sendMessageToContact(actionThreadArgPtr); - } else if (actionThreadArgPtr->menuItemType == 'A'){ + } + else if (actionThreadArgPtr->menuItemType == 'A') { actionThreadArgPtr->instancePtr->setStatusOnAccount(actionThreadArgPtr); delete actionThreadArgPtr->accountSzModuleName; - } else { + } + else { MFLogger::getInstance()->log(TEXT("MirandaUtils::userActionThread: ERROR: unknown actionThreadArgPtr->menuItemType")); } @@ -114,25 +116,27 @@ void MirandaUtils::sendMessageToContact(ActionThreadArgStruct* args) { logger->log(L"MirandaUtils::sendMessageToContact: start"); - if (args->targetHandle == nullptr){ + if (args->targetHandle == nullptr) { logger->log(L"MirandaUtils::sendMessageToContact: ERROR targetHandle == NULL"); return; } - if (args->userButton == 'R'){ //'R'ight mouse button + if (args->userButton == 'R') { //'R'ight mouse button this->sendMessage(args, args->mirfoxDataPtr->rightClickSendMode); - } else if (args->userButton == 'M'){ //'M'iddle mouse button + } + else if (args->userButton == 'M') { //'M'iddle mouse button this->sendMessage(args, args->mirfoxDataPtr->middleClickSendMode); - } else { //'L'eft mouse button + } + else { //'L'eft mouse button this->sendMessage(args, args->mirfoxDataPtr->leftClickSendMode); } } void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_MODE mode) { - logger->log_p(L"MirandaUtils::sendMessage: mode = [%d] to = [" SCNuPTR L"] msg = [%s]", mode, args->targetHandle, args->userActionSelection ); + logger->log_p(L"MirandaUtils::sendMessage: mode = [%d] to = [" SCNuPTR L"] msg = [%s]", mode, args->targetHandle, args->userActionSelection); - if (mode == MFENUM_SMM_ONLY_SEND || mode == MFENUM_SMM_SEND_AND_SHOW_MW){ + if (mode == MFENUM_SMM_ONLY_SEND || mode == MFENUM_SMM_SEND_AND_SHOW_MW) { //TODO - metacontacts support - C:\MIRANDA\SOURCES\PLUGINS\popup_trunk\src\popup_wnd2.cpp : 1083 // //check for MetaContact and get szProto from subcontact @@ -143,7 +147,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ // } char *targetHandleSzProto = GetContactProto((UINT_PTR)args->targetHandle); //targetHandleSzProto doesnt need mir_free or delete - if (targetHandleSzProto == nullptr){ + if (targetHandleSzProto == nullptr) { logger->log(L"MirandaUtils::sendMessageToContact: ERROR targetHandleSzProto == NULL"); return; } @@ -157,7 +161,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ MIRFOXACKDATA* myMfAck = nullptr; - if (hProcess != nullptr){ + if (hProcess != nullptr) { //if hProcess of sending process is null there will not be any ack EnterCriticalSection(&ackMapCs); @@ -174,7 +178,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ EnterCriticalSection(&ackMapCs); myMfAck = ackMap[hProcess]; LeaveCriticalSection(&ackMapCs); - if(Miranda_IsTerminated() || args->mirfoxDataPtr->Plugin_Terminated){ + if (Miranda_IsTerminated() || args->mirfoxDataPtr->Plugin_Terminated) { logger->log_p(L"SMTC: ACK break by Plugin_Terminated (=%d) or Miranda_IsTerminated()", args->mirfoxDataPtr->Plugin_Terminated); break; } @@ -186,36 +190,32 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ MirandaContact* mirandaContact = args->mirfoxDataPtr->getMirandaContactPtrByHandle((UINT_PTR)args->targetHandle); const wchar_t* contactNameW = nullptr; wchar_t* tszAccountName = nullptr; - if (mirandaContact){ + if (mirandaContact) { contactNameW = mirandaContact->contactNameW.c_str(); MirandaAccount* mirandaAccount = mirandaContact->mirandaAccountPtr; if (mirandaAccount) tszAccountName = mirandaAccount->tszAccountName; } - if(myMfAck != nullptr && myMfAck->result == ACKRESULT_SUCCESS){ + if (myMfAck != nullptr && myMfAck->result == ACKRESULT_SUCCESS) { addMessageToDB((UINT_PTR)args->targetHandle, msgBuffer, bufSize, targetHandleSzProto); - if (mode == MFENUM_SMM_ONLY_SEND){ + if (mode == MFENUM_SMM_ONLY_SEND) { //show notyfication popup (only in SMM_ONLY_SEND mode) wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)]; - if (contactNameW != nullptr && tszAccountName != nullptr) - if (args->mirfoxDataPtr->getAddAccountToContactNameCheckbox()){ + if (contactNameW != nullptr && tszAccountName != nullptr) { + if (args->mirfoxDataPtr->getAddAccountToContactNameCheckbox()) mir_snwprintf(buffer, 1024, TranslateT("Message sent to %s"), contactNameW); - } else { + else mir_snwprintf(buffer, 1024, TranslateT("Message sent to %s (%s)"), contactNameW, tszAccountName); - } - else - mir_snwprintf(buffer, 1024, TranslateT("Message sent")); + } + else mir_snwprintf(buffer, 1024, TranslateT("Message sent")); - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) - ShowClassPopupW("MirFox_Notify", L"MirFox", buffer); - else - PUShowMessageW(buffer, SM_NOTIFY); + ShowClassPopupW("MirFox_Notify", L"MirFox", buffer); delete[] buffer; } - else if (mode == MFENUM_SMM_SEND_AND_SHOW_MW){ + else if (mode == MFENUM_SMM_SEND_AND_SHOW_MW) { //notify hook to open window - if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){ + if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr) { notifyHookToOpenMsgWindow(args, false); } else logger->log(L"SMTC: ERROR1 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL"); @@ -224,39 +224,40 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ else { //error - show error popup wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)]; - if (myMfAck != nullptr){ + if (myMfAck != nullptr) { logger->log_p(L"SMTC: ERROR - Cannot send message - result = [%d] ", myMfAck->result); - if (myMfAck->errorDesc != nullptr){ - if (contactNameW != nullptr && tszAccountName != nullptr){ + if (myMfAck->errorDesc != nullptr) { + if (contactNameW != nullptr && tszAccountName != nullptr) { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s) - %S"), contactNameW, tszAccountName, myMfAck->errorDesc); - } else { + } + else { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message - %S"), myMfAck->errorDesc); } - } else { - if (contactNameW != nullptr && tszAccountName != nullptr){ + } + else { + if (contactNameW != nullptr && tszAccountName != nullptr) { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName); - } else { + } + else { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message")); } } - } else { + } + else { logger->log(L"SMTC: ERROR - Cannot send message 2"); - if (contactNameW != nullptr && tszAccountName != nullptr){ + if (contactNameW != nullptr && tszAccountName != nullptr) { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message to %s (%s)"), contactNameW, tszAccountName); - } else { + } + else { mir_snwprintf(buffer, 1024, TranslateT("Cannot send message")); } } - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - ShowClassPopupW("MirFox_Error", TranslateT("MirFox error"), buffer); - } else { - PUShowMessageW(buffer, SM_WARNING); - } + ShowClassPopupW("MirFox_Error", TranslateT("MirFox error"), buffer); //if MFENUM_SMM_SEND_AND_SHOW_MW, even if error sending message - notify hook to open window - if (mode == MFENUM_SMM_SEND_AND_SHOW_MW){ - if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){ + if (mode == MFENUM_SMM_SEND_AND_SHOW_MW) { + if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr) { notifyHookToOpenMsgWindow(args, true); } else logger->log(L"SMTC: ERROR2 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL"); @@ -265,7 +266,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ delete[] buffer; } - if (myMfAck != nullptr){ //when we found ack, not when we exceed MAX_ACK_WAIT_COUNTER + if (myMfAck != nullptr) { //when we found ack, not when we exceed MAX_ACK_WAIT_COUNTER if (myMfAck->errorDesc != nullptr) delete myMfAck->errorDesc; delete myMfAck->szModule; delete myMfAck; @@ -276,7 +277,7 @@ void MirandaUtils::sendMessage(ActionThreadArgStruct* args, MFENUM_SEND_MESSAGE_ } else if (mode == MFENUM_SMM_ONLY_SHOW_MW) { //notify hook to open msg window - if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr){ + if (args->mirfoxDataPtr != nullptr && args->mirfoxDataPtr->hhook_EventOpenMW != nullptr) { notifyHookToOpenMsgWindow(args, true); } else logger->log(L"SMTC: ERROR3 args->mirfoxDataPtr == NULL || args->mirfoxDataPtr->hhook_EventOpenMW == NULL"); @@ -304,13 +305,14 @@ void MirandaUtils::notifyHookToOpenMsgWindow(ActionThreadArgStruct* args, bool s { OnHookOpenMvStruct* onHookOpenMv = new(OnHookOpenMvStruct); onHookOpenMv->targetHandle = args->targetHandle; - if (showMessageToSend){ + if (showMessageToSend) { //adding newline to message in Message Window, only in this mode std::wstring* msgBuffer = new std::wstring(); //deleted at on_hook_OpenMW msgBuffer->append(args->userActionSelection); msgBuffer->append(L"\r\n"); onHookOpenMv->msgBuffer = msgBuffer; - } else { + } + else { onHookOpenMv->msgBuffer = nullptr; } @@ -329,7 +331,8 @@ void MirandaUtils::ForceForegroundWindow(HWND hWnd) BringWindowToTop(hWnd); ShowWindow(hWnd, SW_SHOW); AttachThreadInput(foreThread, appThread, false); - } else { + } + else { BringWindowToTop(hWnd); ShowWindow(hWnd, SW_SHOW); } @@ -339,28 +342,29 @@ int MirandaUtils::on_hook_OpenMW(WPARAM wParam, LPARAM lParam) { OnHookOpenMvStruct* param = (OnHookOpenMvStruct*)wParam; - if (param->msgBuffer != nullptr){ + if (param->msgBuffer != nullptr) { wchar_t *msgBuffer = mir_wstrdup(param->msgBuffer->c_str()); CallServiceSync(MS_MSG_SENDMESSAGEW, (WPARAM)param->targetHandle, (LPARAM)msgBuffer); mir_free(msgBuffer); delete param->msgBuffer; - } else { + } + else { //only open window CallServiceSync(MS_MSG_SENDMESSAGEW, (WPARAM)param->targetHandle, 0); } // show and focus window - if (g_plugin.getByte("doNotFocusWhenOpenMW", 0) == 1){ + if (g_plugin.getByte("doNotFocusWhenOpenMW", 0) == 1) { delete param; return 0; } MessageWindowData mwd; - if (!Srmm_GetWindowData((WPARAM)param->targetHandle, mwd) && mwd.hwndWindow){ + if (!Srmm_GetWindowData((WPARAM)param->targetHandle, mwd) && mwd.hwndWindow) { HWND parent; HWND hWnd = mwd.hwndWindow; - while((parent = GetParent(hWnd)) != nullptr) + while ((parent = GetParent(hWnd)) != nullptr) hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm) ForceForegroundWindow(hWnd); } @@ -386,34 +390,29 @@ void MirandaUtils::setStatusOnAccount(ActionThreadArgStruct* args) tszAccountName = mirandaAccount->tszAccountName; wchar_t* buffer = new wchar_t[1024 * sizeof(wchar_t)]; - if(result == 0){ - if (tszAccountName != nullptr){ + if (result == 0) { + if (tszAccountName != nullptr) { logger->log_p(L"SSOA: Status message set on [%s]", tszAccountName); mir_snwprintf(buffer, 1024, TranslateT("Status message set on %s"), tszAccountName); - } else { + } + else { logger->log(L"SSOA: Status message set"); mir_snwprintf(buffer, 1024, TranslateT("Status message set")); } - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - ShowClassPopupW("MirFox_Notify", L"MirFox", buffer); - } else { - PUShowMessageW(buffer, SM_NOTIFY); - } - } else { - if (tszAccountName != nullptr){ + ShowClassPopupW("MirFox_Notify", L"MirFox", buffer); + } + else { + if (tszAccountName != nullptr) { logger->log_p(L"SSOA: ERROR - Cannot set status message 2 on [%s] - result = [%d] ", tszAccountName, result); mir_snwprintf(buffer, 1024, TranslateT("Cannot set status message on %s"), tszAccountName); - } else { + } + else { logger->log_p(L"SSOA: ERROR - Cannot set status message 2 - result = [%d] ", result); mir_snwprintf(buffer, 1024, TranslateT("Cannot set status message")); } - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - ShowClassPopupW("MirFox_Error", TranslateT("MirFox error"), buffer); - } else { - PUShowMessageW(buffer, SM_WARNING); - } + ShowClassPopupW("MirFox_Error", TranslateT("MirFox error"), buffer); } delete[] buffer; } @@ -427,14 +426,14 @@ int MirandaUtils::onProtoAck(WPARAM, LPARAM lParam) void MirandaUtils::onProtoAckOnInstance(ACKDATA* ack) { - if (ack == nullptr || ack->type != ACKTYPE_MESSAGE){ + if (ack == nullptr || ack->type != ACKTYPE_MESSAGE) { //we are waiting for ACKTYPE_MESSAGE ack's return; } EnterCriticalSection(&ackMapCs); ackMapIt = ackMap.find(ack->hProcess); - if (ackMapIt != ackMap.end()){ + if (ackMapIt != ackMap.end()) { //we waited for this ack, save copy (only needed data) to our map. Oryginal ack object is unstable, it is probably controled not in our thread logger->log_p(L"!!! ACK received acl: hContact = [" SCNuPTR L"] result = [%d] szModule = [%S] lParam = [%S]", ack->hProcess, ack->result, ack->szModule, (ack->lParam != NULL && *((char*)ack->lParam) != '\0') ? (char*)ack->lParam : "null"); MIRFOXACKDATA* myMfAck = new(MIRFOXACKDATA); @@ -444,12 +443,13 @@ void MirandaUtils::onProtoAckOnInstance(ACKDATA* ack) char* myMfSzModulePtr = new char[len1]; strcpy_s(myMfSzModulePtr, len1, ack->szModule); myMfAck->szModule = myMfSzModulePtr; - if (ack->lParam != NULL && *((char*)ack->lParam) != '\0'){ + if (ack->lParam != NULL && *((char*)ack->lParam) != '\0') { size_t len2 = strlen((char*)ack->lParam) + 1; char* myMfSzLparamPtr = new char[len2]; strcpy_s(myMfSzLparamPtr, len2, (char*)ack->lParam); myMfAck->errorDesc = myMfSzLparamPtr; - } else { + } + else { myMfAck->errorDesc = nullptr; } @@ -466,18 +466,19 @@ void MirandaUtils::onProtoAckOnInstance(ACKDATA* ack) void MirandaUtils::translateOldDBNames() { //settings "clientsProfilesFilterCheckbox", "clientsProfilesFilterString" int opt1KeyValue = db_get_b(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterCheckbox", 0); - if (opt1KeyValue != 0){ + if (opt1KeyValue != 0) { g_plugin.setByte("clientsProfilesFilterCheckbox", opt1KeyValue); db_unset(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterCheckbox"); logger->log(L"TranslateOldDBNames: 'clientsProfilesFilterCheckbox' db entry found and moved"); - } else { + } + else { logger->log(L"TranslateOldDBNames: no old settings found. returning."); return; } - DBVARIANT opt2Dbv = {0}; + DBVARIANT opt2Dbv = { 0 }; INT_PTR opt2Result = db_get_s(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterString", &opt2Dbv, DBVT_WCHAR); - if (opt2Result == 0){ //success + if (opt2Result == 0) { //success std::wstring clientsProfilesFilterString = opt2Dbv.pwszVal; g_plugin.setWString("clientsProfilesFilterString", clientsProfilesFilterString.c_str()); db_unset(0, OLD_PLUGIN_DB_ID, "clientsProfilesFilterString"); @@ -492,7 +493,7 @@ void MirandaUtils::translateOldDBNames() { std::string mirandaAccountDBKey("ACCOUNTSTATE_"); mirandaAccountDBKey += pa->szModuleName; int keyValue = db_get_b(0, OLD_PLUGIN_DB_ID, mirandaAccountDBKey.c_str(), 0); - if (keyValue != 0){ + if (keyValue != 0) { g_plugin.setByte(mirandaAccountDBKey.c_str(), keyValue); db_unset(0, OLD_PLUGIN_DB_ID, mirandaAccountDBKey.c_str()); logger->log(L"TranslateOldDBNames: ACCOUNT db entry found and moved"); @@ -500,11 +501,11 @@ void MirandaUtils::translateOldDBNames() { } //contacts "state" - for (auto &hContact : Contacts()){ + for (auto &hContact : Contacts()) { logger->log_p(L"TranslateOldDBNames: found CONTACT: [" SCNuPTR L"]", hContact); int keyValue = db_get_b(hContact, OLD_PLUGIN_DB_ID, "state", 0); - if (keyValue != 0){ + if (keyValue != 0) { g_plugin.setByte(hContact, "state", keyValue); db_unset(hContact, OLD_PLUGIN_DB_ID, "state"); logger->log(L"TranslateOldDBNames: CONTACT db entry found and moved"); @@ -514,4 +515,3 @@ void MirandaUtils::translateOldDBNames() { // delete db module db_delete_module(0, OLD_PLUGIN_DB_ID); } - diff --git a/plugins/MirLua/Modules/m_popup/src/main.cpp b/plugins/MirLua/Modules/m_popup/src/main.cpp index da9c9afdff..0699967031 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 ppd(MakePopupData(L)); - INT_PTR res = ::CallService(MS_POPUP_ADDPOPUPW, (WPARAM)ppd, 0); + INT_PTR res = ::PUAddPopupW(ppd); lua_pushinteger(L, res); return 1; diff --git a/plugins/MirLua/src/utils.cpp b/plugins/MirLua/src/utils.cpp index e36458a64d..d17301214e 100644 --- a/plugins/MirLua/src/utils.cpp +++ b/plugins/MirLua/src/utils.cpp @@ -21,8 +21,7 @@ void ShowNotification(const char *caption, const char *message, int flags, MCONT if (Miranda_IsTerminated()) return; - if (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1)) - { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { POPUPDATA ppd = { 0 }; ppd.lchContact = hContact; mir_strncpy(ppd.lpzContactName, caption, MAX_CONTACTNAME); diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 82e210f0b4..c75f71a93a 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -86,8 +86,6 @@ void LoadOptions() options.end_offline = (g_plugin.getByte("EndOffline", 1) == 1); options.end_window_close = (g_plugin.getByte("EndWindowClose", 0) == 1); - - options.bHavePopups = 0 != ServiceExists(MS_POPUP_ADDPOPUPW) && ServiceExists(MS_POPUP_SHOWMESSAGE); options.bHaveSecureIM = 0 != ServiceExists("SecureIM/IsContactSecured"); LoadFilenames(); diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h index 17efb1c139..46a0afc157 100644 --- a/plugins/MirOTR/src/options.h +++ b/plugins/MirOTR/src/options.h @@ -32,7 +32,7 @@ typedef struct { bool end_offline, end_window_close; // temporary options - bool bHavePopups, bHaveSecureIM; + bool bHaveSecureIM; } Options; diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index cde933ab73..53daeb5735 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -116,31 +116,10 @@ wchar_t* ProtoGetNickname(const char* proto) void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact) { - if (Miranda_IsTerminated()) return; - - if (!options.bHavePopups) { - wchar_t title[256]; - mir_snwprintf(title, L"%s Message", _A2W(MODULENAME)); - - if (line1 && line2) { - int size = int(mir_wstrlen(line1) + mir_wstrlen(line2) + 3); - wchar_t *message = new wchar_t[size]; // newline and null terminator - mir_snwprintf(message, size, L"%s\r\n%s", line1, line2); - MessageBox(nullptr, message, title, MB_OK | MB_ICONINFORMATION); - delete[] message; - } - else if (line1) { - MessageBox(nullptr, line1, title, MB_OK | MB_ICONINFORMATION); - } - else if (line2) { - MessageBox(nullptr, line2, title, MB_OK | MB_ICONINFORMATION); - } + if (Miranda_IsTerminated()) return; - } - - POPUPDATAW ppd = { 0 }; - //memset((void *)&ppd, 0, sizeof(POPUPDATAW)); + POPUPDATAW ppd = {}; ppd.lchContact = hContact; ppd.lchIcon = nullptr; @@ -154,26 +133,17 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC wcsncpy(ppd.lpwzText, line2, MAX_SECONDLINE - 1); ppd.iSeconds = timeout; - ppd.PluginWindowProc = nullptr; ppd.PluginData = nullptr; - PUAddPopupW(&ppd); - } void ShowWarning(wchar_t *msg) { wchar_t buffer[512]; - ErrorDisplay disp = options.err_method; - // funny logic :) ... try to avoid message boxes - // if want popups but no popups, try baloons - if (disp == ED_POP && !options.bHavePopups) - disp = ED_BAL; - mir_snwprintf(buffer, L"%s Warning", _A2W(MODULENAME)); - switch (disp) { + switch (options.err_method) { case ED_POP: { int size = int(mir_wstrlen(msg) + 515); @@ -195,16 +165,10 @@ void ShowWarning(wchar_t *msg) void ShowError(wchar_t *msg) { wchar_t buffer[512]; - ErrorDisplay disp = options.err_method; - // funny logic :) ... try to avoid message boxes - // if want popups but no popups, try baloons - if (disp == ED_POP && !options.bHavePopups) - disp = ED_BAL; - mir_snwprintf(buffer, L"%s Error", _A2W(MODULENAME)); wchar_t *message; - switch (disp) { + switch (options.err_method) { case ED_POP: { int size = int(mir_wstrlen(msg) + 515); diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index e7f7dcdbc9..bc02f0a47a 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -189,15 +189,13 @@ int HookedInit(WPARAM, LPARAM) int HookedOptions(WPARAM wParam, LPARAM) { - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - OPTIONSDIALOGPAGE odp = {}; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); - odp.szTitle.w = LPGENW("MessagePopup"); - odp.szGroup.w = LPGENW("Popups"); - odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; - odp.pfnDlgProc = OptionsDlgProc; - g_plugin.addOptions(wParam, &odp); - } + OPTIONSDIALOGPAGE odp = {}; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); + odp.szTitle.w = LPGENW("MessagePopup"); + odp.szGroup.w = LPGENW("Popups"); + odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE; + odp.pfnDlgProc = OptionsDlgProc; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp index 3a55cc7798..e76ab4fdb9 100644 --- a/plugins/NewAwaySysMod/src/Notification.cpp +++ b/plugins/NewAwaySysMod/src/Notification.cpp @@ -23,17 +23,14 @@ void ShowMsg(wchar_t *FirstLine, wchar_t *SecondLine, bool IsErrorMsg, int Timeout) { - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - POPUPDATAW ppd = { 0 }; - ppd.lchIcon = LoadIcon(nullptr, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION); - mir_wstrncpy(ppd.lpwzContactName, FirstLine, MAX_CONTACTNAME); - mir_wstrncpy(ppd.lpwzText, SecondLine, MAX_SECONDLINE); - ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD; - ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000; - ppd.iSeconds = Timeout; - PUAddPopupW(&ppd); - } - else MessageBox(nullptr, SecondLine, FirstLine, MB_OK | (IsErrorMsg ? MB_ICONEXCLAMATION : MB_ICONINFORMATION)); + POPUPDATAW ppd = { 0 }; + ppd.lchIcon = LoadIcon(nullptr, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION); + mir_wstrncpy(ppd.lpwzContactName, FirstLine, MAX_CONTACTNAME); + mir_wstrncpy(ppd.lpwzText, SecondLine, MAX_SECONDLINE); + ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD; + ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000; + ppd.iSeconds = Timeout; + PUAddPopupW(&ppd); } void ShowLog(TCString &LogFilePath) diff --git a/plugins/NewEventNotify/src/options.cpp b/plugins/NewEventNotify/src/options.cpp index a3c3a39373..9847c32859 100644 --- a/plugins/NewEventNotify/src/options.cpp +++ b/plugins/NewEventNotify/src/options.cpp @@ -263,16 +263,13 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hWnd, UINT message, WPARAM wParam, L int OptionsAdd(WPARAM addInfo, LPARAM) { - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - OPTIONSDIALOGPAGE odp = {}; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT); - odp.szTitle.a = LPGEN("Event Notify"); - odp.szGroup.a = LPGEN("Popups"); - odp.flags = ODPF_BOLDGROUPS; - odp.pfnDlgProc = OptionsDlgProc; - g_plugin.addOptions(addInfo, &odp); - } - + OPTIONSDIALOGPAGE odp = {}; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT); + odp.szTitle.a = LPGEN("Event Notify"); + odp.szGroup.a = LPGEN("Popups"); + odp.flags = ODPF_BOLDGROUPS; + odp.pfnDlgProc = OptionsDlgProc; + g_plugin.addOptions(addInfo, &odp); return 0; } diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 92540ab0b0..c556b04c41 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -406,12 +406,10 @@ int PopupShow(MCONTACT hContact, MEVENT hEvent, UINT eventType) PopupList[NumberPopupData(NULL, -1)] = pdata; // send data to popup plugin - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - // popup creation failed, release popupdata - if (PUAddPopupW(&pudw) < 0) { - FreePopupEventData(pdata); - mir_free(pdata); - } + // popup creation failed, release popupdata + if (PUAddPopupW(&pudw) < 0) { + FreePopupEventData(pdata); + mir_free(pdata); } if (dbe.pBlob) diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index c173aa2f79..cd52dde535 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -810,7 +810,7 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam) { char *szProto = (char *)lParam; if (opt.AutoDisable && (!opt.OnlyGlobalChanges || szProto == nullptr)) { - if (opt.DisablePopupGlobally && ServiceExists(MS_POPUP_QUERY)) { + if (opt.DisablePopupGlobally) { char szSetting[12]; mir_snprintf(szSetting, "p%d", wParam); BYTE hlpDisablePopup = g_plugin.getByte(szSetting, 0); @@ -1084,8 +1084,7 @@ void InitMainMenuItem() CMenuItem mi(&g_plugin); SET_UID(mi, 0x22b7b4db, 0xa9a1, 0x4d43, 0x88, 0x80, 0x4c, 0x23, 0x20, 0x31, 0xc6, 0xa0); mi.flags = CMIF_UNICODE; - if (ServiceExists(MS_POPUP_ADDPOPUPW)) - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); + mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); mi.pszService = MS_STATUSCHANGE_MENUCOMMAND; hEnableDisableMenu = Menu_AddMainMenuItem(&mi); diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 178b1b9301..0a1b11abf8 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -1197,23 +1197,22 @@ int OptionsInitialize(WPARAM wParam, LPARAM) odp.pfnDlgProc = DlgProcFiltering; g_plugin.addOptions(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.szTitle.a = LPGEN("Status Notify"); - odp.szGroup.a = LPGEN("Popups"); - odp.szTab.a = LPGEN("General"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP); - odp.pfnDlgProc = DlgProcPopupOpts; - g_plugin.addOptions(wParam, &odp); - - odp.szTab.a = LPGEN("Extra status"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_XPOPUP); - odp.pfnDlgProc = DlgProcXPopupOpts; - g_plugin.addOptions(wParam, &odp); - - odp.szTab.a = LPGEN("Status message"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SMPOPUP); - odp.pfnDlgProc = DlgProcSMPopupOpts; - g_plugin.addOptions(wParam, &odp); - } + // Popups + odp.szTitle.a = LPGEN("Status Notify"); + odp.szGroup.a = LPGEN("Popups"); + odp.szTab.a = LPGEN("General"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP); + odp.pfnDlgProc = DlgProcPopupOpts; + g_plugin.addOptions(wParam, &odp); + + odp.szTab.a = LPGEN("Extra status"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_XPOPUP); + odp.pfnDlgProc = DlgProcXPopupOpts; + g_plugin.addOptions(wParam, &odp); + + odp.szTab.a = LPGEN("Status message"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SMPOPUP); + odp.pfnDlgProc = DlgProcSMPopupOpts; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index 19b433b087..1d1eb93a93 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -85,7 +85,7 @@ void dbg_msg(std::wstring str, int type) if (g_settings.debug_messages) // Execute it in main thread - CallServiceSync(MS_POPUP_SHOWMESSAGEW, (WPARAM)str.c_str(), (LPARAM)type); + PUShowMessageW(str.c_str(), type); if (g_settings.log_to_file) { time_t t_; diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 20dcad8548..0d389c99f2 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -276,31 +276,13 @@ void Nudge_ShowPopup(CNudgeElement*, MCONTACT hContact, wchar_t * Message) hContact = db_mc_tryMeta(hContact); wchar_t *lpzContactName = Clist_GetContactDisplayName(hContact); - if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - POPUPDATACLASS NudgePopup = { 0 }; - NudgePopup.cbSize = sizeof(NudgePopup); - NudgePopup.hContact = hContact; - NudgePopup.pwszText = Message; - NudgePopup.pwszTitle = lpzContactName; - NudgePopup.pszClassName = "nudge"; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&NudgePopup); - } - else if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - POPUPDATAW NudgePopup = { 0 }; - NudgePopup.lchContact = hContact; - NudgePopup.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib); - NudgePopup.colorBack = 0; - NudgePopup.colorText = 0; - NudgePopup.iSeconds = 0; - NudgePopup.PluginWindowProc = NudgePopupProc; - NudgePopup.PluginData = (void *)1; - - wcscpy_s(NudgePopup.lpwzText, Message); - wcscpy_s(NudgePopup.lpwzContactName, lpzContactName); - - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&NudgePopup, 0); - } - else MessageBox(nullptr, Message, lpzContactName, 0); + POPUPDATACLASS NudgePopup = { 0 }; + NudgePopup.cbSize = sizeof(NudgePopup); + NudgePopup.hContact = hContact; + NudgePopup.pwszText = Message; + NudgePopup.pwszTitle = lpzContactName; + NudgePopup.pszClassName = "nudge"; + CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&NudgePopup); } void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact) diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index 9512a700c7..83ce348095 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -148,7 +148,7 @@ void show_popup(HWND hDlg, LPCTSTR pszTitle, LPCTSTR pszText, int iNumber, int A MakePopupAction(pmpd->pa[pd.actionCount++], IDNO); } - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, APF_NEWDATA); + PUAddPopupW(&pd, APF_NEWDATA); } INT_PTR CALLBACK DlgDownload(HWND hDlg, UINT message, WPARAM, LPARAM) @@ -176,7 +176,7 @@ INT_PTR CALLBACK DlgDownloadPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM) static void __stdcall CreateDownloadDialog(void*) { - if (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups3", DEFAULT_POPUP_ENABLED)) + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && 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 +195,7 @@ void DlgDownloadProc() if (!DownloadFile(pFileUrl->tszDownloadURL, pFileUrl->tszDiskPath)) { Title = TranslateT("Pack Updater"); Text = TranslateT("An error occurred while downloading the update."); - if (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) { Number = 1; show_popup(nullptr, Title, Text, Number, 0); } @@ -420,7 +420,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_ADDPOPUPW) && 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 (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)) rc = DialogBox(g_plugin.getInst(), MAKEINTRESOURCE(IDD_POPUPDUMMI), nullptr, DlgMsgPop); else rc = MessageBox(nullptr, tszBuff, Title, MB_YESNO | MB_ICONQUESTION); @@ -508,7 +508,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 (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && 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 b662b16a54..628bad6ee5 100644 --- a/plugins/PackUpdater/Src/Options.cpp +++ b/plugins/PackUpdater/Src/Options.cpp @@ -31,8 +31,6 @@ LRESULT CALLBACK MyEditProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPara INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - char str[20]; - switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); @@ -55,19 +53,12 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ComboBox_SetCurSel(GetDlgItem(hwndDlg, IDC_PERIODMEASURE), PeriodMeasure); CheckDlgButton(hwndDlg, IDC_REMINDER, Reminder ? BST_CHECKED : BST_UNCHECKED); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - ShowWindow(GetDlgItem(hwndDlg, IDC_NOTIFY2), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_MSG_BOXES2), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_ERRORS2), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_INFO_MESSAGES2), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_PROGR_DLG2), SW_HIDE); - } - else { - for (int i = 1; i < POPUPS; i++) { - mir_snprintf(str, "Popups%dM", i); - CheckDlgButton(hwndDlg, (i + 1029), (g_plugin.getByte(str, DEFAULT_MESSAGE_ENABLED)) ? BST_CHECKED : BST_UNCHECKED); - } - } + + ShowWindow(GetDlgItem(hwndDlg, IDC_NOTIFY2), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_MSG_BOXES2), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_ERRORS2), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_INFO_MESSAGES2), SW_HIDE); + ShowWindow(GetDlgItem(hwndDlg, IDC_PROGR_DLG2), SW_HIDE); return TRUE; case WM_COMMAND: @@ -141,12 +132,6 @@ INT_PTR CALLBACK UpdateNotifyOptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPA g_plugin.setByte("PeriodMeasure", PeriodMeasure); Reminder = IsDlgButtonChecked(hwndDlg, IDC_REMINDER); g_plugin.setByte("Reminder", Reminder); - if (!ServiceExists(MS_POPUP_ADDPOPUPW)) { - for (int i = 1; i < POPUPS; i++) { - mir_snprintf(str, "Popups%dM", i); - g_plugin.setByte(str, (BYTE)(IsDlgButtonChecked(hwndDlg, (i + 1029)))); - } - } } break; } @@ -389,12 +374,10 @@ int OptInit(WPARAM wParam, LPARAM) odp.pfnDlgProc = UpdateNotifyOptsProc; g_plugin.addOptions(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); - odp.szGroup.w = LPGENW("Popups"); - odp.szTitle.w = LPGENW("Pack Updater"); - odp.pfnDlgProc = DlgPopupOpts; - g_plugin.addOptions(wParam, &odp); - } + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); + odp.szGroup.w = LPGENW("Popups"); + odp.szTitle.w = LPGENW("Pack Updater"); + odp.pfnDlgProc = DlgPopupOpts; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 2ff8415ef9..29e1974917 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 (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && 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 (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups1", DEFAULT_POPUP_ENABLED)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && 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 (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && 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 (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && 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 (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1) && g_plugin.getByte("Popups2", DEFAULT_POPUP_ENABLED)) { Number = 2; show_popup(nullptr, Title, Text, Number, 0); } diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index 281d9b1456..72971b0309 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -36,13 +36,8 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_LOGBROWSE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_LOGCSV), FALSE); } - - if (!ServiceExists(MS_POPUP_ADDPOPUPW)) { - EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKPOPUP), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKPOPUP2), FALSE); - EnableWindow(GetDlgItem(hwndDlg, IDC_CHK_BLOCK), FALSE); - } return TRUE; + case WM_COMMAND: if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) { switch (LOWORD(wParam)) { diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 7eff156372..0dad666e44 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -182,7 +182,7 @@ void __cdecl sttCheckStatusThreadProc(void*) if (pa.miss_count == -1 - options.retries || (((-pa.miss_count) % (options.retries + 1)) == 0 && !options.block_reps)) { reply = true; - if (options.show_popup2 && ServiceExists(MS_POPUP_SHOWMESSAGE)) { + if (options.show_popup2) { ShowPopup(TranslateT("Ping Reply"), pa.pszLabel, 1); } } diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index 98a3db9024..de7a1d0bf9 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -19,42 +19,17 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l static INT_PTR CALLBACK sttMainThreadCallback(void *dwParam) { POPUPDATAW* ppd = (POPUPDATAW*)dwParam; - - if (ServiceExists(MS_POPUP_ADDPOPUPW)) - PUAddPopupW(ppd); - + PUAddPopupW(ppd); free(ppd); return 0; } void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int flags) { - if (Miranda_IsTerminated()) return; - - if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - ShowClassPopupW("pingpopups", line1, line2); - } - else if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - POPUPDATAW *ppd = (POPUPDATAW*)calloc(sizeof(POPUPDATAW), 1); - - ppd->lchContact = NULL; - ppd->lchIcon = (flags ? hIconResponding : hIconNotResponding); - mir_wstrncpy(ppd->lpwzContactName, line1, _countof(ppd->lpwzContactName)); - mir_wstrncpy(ppd->lpwzText, line2, _countof(ppd->lpwzText)); - - ppd->colorBack = GetSysColor(COLOR_BTNFACE); - ppd->colorText = GetSysColor(COLOR_WINDOWTEXT); - ppd->iSeconds = 10; - - ppd->PluginWindowProc = NullWindowProc; - ppd->PluginData = nullptr; - - CallFunctionSync(sttMainThreadCallback, ppd); - } - else{ - MessageBox(nullptr, line2, _A2W(MODULENAME) L" Message", MB_OK | MB_ICONINFORMATION); + if (Miranda_IsTerminated()) return; - } + + ShowClassPopupW("pingpopups", line1, line2); } // service functions diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index efa7d1f2de..98842ed9d6 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 (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1)) + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) 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 2306462636..e2d37d95bd 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 (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { char setting[100]; mir_snprintf(setting, "Popups%d", Number); diff --git a/plugins/PluginUpdater/src/Options.cpp b/plugins/PluginUpdater/src/Options.cpp index 560aa2bc90..31205b9a4d 100644 --- a/plugins/PluginUpdater/src/Options.cpp +++ b/plugins/PluginUpdater/src/Options.cpp @@ -565,12 +565,10 @@ int OptInit(WPARAM wParam, LPARAM) odp.pfnDlgProc = UpdateNotifyOptsProc; g_plugin.addOptions(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); - odp.szGroup.w = LPGENW("Popups"); - odp.szTitle.w = LPGENW("Plugin Updater"); - odp.pfnDlgProc = DlgPopupOpts; - g_plugin.addOptions(wParam, &odp); - } + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); + odp.szGroup.w = LPGENW("Popups"); + odp.szTitle.w = LPGENW("Plugin Updater"); + odp.pfnDlgProc = DlgPopupOpts; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/ProxySwitch/src/main.cpp b/plugins/ProxySwitch/src/main.cpp index b5c8f01d3e..30a452c6a6 100644 --- a/plugins/ProxySwitch/src/main.cpp +++ b/plugins/ProxySwitch/src/main.cpp @@ -53,8 +53,6 @@ UINT opt_not_restarted; COLORREF opt_bgColor; COLORREF opt_txtColor; -UINT opt_popupPluginInstalled; - static HANDLE hEventConnect = NULL; static HANDLE hEventDisconnect = NULL; static HANDLE hSvcPopupSwitch = NULL; @@ -77,17 +75,12 @@ void PopupMyIPAddrs(const wchar_t *msg) POPUPDATAW ppd = {}; wcsncpy_s(ppd.lpwzText, Print_NIF_List(list, msg), _TRUNCATE); - if (opt_popupPluginInstalled) { - LoadSettings(); - ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_PROXY)); - wcsncpy_s(ppd.lpwzContactName, TranslateT("Current IP address"), _TRUNCATE); - ppd.colorBack = opt_defaultColors ? 0 : opt_bgColor; - ppd.colorText = opt_defaultColors ? 0 : opt_txtColor; - PUAddPopupW(&ppd); - } - else { - MessageBox(NULL, ppd.lpwzText, _A2T(MODULENAME), MB_OK | MB_ICONINFORMATION); - } + LoadSettings(); + ppd.lchIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_PROXY)); + wcsncpy_s(ppd.lpwzContactName, TranslateT("Current IP address"), _TRUNCATE); + ppd.colorBack = opt_defaultColors ? 0 : opt_bgColor; + ppd.colorText = opt_defaultColors ? 0 : opt_txtColor; + PUAddPopupW(&ppd); } } @@ -248,8 +241,6 @@ int CMPlugin::Load() int Init(WPARAM, LPARAM) { - opt_popupPluginInstalled = ServiceExists(MS_POPUP_ADDPOPUP); - hEventRebound = CreateEvent(NULL, TRUE, FALSE, NULL); mir_forkthread(IP_WatchDog, 0); @@ -295,17 +286,14 @@ int Init(WPARAM, LPARAM) UpdateInterfacesMenu(); - if (opt_popupPluginInstalled) { - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0xC0000000); - mi.name.w = LPGENW("IP change notification"); - mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LOGO)); - mi.pszService = MS_PROXYSWITCH_POPUPSWITCH; - hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); - hSvcPopupSwitch = CreateServiceFunction(mi.pszService, PopupSwitch); - - UpdatePopupMenu(opt_popups); - } + mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0xC0000000); + mi.name.w = LPGENW("IP change notification"); + mi.hIcon = LoadIcon(g_plugin.getInst(), MAKEINTRESOURCE(IDI_LOGO)); + mi.pszService = MS_PROXYSWITCH_POPUPSWITCH; + hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); + hSvcPopupSwitch = CreateServiceFunction(mi.pszService, PopupSwitch); + UpdatePopupMenu(opt_popups); return 0; } diff --git a/plugins/ProxySwitch/src/opt.cpp b/plugins/ProxySwitch/src/opt.cpp index e78de5e9b7..4f2b5927f0 100644 --- a/plugins/ProxySwitch/src/opt.cpp +++ b/plugins/ProxySwitch/src/opt.cpp @@ -49,11 +49,10 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) CheckDlgButton(hdlg, IDC_CHECK_DEFAULTCOLORS, opt_defaultColors ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_CHECK_SHOWPROXYSTATUS, opt_showProxyState ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hdlg, IDC_CHECK_FIREFOX), Firefox_Installed()); - EnableWindow(GetDlgItem(hdlg, IDC_CHECK_POPUPS), opt_popupPluginInstalled); - EnableWindow(GetDlgItem(hdlg, IDC_BGCOLOR), opt_popupPluginInstalled && opt_popups && !opt_defaultColors); - EnableWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), opt_popupPluginInstalled && opt_popups && !opt_defaultColors); - EnableWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), opt_popupPluginInstalled && opt_popups); - EnableWindow(GetDlgItem(hdlg, IDC_CHECK_SHOWPROXYSTATUS), opt_popupPluginInstalled && opt_popups); + EnableWindow(GetDlgItem(hdlg, IDC_BGCOLOR), opt_popups && !opt_defaultColors); + EnableWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), opt_popups && !opt_defaultColors); + EnableWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), opt_popups); + EnableWindow(GetDlgItem(hdlg, IDC_CHECK_SHOWPROXYSTATUS), opt_popups); ShowWindow(GetDlgItem(hdlg, IDC_RESTARTREQUIRED), opt_not_restarted ? SW_SHOW : SW_HIDE); TranslateDialogDefault(hdlg); opt_startup = FALSE; @@ -108,8 +107,6 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) case IDC_CHECK_DEFAULTCOLORS: case IDC_CHECK_POPUPS: - if (!opt_popupPluginInstalled) - break; EnableWindow(GetDlgItem(hdlg, IDC_BGCOLOR), IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS) && !IsDlgButtonChecked(hdlg, IDC_CHECK_DEFAULTCOLORS)); EnableWindow(GetDlgItem(hdlg, IDC_TEXTCOLOR), IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS) && !IsDlgButtonChecked(hdlg, IDC_CHECK_DEFAULTCOLORS)); EnableWindow(GetDlgItem(hdlg, IDC_CHECK_DEFAULTCOLORS), IsDlgButtonChecked(hdlg, IDC_CHECK_POPUPS)); diff --git a/plugins/ProxySwitch/src/stdafx.h b/plugins/ProxySwitch/src/stdafx.h index 0afc33e0dd..f9044260f3 100644 --- a/plugins/ProxySwitch/src/stdafx.h +++ b/plugins/ProxySwitch/src/stdafx.h @@ -107,8 +107,6 @@ extern UINT opt_not_restarted; extern COLORREF opt_bgColor; extern COLORREF opt_txtColor; -extern UINT opt_popupPluginInstalled; - void LoadSettings(void); void SaveSettings(void); diff --git a/plugins/Scriver/src/globals.h b/plugins/Scriver/src/globals.h index 0800dda15f..7bb80122aa 100644 --- a/plugins/Scriver/src/globals.h +++ b/plugins/Scriver/src/globals.h @@ -93,7 +93,6 @@ struct GlobalMessageData SendMode sendMode; int tabIconListUsageSize; int smileyAddInstalled; - int popupInstalled; int ieviewInstalled; int limitTabsNum; int limitChatsTabsNum; diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 84d51a4244..6f2ec42c36 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -940,14 +940,13 @@ int OptInitialise(WPARAM wParam, LPARAM) odp.szTab.a = nullptr; g_plugin.addOptions(wParam, &odp); - if (g_dat.popupInstalled) { - odp.position = 910000002; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP); - odp.szGroup.a = LPGEN("Popups"); - odp.szTitle.a = LPGEN("Messaging"); - odp.pfnDlgProc = DlgProcOptionsPopup; - odp.flags = ODPF_BOLDGROUPS; - g_plugin.addOptions(wParam, &odp); - } + //////////////////////////////////////////////////////////////////////////////////////// + odp.position = 910000002; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONSPOPUP); + odp.szGroup.a = LPGEN("Popups"); + odp.szTitle.a = LPGEN("Messaging"); + odp.pfnDlgProc = DlgProcOptionsPopup; + odp.flags = ODPF_BOLDGROUPS; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 88080137e9..9913193237 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -550,7 +550,6 @@ int RegisterToolbarIcons(WPARAM, LPARAM) static int ModuleLoad(WPARAM, LPARAM) { g_dat.smileyAddInstalled = ServiceExists(MS_SMILEYADD_SHOWSELECTION) && ServiceExists(MS_SMILEYADD_REPLACESMILEYS); - g_dat.popupInstalled = ServiceExists(MS_POPUP_ADDPOPUPW); g_dat.ieviewInstalled = ServiceExists(MS_IEVIEW_WINDOW); return 0; } diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index 98ce15c35f..b0e258eadd 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -15,7 +15,6 @@ HICON g_hICO[ICO_CNT], g_hPOP[POP_CNT], g_hIEC[1 + IEC_CNT*MODE_CNT] = {}; HANDLE g_IEC[1 + IEC_CNT*MODE_CNT]; int iBmpDepth; -BOOL bPopupExists = false; BOOL bPGPloaded = false, bPGPkeyrings = false, bUseKeyrings = false, bPGPprivkey = false; BOOL bGPGloaded = false, bGPGkeyrings = false, bSavePass = false; BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM; diff --git a/plugins/SecureIM/src/commonheaders.h b/plugins/SecureIM/src/commonheaders.h index abe1b2f5ad..e2ac1fcc5f 100644 --- a/plugins/SecureIM/src/commonheaders.h +++ b/plugins/SecureIM/src/commonheaders.h @@ -85,7 +85,6 @@ extern int iService, iHook; extern HICON g_hICO[ICO_CNT], g_hIEC[1+IEC_CNT*MODE_CNT], g_hPOP[POP_CNT]; extern HANDLE g_IEC[1+IEC_CNT*MODE_CNT]; extern int iBmpDepth; -extern BOOL bPopupExists; extern BOOL bPGPloaded, bPGPkeyrings, bUseKeyrings, bPGPprivkey; extern BOOL bGPGloaded, bGPGkeyrings, bSavePass; extern BOOL bSFT, bSOM, bASI, bMCD, bSCM, bDGP, bAIP, bNOL, bAAK, bMCM; diff --git a/plugins/SecureIM/src/crypt_popups.cpp b/plugins/SecureIM/src/crypt_popups.cpp index f50b5e308f..98da4619ec 100644 --- a/plugins/SecureIM/src/crypt_popups.cpp +++ b/plugins/SecureIM/src/crypt_popups.cpp @@ -6,8 +6,6 @@ void showPopup(LPCSTR lpzText, MCONTACT hContact, HICON hIcon, UINT type) { - if (!bPopupExists) return; - COLORREF colorBack, colorText; int timeout = 0; diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 5133342c1f..010a065109 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -50,12 +50,6 @@ static HGENMENU MyAddSubItem(HGENMENU hRoot, LPCSTR name, int pos, int poppos, L return res; } -static int onModuleLoad(WPARAM, LPARAM) -{ - bPopupExists = ServiceExists(MS_POPUP_ADDPOPUPW); - return 0; -} - static int onModulesLoaded(WPARAM, LPARAM) { InitNetlib(); @@ -64,7 +58,6 @@ static int onModulesLoaded(WPARAM, LPARAM) InitIcons(); GetFlags(); - onModuleLoad(0, 0); // RSA/AES Sent_NetLog("rsa_init"); @@ -316,8 +309,6 @@ int CMPlugin::Load(void) // hook events HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded); HookEvent(ME_SYSTEM_PRESHUTDOWN, onShutdown); - HookEvent(ME_SYSTEM_MODULELOAD, onModuleLoad); - HookEvent(ME_SYSTEM_MODULEUNLOAD, onModuleLoad); HookEvent(ME_OPT_INITIALISE, onRegisterOptions); g_hEvent[0] = CreateHookableEvent(MODULENAME"/Disabled"); diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 1104b30e18..de2c241c46 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1694,11 +1694,9 @@ int onRegisterOptions(WPARAM wParam, LPARAM lParam) odp.pfnDlgProc = OptionsDlgProc; g_plugin.addOptions(wParam, &odp); - if (bPopupExists) { - odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUP); - odp.szGroup.a = LPGEN("Popups"); - odp.pfnDlgProc = PopOptionsDlgProc; - g_plugin.addOptions(wParam, &odp); - } + odp.pszTemplate = MAKEINTRESOURCE(IDD_POPUP); + odp.szGroup.a = LPGEN("Popups"); + odp.pfnDlgProc = PopOptionsDlgProc; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index 7d2ed64fd5..7773035073 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -83,36 +83,36 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp { DBVARIANT dbv; wchar_t szstamp[256]; - BOOL hasPopups; BYTE bchecked; switch (msg) { case WM_INITDIALOG: - if (hasPopups = (ServiceExists(MS_POPUP_QUERY)) != 0) - hasPopups = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); - TranslateDialogDefault(hdlg); - 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); - ShowWindow(GetDlgItem(hdlg, IDC_LABTTITLE), hasPopups ? SW_SHOW : SW_HIDE); - ShowWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT), hasPopups ? SW_SHOW : SW_HIDE); - CheckDlgButton(hdlg, IDC_POPUPS, (g_plugin.getByte("UsePopups", 0) & hasPopups) ? BST_CHECKED : BST_UNCHECKED); - EnableWindow(GetDlgItem(hdlg, IDC_POPUPS), hasPopups); - hasPopups = IsDlgButtonChecked(hdlg, IDC_POPUPS); - EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP), hasPopups); - EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT), hasPopups); - for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { - char szSetting[100]; - mir_snprintf(szSetting, "Col_%d", i - ID_STATUS_OFFLINE); - DWORD sett = g_plugin.getDword(szSetting, StatusColors15bits[i - ID_STATUS_OFFLINE]); - - COLORREF back, text; - GetColorsFromDWord(&back, &text, sett); - SendDlgItemMessage(hdlg, i, CPM_SETCOLOUR, 0, back); - SendDlgItemMessage(hdlg, i + 20, CPM_SETCOLOUR, 0, text); - EnableWindow(GetDlgItem(hdlg, i), hasPopups); - EnableWindow(GetDlgItem(hdlg, i + 20), hasPopups); + { + int hasPopups = CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0); + 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); + ShowWindow(GetDlgItem(hdlg, IDC_LABTTITLE), hasPopups ? SW_SHOW : SW_HIDE); + ShowWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT), hasPopups ? SW_SHOW : SW_HIDE); + CheckDlgButton(hdlg, IDC_POPUPS, (g_plugin.getByte("UsePopups", 0) & hasPopups) ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hdlg, IDC_POPUPS), hasPopups); + hasPopups = IsDlgButtonChecked(hdlg, IDC_POPUPS); + EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP), hasPopups); + EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT), hasPopups); + + for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { + char szSetting[100]; + mir_snprintf(szSetting, "Col_%d", i - ID_STATUS_OFFLINE); + DWORD sett = g_plugin.getDword(szSetting, StatusColors15bits[i - ID_STATUS_OFFLINE]); + + COLORREF back, text; + GetColorsFromDWord(&back, &text, sett); + SendDlgItemMessage(hdlg, i, CPM_SETCOLOUR, 0, back); + SendDlgItemMessage(hdlg, i + 20, CPM_SETCOLOUR, 0, text); + EnableWindow(GetDlgItem(hdlg, i), hasPopups); + EnableWindow(GetDlgItem(hdlg, i + 20), hasPopups); + } } if (!g_plugin.getWString("PopupStamp", &dbv)) { @@ -160,14 +160,17 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp if (HIWORD(wparam) == BN_CLICKED) { switch (LOWORD(wparam)) { case IDC_POPUPS: - hasPopups = IsDlgButtonChecked(hdlg, IDC_POPUPS); - EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP), hasPopups); - EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT), hasPopups); - for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { - EnableWindow(GetDlgItem(hdlg, i), hasPopups); - EnableWindow(GetDlgItem(hdlg, i + 20), hasPopups); + { + int hasPopups = IsDlgButtonChecked(hdlg, IDC_POPUPS); + EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMP), hasPopups); + EnableWindow(GetDlgItem(hdlg, IDC_POPUPSTAMPTEXT), hasPopups); + for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { + EnableWindow(GetDlgItem(hdlg, i), hasPopups); + EnableWindow(GetDlgItem(hdlg, i + 20), hasPopups); + } } break; + case IDC_DEFAULTCOL: for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { DWORD sett = StatusColors15bits[i - ID_STATUS_OFFLINE]; @@ -495,12 +498,10 @@ int OptionsInit(WPARAM wparam, LPARAM) odp.pfnDlgProc = OptsSettingsDlgProc; g_plugin.addOptions(wparam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS); - odp.szGroup.w = LPGENW("Popups"); - odp.szTitle.w = LPGENW("Last seen"); - odp.pfnDlgProc = OptsPopupsDlgProc; - g_plugin.addOptions(wparam, &odp); - } + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPS); + odp.szGroup.w = LPGENW("Popups"); + odp.szTitle.w = LPGENW("Last seen"); + odp.pfnDlgProc = OptsPopupsDlgProc; + g_plugin.addOptions(wparam, &odp); return 0; } diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 3d0fb768ef..934435e2d4 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -465,9 +465,6 @@ void ShowPopup(MCONTACT hcontact, const char * lpzProto, int newStatus) if (CallService(MS_IGNORE_ISIGNORED, (WPARAM)hcontact, IGNOREEVENT_USERONLINE)) return; - if (!ServiceExists(MS_POPUP_QUERY)) - return; - if (!g_plugin.getByte("UsePopups", 0) || !db_get_b(hcontact, "CList", "Hidden", 0)) return; diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 9e9237a3f5..fc9d77978f 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.PopupExist = ServiceExists(MS_POPUP_ADDPOPUPW); g_myGlobals.PopupActionsExist = ServiceExists(MS_POPUP_REGISTERACTIONS); g_myGlobals.PluginHTTPExist = ServiceExists(MS_HTTP_ACCEPT_CONNECTIONS); g_myGlobals.PluginFTPExist = ServiceExists(MS_FTPFILE_UPLOAD); diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index 028ebd61e8..ee80a0a07a 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -576,7 +576,7 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam) } // create popup - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, APF_NEWDATA); + PUAddPopupW(&pd, APF_NEWDATA); if (MB_TYPE(pMsgBox->uType) == MB_OK) EndDialog(hDlg, IDOK); } @@ -652,7 +652,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? - && ServiceExists(MS_POPUP_ADDPOPUPW) // popups exist? && myGlobals.PopupActionsExist == 1 // popup support ext stuct? && (db_get_dw(0, "Popup", "Actions", 0) & 1) // popup++ actions on? && db_get_b(0, MODNAME, SET_POPUPMSGBOX, DEFVAL_POPUPMSGBOX)) // user likes popups? diff --git a/plugins/SendScreenshotPlus/src/stdafx.h b/plugins/SendScreenshotPlus/src/stdafx.h index a615d173bb..d6be2e6898 100644 --- a/plugins/SendScreenshotPlus/src/stdafx.h +++ b/plugins/SendScreenshotPlus/src/stdafx.h @@ -102,7 +102,6 @@ using namespace std; typedef struct _MGLOBAL { DWORD mirandaVersion; // mirandaVersion - BOOLEAN PopupExist : 1; // Popup or MS_POPUP_ADDPOPUP exist BOOLEAN PopupActionsExist : 1; // Popup++ or MS_POPUP_REGISTERACTIONS exist BOOLEAN PluginHTTPExist : 1; // HTTPServer or MS_HTTP_ACCEPT_CONNECTIONS exist BOOLEAN PluginFTPExist : 1; // FTPFile or MS_FTPFILE_UPLOAD exist diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index 144fd50b30..9cea04b1e6 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -571,12 +571,10 @@ int OnOptInitialize(WPARAM wParam, LPARAM) odp.pfnDlgProc = DlgProcOptionsBayes; g_plugin.addOptions(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_POPUPS); - odp.pfnDlgProc = DlgProcOptionsPopups; - odp.szGroup.a = LPGEN("Popups"); - odp.szTab.a = nullptr; - g_plugin.addOptions(wParam, &odp); - } + odp.pszTemplate = MAKEINTRESOURCEA(IDD_SPAMOTRON_POPUPS); + odp.pfnDlgProc = DlgProcOptionsPopups; + odp.szGroup.a = LPGEN("Popups"); + odp.szTab.a = nullptr; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/StartupSilence/src/main.cpp b/plugins/StartupSilence/src/main.cpp index daac121659..8b7e69fa90 100644 --- a/plugins/StartupSilence/src/main.cpp +++ b/plugins/StartupSilence/src/main.cpp @@ -350,12 +350,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_DELAY2: - if (!ServiceExists(MS_POPUP_QUERY)) { - MessageBox(nullptr, NEEDPOPUP, NOTICE, MB_OK); - CheckDlgButton(hwndDlg, IDC_DELAY2, BST_UNCHECKED); - PopUp = db_set_b(0, MODULENAME, PopUpComp, 0); - } - else PopUp = db_set_b(0, MODULENAME, PopUpComp, IsDlgButtonChecked(hwndDlg, IDC_DELAY2) == BST_CHECKED); + PopUp = db_set_b(0, MODULENAME, PopUpComp, IsDlgButtonChecked(hwndDlg, IDC_DELAY2) == BST_CHECKED); break; case IDC_MENU: diff --git a/plugins/StatusManager/src/keepstatus.cpp b/plugins/StatusManager/src/keepstatus.cpp index 4d36e4e387..e68f2c4a56 100644 --- a/plugins/StatusManager/src/keepstatus.cpp +++ b/plugins/StatusManager/src/keepstatus.cpp @@ -809,7 +809,7 @@ static wchar_t* GetHumanName(LPARAM lParam) static int ProcessPopup(int reason, LPARAM lParam) { - if (!KSPlugin.getByte(SETTING_SHOWCONNECTIONPOPUPS, FALSE) || !ServiceExists(MS_POPUP_ADDPOPUPW)) + if (!KSPlugin.getByte(SETTING_SHOWCONNECTIONPOPUPS, FALSE)) return -1; HICON hIcon = nullptr; diff --git a/plugins/StatusManager/src/ks_options.cpp b/plugins/StatusManager/src/ks_options.cpp index 9415772b5f..18f0394b26 100644 --- a/plugins/StatusManager/src/ks_options.cpp +++ b/plugins/StatusManager/src/ks_options.cpp @@ -35,7 +35,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam SetDlgItemInt(hwndDlg, IDC_MAXRETRIES, db_get_b(0, KSMODULENAME, SETTING_MAXRETRIES, DEFAULT_MAXRETRIES), FALSE); SetDlgItemInt(hwndDlg, IDC_INITDELAY, db_get_dw(0, KSMODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY), FALSE); CheckDlgButton(hwndDlg, IDC_CHECKCONNECTION, db_get_b(0, KSMODULENAME, SETTING_CHECKCONNECTION, FALSE) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWCONNECTIONPOPUPS, (db_get_b(0, KSMODULENAME, SETTING_SHOWCONNECTIONPOPUPS, FALSE) && ServiceExists(MS_POPUP_SHOWMESSAGE)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWCONNECTIONPOPUPS, db_get_b(0, KSMODULENAME, SETTING_SHOWCONNECTIONPOPUPS, FALSE) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHKINET, db_get_b(0, KSMODULENAME, SETTING_CHKINET, FALSE) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CONTCHECK, db_get_b(0, KSMODULENAME, SETTING_CONTCHECK, FALSE) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_BYPING, db_get_b(0, KSMODULENAME, SETTING_BYPING, FALSE) ? BST_CHECKED : BST_UNCHECKED); @@ -72,7 +72,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam lvItem.iItem++; } EnableWindow(GetDlgItem(hwndDlg, IDC_MAXRETRIES), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); - EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), ServiceExists(MS_POPUP_SHOWMESSAGE) && IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); EnableWindow(GetDlgItem(hwndDlg, IDC_INITDELAY), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); EnableWindow(GetDlgItem(hwndDlg, IDC_CHKINET), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)); @@ -92,7 +92,7 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam case IDC_BYPING: BOOL bEnabled = IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXRETRIES), bEnabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), ServiceExists(MS_POPUP_SHOWMESSAGE) && bEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), bEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_INITDELAY), bEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST), bEnabled); EnableWindow(GetDlgItem(hwndDlg, IDC_CHKINET), bEnabled); @@ -289,14 +289,10 @@ static INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L } // delay - EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYCUSTOM), ServiceExists(MS_POPUP_ADDPOPUPW)); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYFROMPU), ServiceExists(MS_POPUP_ADDPOPUPW)); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYPERMANENT), ServiceExists(MS_POPUP_ADDPOPUPW)); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), ServiceExists(MS_POPUP_ADDPOPUPW)); switch (db_get_b(0, KSMODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) { case POPUP_DELAYCUSTOM: CheckDlgButton(hwndDlg, IDC_DELAYCUSTOM, BST_CHECKED); - EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), ServiceExists(MS_POPUP_ADDPOPUPW)); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), TRUE); break; case POPUP_DELAYPERMANENT: @@ -471,15 +467,13 @@ int KeepStatusOptionsInit(WPARAM wparam, LPARAM) odp.pfnDlgProc = DlgProcKSAdvOpts; KSPlugin.addOptions(wparam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - memset(&odp, 0, sizeof(odp)); - odp.position = 150000000; - odp.szGroup.a = LPGEN("Popups"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_PUOPT_KEEPSTATUS); - odp.szTitle.a = LPGEN("Keep status"); - odp.pfnDlgProc = PopupOptDlgProc; - odp.flags = ODPF_BOLDGROUPS; - KSPlugin.addOptions(wparam, &odp); - } + memset(&odp, 0, sizeof(odp)); + odp.position = 150000000; + odp.szGroup.a = LPGEN("Popups"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_PUOPT_KEEPSTATUS); + odp.szTitle.a = LPGEN("Keep status"); + odp.pfnDlgProc = PopupOptDlgProc; + odp.flags = ODPF_BOLDGROUPS; + KSPlugin.addOptions(wparam, &odp); return 0; } diff --git a/plugins/TabSRMM/res/resource.rc b/plugins/TabSRMM/res/resource.rc index 23afa44d5c..853b18dfbb 100644 --- a/plugins/TabSRMM/res/resource.rc +++ b/plugins/TabSRMM/res/resource.rc @@ -114,7 +114,6 @@ BEGIN CONTROL "",IDC_DELAY_ERR_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,253,227,9,13 CONTROL "Use the message log color theme for group chat popups",IDC_MUC_LOGCOLORS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,240,263,12 - LTEXT "No compatible popup plugin was found. The event notification\nsystem is not available.",IDC_NOPOPUPAVAIL,6,30,303,109 END IDD_CHOOSESTATUSMODES DIALOGEX 0, 0, 226, 154 diff --git a/plugins/TabSRMM/src/chat_options.cpp b/plugins/TabSRMM/src/chat_options.cpp index 723b832a37..1ecc58c897 100644 --- a/plugins/TabSRMM/src/chat_options.cpp +++ b/plugins/TabSRMM/src/chat_options.cpp @@ -554,7 +554,7 @@ class CChatSettingsDlg : public CChatBaseOptionDlg TVINSERTSTRUCT tvis = {}; - for (int i = 0; i < nValues; i++) { + for (size_t i = 0; i < nValues; i++) { tvis.hParent = hParent; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE; diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 2f380b2169..9ac79c631f 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -379,9 +379,6 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve if (arPopupList.getCount() >= MAX_POPUPS) return 2; - if (!PluginConfig.g_bPopupAvail) - return 0; - DBEVENTINFO dbe = {}; // fix for a crash if (hEvent && (pluginOptions->bPreview || hContact == 0)) { @@ -472,16 +469,6 @@ static INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPA { TreeViewInit(GetDlgItem(hWnd, IDC_EVENTOPTIONS), CTranslator::TREE_NEN, 0, TRUE); - if (!PluginConfig.g_bPopupAvail) { - HWND hwndChild = FindWindowEx(hWnd, nullptr, nullptr, nullptr); - while (hwndChild) { - ShowWindow(hwndChild, SW_HIDE); - hwndChild = FindWindowEx(hWnd, hwndChild, nullptr, nullptr); - } - Utils::showDlgControl(hWnd, IDC_NOPOPUPAVAIL, SW_SHOW); - } - else Utils::showDlgControl(hWnd, IDC_NOPOPUPAVAIL, SW_HIDE); - SendDlgItemMessage(hWnd, IDC_COLBACK_MESSAGE, CPM_SETCOLOUR, 0, nen_options.colBackMsg); SendDlgItemMessage(hWnd, IDC_COLTEXT_MESSAGE, CPM_SETCOLOUR, 0, nen_options.colTextMsg); SendDlgItemMessage(hWnd, IDC_COLBACK_OTHERS, CPM_SETCOLOUR, 0, nen_options.colBackOthers); @@ -647,9 +634,6 @@ static INT_PTR CALLBACK DlgProcPopupOpts(HWND hWnd, UINT msg, WPARAM wParam, LPA void Popup_Options(WPARAM wParam) { - if (!ServiceExists(MS_POPUP_ADDPOPUPW)) - return; - OPTIONSDIALOGPAGE odp = {}; odp.flags = ODPF_BOLDGROUPS; odp.position = 910000000; @@ -772,9 +756,6 @@ int tabSRMM_ShowPopup(MCONTACT hContact, MEVENT hDbEvent, WORD eventType, int wi return 0; } passed: - if (!PluginConfig.g_bPopupAvail) - return 0; - if (PU_GetByContact(hContact) && nen_options.bMergePopup && eventType == EVENTTYPE_MESSAGE) { if (PopupUpdateT(hContact, hDbEvent) != 0) PopupShowT(&nen_options, hContact, hDbEvent, eventType, pContainer ? pContainer->m_hwnd : nullptr); @@ -787,7 +768,7 @@ passed: // remove all popups for hContact, but only if the mask matches the current "mode" void TSAPI DeletePopupsForContact(MCONTACT hContact, DWORD dwMask) { - if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable || !PluginConfig.g_bPopupAvail) + if (!(dwMask & nen_options.dwRemoveMask) || nen_options.iDisable) return; PLUGIN_DATAT *_T = nullptr; diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 9c4d3b2fe1..052fd72127 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -113,8 +113,6 @@ void CGlobals::reloadSystemModulesChanged() m_hwndClist = g_clistApi.hwndContactList; - g_bPopupAvail = ServiceExists(MS_POPUP_ADDPOPUPW) != 0; - CMenuItem mi(&g_plugin); SET_UID(mi, 0x58d8dc1, 0x1c25, 0x49c0, 0xb8, 0x7c, 0xa3, 0x22, 0x2b, 0x3d, 0xf1, 0xd8); mi.position = -2000090000; @@ -312,8 +310,7 @@ int CGlobals::ModulesLoaded(WPARAM, LPARAM) ::RegisterFontServiceFonts(); ::CacheLogFonts(); - if (PluginConfig.g_bPopupAvail) - TN_ModuleInit(); + TN_ModuleInit(); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, DBSettingChanged); HookEvent(ME_DB_CONTACT_DELETED, DBContactDeleted); diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index f8341fe67e..8863eb1eee 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -68,7 +68,7 @@ public: HICON g_iconOverlayDisabled, g_iconOverlayEnabled, g_iconClock; HCURSOR hCurSplitNS, hCurSplitWE; HBITMAP g_hbmUnknown; - bool g_SmileyAddAvail, g_WantIEView, g_bPopupAvail, g_WantHPP; + bool g_SmileyAddAvail, g_WantIEView, g_WantHPP; HIMAGELIST g_hImageList; HICON g_IconMsgEvent, g_IconTypingEvent, g_IconFileEvent, g_IconSend; HICON g_IconMsgEventBig, g_IconTypingEventBig; diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 14881c39b2..1da41d268b 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -940,12 +940,6 @@ public: SendDlgItemMessage(m_hwnd, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Only when no message window is open")); SendDlgItemMessage(m_hwnd, IDC_MTN_POPUPMODE, CB_SETCURSEL, (WPARAM)M.GetByte("MTN_PopupMode", 0), 0); - - if (!PluginConfig.g_bPopupAvail) { - Utils::showDlgControl(m_hwnd, IDC_NOTIFYPOPUP, SW_HIDE); - Utils::showDlgControl(m_hwnd, IDC_STATIC111, SW_HIDE); - Utils::showDlgControl(m_hwnd, IDC_MTN_POPUPMODE, SW_HIDE); - } return true; } @@ -1448,8 +1442,7 @@ INT_PTR CALLBACK DlgProcSetupStatusModes(HWND hwndDlg, UINT msg, WPARAM wParam, int OptInitialise(WPARAM wParam, LPARAM lParam) { - if (PluginConfig.g_bPopupAvail) - TN_OptionsInitialize(wParam, lParam); + TN_OptionsInitialize(wParam, lParam); // message sessions' options OPTIONSDIALOGPAGE odpnew = {}; diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h index b0ecaae43e..4cb7204346 100644 --- a/plugins/TabSRMM/src/resource.h +++ b/plugins/TabSRMM/src/resource.h @@ -433,7 +433,6 @@ #define IDC_THEME 1394 #define IDC_INFOPANEL 1395 #define IDC_SHOWAVATAR 1396 -#define IDC_NOPOPUPAVAIL 1398 #define IDC_QHTM 1399 #define IDC_TSLABEL_ACTIVE 1400 #define IDC_TSLABEL_INACTIVE 1401 diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 8212a9f840..cad78c179c 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -115,7 +115,7 @@ CSendLaterJob::~CSendLaterJob() /* * show a popup notification, unless they are disabled */ - if (PluginConfig.g_bPopupAvail && fShowPopup) { + if (fShowPopup) { wchar_t *tszName = Clist_GetContactDisplayName(hContact); POPUPDATAW ppd = { 0 }; @@ -678,14 +678,8 @@ INT_PTR CALLBACK CSendLater::DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ::SendMessage(m_hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_LABELTIP | LVS_EX_DOUBLEBUFFER); qMgrSetupColumns(); qMgrFillList(); - if (PluginConfig.g_bPopupAvail) { - ::CheckDlgButton(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, m_fSuccessPopups ? BST_CHECKED : BST_UNCHECKED); - ::CheckDlgButton(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, m_fErrorPopups ? BST_CHECKED : BST_UNCHECKED); - } - else { - Utils::showDlgControl(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, SW_HIDE); - Utils::showDlgControl(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, SW_HIDE); - } + ::CheckDlgButton(m_hwndDlg, IDC_QMGR_SUCCESSPOPUPS, m_fSuccessPopups ? BST_CHECKED : BST_UNCHECKED); + ::CheckDlgButton(m_hwndDlg, IDC_QMGR_ERRORPOPUPS, m_fErrorPopups ? BST_CHECKED : BST_UNCHECKED); ::ShowWindow(hwnd, SW_NORMAL); return FALSE; diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index e4a59d5327..f65d1f8965 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -42,13 +42,10 @@ static colorPicker[4] = static INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM) { Disabled = !Disabled; - - if (PluginConfig.g_bPopupAvail) { - if (!Disabled) - Menu_ModifyItem(hDisableMenu, LPGENW("Disable &typing notification"), IcoLib_GetIcon("tabSRMM_popups_enabled")); - else - Menu_ModifyItem(hDisableMenu, LPGENW("Enable &typing notification"), IcoLib_GetIcon("tabSRMM_popups_disabled")); - } + if (!Disabled) + Menu_ModifyItem(hDisableMenu, LPGENW("Disable &typing notification"), IcoLib_GetIcon("tabSRMM_popups_enabled")); + else + Menu_ModifyItem(hDisableMenu, LPGENW("Enable &typing notification"), IcoLib_GetIcon("tabSRMM_popups_disabled")); return 0; } @@ -85,7 +82,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode) if (db_get_b(hContact, "CList", "Hidden", 0) || (db_get_dw(hContact, "Ignore", "Mask1", 0) & 1)) // 9 - online notification return; - if (!PluginConfig.g_bPopupAvail || Disabled) + if (Disabled) return; wchar_t *szContactName = Clist_GetContactDisplayName(hContact); @@ -167,7 +164,7 @@ void TN_TypingMessage(MCONTACT hContact, int iMode) ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]; ppd.lchContact = hContact; ppd.PluginWindowProc = PopupDlgProc; - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, APF_NEWDATA); + PUAddPopupW(&ppd, APF_NEWDATA); } static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) @@ -215,10 +212,6 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA CheckDlgButton(hwndDlg, IDC_ONEPOPUP, (OnePopup) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWMENU, (ShowMenu) ? BST_CHECKED : BST_UNCHECKED); - Utils::enableDlgControl(hwndDlg, IDC_ONEPOPUP, PluginConfig.g_bPopupAvail); - Utils::enableDlgControl(hwndDlg, IDC_SHOWMENU, PluginConfig.g_bPopupAvail); - Utils::enableDlgControl(hwndDlg, IDC_PREVIEW, PluginConfig.g_bPopupAvail); - newTimeout = Timeout; newTimeoutMode = TimeoutMode; newTimeout2 = Timeout2; @@ -291,72 +284,70 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break; case IDC_PREVIEW: - if (PluginConfig.g_bPopupAvail) { - POPUPDATAW ppd = { 0 }; - for (int i = 0; i < 2; i++) { - int notyping; - if (i == PROTOTYPE_CONTACTTYPING_OFF) { - wcsncpy_s(ppd.lpwzContactName, TranslateT("Contact"), _TRUNCATE); - wcsncpy_s(ppd.lpwzText, szStop, _TRUNCATE); - notyping = 1; - } - else { - wcsncpy_s(ppd.lpwzContactName, TranslateT("Contact"), _TRUNCATE); - wcsncpy_s(ppd.lpwzText, szStart, _TRUNCATE); - notyping = 0; - } - - switch (newColorMode) { - case COLOR_OWN: - ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping + 1].res, CPM_GETCOLOUR, 0, 0); - ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping].res, CPM_GETCOLOUR, 0, 0); + for (int i = 0; i < 2; i++) { + POPUPDATAW ppd = {}; + int notyping; + if (i == PROTOTYPE_CONTACTTYPING_OFF) { + wcsncpy_s(ppd.lpwzContactName, TranslateT("Contact"), _TRUNCATE); + wcsncpy_s(ppd.lpwzText, szStop, _TRUNCATE); + notyping = 1; + } + else { + wcsncpy_s(ppd.lpwzContactName, TranslateT("Contact"), _TRUNCATE); + wcsncpy_s(ppd.lpwzText, szStart, _TRUNCATE); + notyping = 0; + } + + switch (newColorMode) { + case COLOR_OWN: + ppd.colorText = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping + 1].res, CPM_GETCOLOUR, 0, 0); + ppd.colorBack = SendDlgItemMessage(hwndDlg, colorPicker[2 * notyping].res, CPM_GETCOLOUR, 0, 0); + break; + case COLOR_WINDOWS: + ppd.colorBack = GetSysColor(COLOR_BTNFACE); + ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); + break; + case COLOR_POPUP: + default: + ppd.colorBack = ppd.colorText = 0; + break; + } + + if (notyping) + switch (newTimeoutMode2) { + case TIMEOUT_CUSTOM: + ppd.iSeconds = newTimeout2; break; - case COLOR_WINDOWS: - ppd.colorBack = GetSysColor(COLOR_BTNFACE); - ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); + case TIMEOUT_PERMANENT: + ppd.iSeconds = -1; break; - case COLOR_POPUP: + case TIMEOUT_POPUP: default: - ppd.colorBack = ppd.colorText = 0; + ppd.iSeconds = 0; break; - } - - if (notyping) - switch (newTimeoutMode2) { - case TIMEOUT_CUSTOM: - ppd.iSeconds = newTimeout2; - break; - case TIMEOUT_PERMANENT: - ppd.iSeconds = -1; - break; - case TIMEOUT_POPUP: - default: - ppd.iSeconds = 0; - break; - } - else - switch (newTimeoutMode) { - case TIMEOUT_CUSTOM: - ppd.iSeconds = newTimeout; - break; - case TIMEOUT_PROTO: - ppd.iSeconds = 10; - break; - case TIMEOUT_PERMANENT: - ppd.iSeconds = -1; - break; - case TIMEOUT_POPUP: - default: - ppd.iSeconds = 0; - break; - } - - ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]; - ppd.lchContact = wParam; - ppd.PluginWindowProc = nullptr; - ppd.PluginData = nullptr; - PUAddPopupW(&ppd); } + else + switch (newTimeoutMode) { + case TIMEOUT_CUSTOM: + ppd.iSeconds = newTimeout; + break; + case TIMEOUT_PROTO: + ppd.iSeconds = 10; + break; + case TIMEOUT_PERMANENT: + ppd.iSeconds = -1; + break; + case TIMEOUT_POPUP: + default: + ppd.iSeconds = 0; + break; + } + + ppd.lchIcon = PluginConfig.g_buttonBarIcons[ICON_DEFAULT_TYPING]; + ppd.lchContact = wParam; + ppd.PluginWindowProc = nullptr; + ppd.PluginData = nullptr; + PUAddPopupW(&ppd); } break; @@ -489,16 +480,14 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA int TN_OptionsInitialize(WPARAM wParam, LPARAM) { - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - OPTIONSDIALOGPAGE odp = {}; - odp.position = 100000000; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TYPINGNOTIFYPOPUP); - odp.szTitle.a = LPGEN("Typing notify"); - odp.szGroup.a = LPGEN("Popups"); - odp.flags = ODPF_BOLDGROUPS; - odp.pfnDlgProc = DlgProcOpts; - g_plugin.addOptions(wParam, &odp); - } + OPTIONSDIALOGPAGE odp = {}; + odp.position = 100000000; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TYPINGNOTIFYPOPUP); + odp.szTitle.a = LPGEN("Typing notify"); + odp.szGroup.a = LPGEN("Popups"); + odp.flags = ODPF_BOLDGROUPS; + odp.pfnDlgProc = DlgProcOpts; + g_plugin.addOptions(wParam, &odp); return 0; } @@ -527,7 +516,7 @@ int TN_ModuleInit() mir_snwprintf(szStart, TranslateT("...is typing a message.")); mir_snwprintf(szStop, TranslateT("...has stopped typing.")); - if (PluginConfig.g_bPopupAvail && ShowMenu) { + if (ShowMenu) { CreateServiceFunction("TypingNotify/EnableDisableMenuCommand", EnableDisableMenuCommand); CMenuItem mi(&g_plugin); diff --git a/plugins/Toaster/src/main.cpp b/plugins/Toaster/src/main.cpp index cd51eb9819..7aeb3bee78 100644 --- a/plugins/Toaster/src/main.cpp +++ b/plugins/Toaster/src/main.cpp @@ -24,6 +24,10 @@ CMPlugin::CMPlugin() : ///////////////////////////////////////////////////////////////////////////////////////// +extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_POPUP, MIID_LAST }; + +///////////////////////////////////////////////////////////////////////////////////////// + static int OnPreShutdown(WPARAM, LPARAM) { CleanupClasses(); diff --git a/plugins/Toaster/src/options.cpp b/plugins/Toaster/src/options.cpp index a235263cff..7c1e446042 100644 --- a/plugins/Toaster/src/options.cpp +++ b/plugins/Toaster/src/options.cpp @@ -20,18 +20,16 @@ bool COptions::OnInitDialog() void COptions::Shortcut_OnClick(CCtrlBase*) { if (FAILED(TryCreateShortcut())) - { - CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Failed to create shortcut"), (LPARAM)SM_ERROR); - return; - } - CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Shortcut was added to the start menu"), (LPARAM)SM_NOTIFY); + PUShowMessageW(TranslateT("Failed to create shortcut"), SM_ERROR); + else + PUShowMessageW(TranslateT("Shortcut was added to the start menu"), SM_NOTIFY); } void COptions::Preview_OnClick(CCtrlBase*) { - CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Information"), (LPARAM)SM_NOTIFY); - CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Warning"), (LPARAM)SM_WARNING); - CallService(MS_POPUP_SHOWMESSAGEW, (WPARAM)TranslateT("Error"), (LPARAM)SM_ERROR); + PUShowMessageW(TranslateT("Information"), SM_NOTIFY); + PUShowMessageW(TranslateT("Warning"), SM_WARNING); + PUShowMessageW(TranslateT("Error"), SM_ERROR); } void COptions::Enabled_OnChange(CCtrlCheck* chk) diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index 82c7572601..6bc3e1b8e4 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -13,35 +13,25 @@ void __stdcall ShowToastNotification(void* p) return; ptrW imagePath; - if (td->hContact != NULL && td->hContact != INVALID_CONTACT_ID) - { - const char* szProto = GetContactProto(td->hContact); - if (ProtoServiceExists(szProto, PS_GETAVATARINFO)) - { + if (td->hContact != NULL && td->hContact != INVALID_CONTACT_ID) { + const char *szProto = GetContactProto(td->hContact); + if (ProtoServiceExists(szProto, PS_GETAVATARINFO)) { PROTO_AVATAR_INFORMATION pai = { td->hContact }; if (CallProtoService(szProto, PS_GETAVATARINFO, 0, (LPARAM)&pai) == GAIR_SUCCESS) - { imagePath = mir_wstrdup(pai.filename); - } } - if (imagePath == NULL) - { - if (szProto) imagePath = ToasterImage(szProto); - else - { + if (imagePath == NULL) { + if (szProto) + imagePath = ToasterImage(szProto); + else { if (td->iType == 1 && td->hBitmap) imagePath = ToasterImage(td->hBitmap); else if (td->iType == 2 && td->hIcon) imagePath = ToasterImage(td->hIcon); } } } - else - { - if (td->hIcon) - { - imagePath = ToasterImage(td->hIcon); - } - } + else if (td->hIcon) + imagePath = ToasterImage(td->hIcon); new (std::nothrow) ToastNotification(td->tszText, td->tszTitle, imagePath, td->hContact, td->pPopupProc, td->vPopupData); } @@ -175,7 +165,7 @@ void CleanupClasses() static INT_PTR PopupQuery(WPARAM wParam, LPARAM) { - switch (wParam) + switch (wParam) { case PUQS_ENABLEPOPUPS: { @@ -259,4 +249,4 @@ void InitServices() CreateServiceFunction(MS_POPUP_GETCONTACT, GetPopupContact); CreateServiceFunction(MS_POPUP_DESTROYPOPUP, HideToast); -} \ No newline at end of file +} diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index c79ab478d2..9fd318ab9b 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -30,7 +30,7 @@ HWND TrafficHwnd; CMPlugin g_plugin; -BOOL bPopupExists = FALSE, bVariablesExists = FALSE, bTooltipExists = FALSE; +BOOL bVariablesExists = FALSE, bTooltipExists = FALSE; static wchar_t wszDefaultFormat[] = _A2W("{I4}\x0D\x0A\x0A\ @@ -147,7 +147,6 @@ int TrafficCounterShutdown(WPARAM, LPARAM) int ModuleLoad(WPARAM, LPARAM) { - bPopupExists = ServiceExists(MS_POPUP_ADDPOPUPW); bVariablesExists = ServiceExists(MS_VARS_FORMATSTRING) && ServiceExists(MS_VARS_REGISTERTOKEN); bTooltipExists = ServiceExists("mToolTip/ShowTipW") || ServiceExists("mToolTip/ShowTip"); return 0; @@ -872,8 +871,6 @@ void Traffic_AddMainMenuItem(void) /*-------------------------------------------------------------------------------------------------------------------*/ void UpdateNotifyTimer(void) { - if (!bPopupExists) return; - if (Traffic_Notify_time_value && unOptions.NotifyByTime) SetTimer(TrafficHwnd, TIMER_NOTIFY_TICK, Traffic_Notify_time_value * 1000 * 60, nullptr); else diff --git a/plugins/TrafficCounter/src/options.cpp b/plugins/TrafficCounter/src/options.cpp index 796dc87623..c419323d75 100644 --- a/plugins/TrafficCounter/src/options.cpp +++ b/plugins/TrafficCounter/src/options.cpp @@ -359,13 +359,11 @@ int TrafficCounterOptInitialise(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp); // Popups option page - if (bPopupExists) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRAFFIC_POPUPS); - odp.szGroup.a = LPGEN("Popups"); - odp.szTitle.a = LPGEN("Traffic counter"); - odp.pfnDlgProc = DlgProcPopupsTraffic; - odp.flags = ODPF_BOLDGROUPS; - g_plugin.addOptions(wParam, &odp); - } + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRAFFIC_POPUPS); + odp.szGroup.a = LPGEN("Popups"); + odp.szTitle.a = LPGEN("Traffic counter"); + odp.pfnDlgProc = DlgProcPopupsTraffic; + odp.flags = ODPF_BOLDGROUPS; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/plugins/TrafficCounter/src/stdafx.h b/plugins/TrafficCounter/src/stdafx.h index 15037b21cd..01fc381ec8 100644 --- a/plugins/TrafficCounter/src/stdafx.h +++ b/plugins/TrafficCounter/src/stdafx.h @@ -165,7 +165,7 @@ extern char Traffic_AdditionSpace; extern wchar_t Traffic_CounterFormat[512]; extern wchar_t Traffic_TooltipFormat[512]; -extern BOOL bPopupExists, bVariablesExists, bTooltipExists; +extern BOOL bVariablesExists, bTooltipExists; extern BOOL UseKeyColor; extern COLORREF KeyColor; diff --git a/plugins/TranslitSwitcher/src/Layoutproc.cpp b/plugins/TranslitSwitcher/src/Layoutproc.cpp index f020743263..2ddbc3202d 100644 --- a/plugins/TranslitSwitcher/src/Layoutproc.cpp +++ b/plugins/TranslitSwitcher/src/Layoutproc.cpp @@ -376,7 +376,9 @@ void SwitchLayout(bool lastword) wchar_t szClassName[MAX_PATH]; GetClassName(hwnd2, szClassName, _countof(szClassName)); - if ((mir_wstrcmp(szClassName, L"THppRichEdit.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"THistoryGrid.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"TExtHistoryGrid.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"Internet Explorer_Server") == 0) && ServiceExists(MS_POPUP_SHOWMESSAGE)) { // make popup here + + // make popup here + if ((mir_wstrcmp(szClassName, L"THppRichEdit.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"THistoryGrid.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"TExtHistoryGrid.UnicodeClass") == 0 || mir_wstrcmp(szClassName, L"Internet Explorer_Server") == 0)) { wchar_t buf[2048]; if (mir_wstrcmp(szClassName, L"Internet Explorer_Server") == 0) { IEVIEWEVENT event; diff --git a/plugins/UserInfoEx/src/dlg_msgbox.cpp b/plugins/UserInfoEx/src/dlg_msgbox.cpp index 05583dbdf8..4adbd1fdeb 100644 --- a/plugins/UserInfoEx/src/dlg_msgbox.cpp +++ b/plugins/UserInfoEx/src/dlg_msgbox.cpp @@ -567,7 +567,7 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM, LPARAM lParam) } // create popup - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, APF_NEWDATA); + PUAddPopupW(&pd, APF_NEWDATA); if (MB_TYPE(pMsgBox->uType) == MB_OK) EndDialog(hDlg, IDOK); } @@ -642,7 +642,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? - && ServiceExists(MS_POPUP_ADDPOPUPW) // popups exist? && 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? diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp index 7888950cc6..ca4830974c 100644 --- a/plugins/UserInfoEx/src/psp_options.cpp +++ b/plugins/UserInfoEx/src/psp_options.cpp @@ -1068,13 +1068,11 @@ int OnInitOptions(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp); // Popups page - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.szTitle.a = MODULELONGNAME; - odp.szGroup.a = LPGEN("Popups"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP); - odp.pfnDlgProc = DlgProc_Popups; - odp.flags = ODPF_BOLDGROUPS; - g_plugin.addOptions(wParam, &odp); - } + odp.szTitle.a = MODULELONGNAME; + odp.szGroup.a = LPGEN("Popups"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_POPUP); + odp.pfnDlgProc = DlgProc_Popups; + odp.flags = ODPF_BOLDGROUPS; + g_plugin.addOptions(wParam, &odp); return MIR_OK; } diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index 6ad7be5009..f7a11d62c4 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -409,7 +409,7 @@ public: mir_wstrcpy(pd.lpwzText, L" "); _pFnCallBack = pFnCallBack; - _hWnd = (HWND)CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, APF_RETURN_HWND | APF_NEWDATA); + _hWnd = (HWND)PUAddPopupW(&pd, APF_RETURN_HWND | APF_NEWDATA); return _hWnd; } @@ -635,12 +635,10 @@ public: iWait += 5000; if (Size() && !_pProgress) { - if (ServiceExists(MS_POPUP_CHANGETEXTW) && g_plugin.getByte("PopupProgress", FALSE)) { + if (g_plugin.getByte("PopupProgress", FALSE)) _pProgress = new CPopupUpdProgress(this); - } - else { + else _pProgress = new CDlgUpdProgress(this); - } _pProgress->Create(TranslateT("Refresh contact details"), (PUpdCallback)CContactUpdater::DlgProc); _pProgress->SetText(TranslateT("Preparing...")); diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 4f5677e4d6..4dc19b4602 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -830,7 +830,7 @@ void SvcReminderEnable(BYTE bEnable) gRemindOpts.bCListExtraIcon = g_plugin.getByte(SET_REMIND_EXTRAICON, 1); gRemindOpts.bCheckVisibleOnly = g_plugin.getByte(SET_REMIND_CHECKVISIBLE, DEFVAL_REMIND_CHECKVISIBLE); gRemindOpts.bFlashCList = g_plugin.getByte(SET_REMIND_FLASHICON, FALSE); - gRemindOpts.bPopups = ServiceExists(MS_POPUP_ADDPOPUPW) && g_plugin.getByte(SET_POPUP_ENABLED, DEFVAL_POPUP_ENABLED); + gRemindOpts.bPopups = g_plugin.getByte(SET_POPUP_ENABLED, DEFVAL_POPUP_ENABLED); // init the timer UpdateTimer(TRUE); diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp index af551c5107..0ce375b103 100644 --- a/plugins/WhenWasIt/src/dlg_handlers.cpp +++ b/plugins/WhenWasIt/src/dlg_handlers.cpp @@ -217,14 +217,8 @@ INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara CheckDlgButton(hWnd, IDC_USE_DIALOG, (commonData.bUseDialog) ? BST_CHECKED : BST_UNCHECKED); EnableDialogGroup(hWnd, commonData.bUseDialog); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - CheckDlgButton(hWnd, IDC_USE_POPUPS, commonData.bUsePopups ? BST_CHECKED : BST_UNCHECKED); - EnablePopupsGroup(hWnd, commonData.bUsePopups); - } - else { - EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), FALSE); - EnablePopupsGroup(hWnd, FALSE); - } + CheckDlgButton(hWnd, IDC_USE_POPUPS, commonData.bUsePopups ? BST_CHECKED : BST_UNCHECKED); + EnablePopupsGroup(hWnd, commonData.bUsePopups); CheckDlgButton(hWnd, IDC_USE_CLISTICON, BST_CHECKED); EnableWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), FALSE); diff --git a/plugins/WhoUsesMyFiles/src/options.cpp b/plugins/WhoUsesMyFiles/src/options.cpp index 50414b1e37..ffffa5335a 100644 --- a/plugins/WhoUsesMyFiles/src/options.cpp +++ b/plugins/WhoUsesMyFiles/src/options.cpp @@ -19,11 +19,6 @@ along with this program. If not, see . void ShowThePreview() { - if (!ServiceExists(MS_POPUP_ADDPOPUPW)) { - MessageBox(nullptr, TranslateT("Popup plugin not found!"), TranslateT("Error"), MB_OK | MB_ICONSTOP); - return; - } - if (WumfOptions.AlertFolders) { ShowThePopup(nullptr, L"Guest", L"C:\\My Share"); Sleep(300); @@ -108,10 +103,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wparam,LPARAM lpara SendDlgItemMessage(hwndDlg,IDC_COLOR_BACK,CPM_SETCOLOUR,0,WumfOptions.ColorBack); SendDlgItemMessage(hwndDlg,IDC_COLOR_TEXT,CPM_SETCOLOUR,0,WumfOptions.ColorText); } - if ( !ServiceExists(MS_POPUP_ADDPOPUPW)) { - DisableDelayOptions(hwndDlg); - break; - } + CheckDlgButton(hwndDlg, IDC_DELAY_INF, WumfOptions.DelayInf ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DELAY_DEF, WumfOptions.DelayDef ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DELAY_SET, WumfOptions.DelaySet ? BST_CHECKED : BST_UNCHECKED); diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index e393337547..b454001979 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -55,11 +55,6 @@ void LoadOptions() WumfOptions.DelayInf = g_plugin.getByte(DELAY_INF, FALSE); WumfOptions.DelaySet = g_plugin.getByte(DELAY_SET, FALSE); WumfOptions.DelaySec = g_plugin.getByte(DELAY_SEC, 0); - if (!ServiceExists(MS_POPUP_ADDPOPUPW)) { - WumfOptions.DelayDef = TRUE; - WumfOptions.DelaySet = FALSE; - WumfOptions.DelayInf = FALSE; - } WumfOptions.LogToFile = g_plugin.getByte(LOG_INTO_FILE, FALSE); WumfOptions.LogFolders = g_plugin.getByte(LOG_FOLDER, TRUE); WumfOptions.AlertFolders = g_plugin.getByte(ALERT_FOLDER, TRUE); -- cgit v1.2.3