diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-05 21:10:22 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-05 21:10:22 +0300 |
commit | d9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 (patch) | |
tree | f09baaf9b91477d009cedc5bd77449b0fa3e3af7 /protocols | |
parent | 8a1ff32e54b39ceef22df61bda17bbfda94918fc (diff) |
Popup:
- wiping out checks for service presence;
- code cleaning
Diffstat (limited to 'protocols')
26 files changed, 185 insertions, 307 deletions
diff --git a/protocols/CloudFile/src/utils.cpp b/protocols/CloudFile/src/utils.cpp index 79b743f5c2..b386afe597 100644 --- a/protocols/CloudFile/src/utils.cpp +++ b/protocols/CloudFile/src/utils.cpp @@ -5,13 +5,12 @@ void ShowNotification(const wchar_t *caption, const wchar_t *message, int flags, if (Miranda_IsTerminated()) return; - if (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { + if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) { POPUPDATAW ppd = { 0 }; ppd.lchContact = hContact; wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME); wcsncpy(ppd.lpwzText, message, MAX_SECONDLINE); ppd.lchIcon = IcoLib_GetIcon("Slack_main"); - if (!PUAddPopupW(&ppd)) return; } diff --git a/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp b/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp index 592fd551ba..c35877dc4c 100644 --- a/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp +++ b/protocols/CurrencyRates/src/CurrencyRatesProviderBase.cpp @@ -443,9 +443,6 @@ bool show_popup(const ICurrencyRatesProvider *pProvider, const tstring& rsFormat, const CPopupSettings& ps) { - if (!ServiceExists(MS_POPUP_ADDPOPUPW)) - return false; - POPUPDATAW ppd; memset(&ppd, 0, sizeof(ppd)); ppd.lchContact = hContact; @@ -490,11 +487,11 @@ bool show_popup(const ICurrencyRatesProvider *pProvider, break; } - LPARAM lp = 0; + int lp = 0; if (false == ps.GetHistoryFlag()) - lp |= 0x08; + lp |= APF_NO_POPUP; - return (0 == CallService(MS_POPUP_ADDPOPUPW, reinterpret_cast<WPARAM>(&ppd), lp)); + return (0 == PUAddPopupW(&ppd, lp)); } void CCurrencyRatesProviderBase::WriteContactRate(MCONTACT hContact, double dRate, const tstring& rsSymbol/* = ""*/) diff --git a/protocols/CurrencyRates/src/SettingsDlg.cpp b/protocols/CurrencyRates/src/SettingsDlg.cpp index 0d919d76a0..2673774049 100644 --- a/protocols/CurrencyRates/src/SettingsDlg.cpp +++ b/protocols/CurrencyRates/src/SettingsDlg.cpp @@ -38,48 +38,34 @@ void update_popup_controls(HWND hDlg) ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_SETTINGS), bEnable); } -bool enable_popup_controls(HWND hDlg) -{ - bool bIsPopupServiceEnabled = 1 == ServiceExists(MS_POPUP_ADDPOPUPW); - ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP), bIsPopupServiceEnabled); - ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_POPUP_FORMAT), bIsPopupServiceEnabled); - ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED), bIsPopupServiceEnabled); - ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_POPUP_FORMAT), bIsPopupServiceEnabled); - ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_FORMAT_DESCRIPTION), bIsPopupServiceEnabled); - ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_SETTINGS), bIsPopupServiceEnabled); - - return bIsPopupServiceEnabled; -} - void update_all_controls(HWND hDlg) { bool bIsCheckedContactSpec = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_CONTACT_SPECIFIC)); bool bIsCheckedExternal = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_EXTERNAL_FILE)); ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_EXTERNAL_FILE), bIsCheckedContactSpec); - ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_FILE_NAME), (bIsCheckedContactSpec&&bIsCheckedExternal)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_SELECT_FILE), (bIsCheckedContactSpec&&bIsCheckedExternal)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_BROWSE), (bIsCheckedContactSpec&&bIsCheckedExternal)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_LOG_FILE_FORMAT), (bIsCheckedContactSpec&&bIsCheckedExternal)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_LOG_FILE_FORMAT), (bIsCheckedContactSpec&&bIsCheckedExternal)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_LOG_FILE_DESCRIPTION), (bIsCheckedContactSpec&&bIsCheckedExternal)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_LOG_FILE_CONDITION), (bIsCheckedContactSpec&&bIsCheckedExternal)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_FILE_NAME), (bIsCheckedContactSpec && bIsCheckedExternal)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_SELECT_FILE), (bIsCheckedContactSpec && bIsCheckedExternal)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_BROWSE), (bIsCheckedContactSpec && bIsCheckedExternal)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_LOG_FILE_FORMAT), (bIsCheckedContactSpec && bIsCheckedExternal)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_LOG_FILE_FORMAT), (bIsCheckedContactSpec && bIsCheckedExternal)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_LOG_FILE_DESCRIPTION), (bIsCheckedContactSpec && bIsCheckedExternal)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_LOG_FILE_CONDITION), (bIsCheckedContactSpec && bIsCheckedExternal)); bool bIsCheckedHistory = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_INTERNAL_HISTORY)); ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_INTERNAL_HISTORY), bIsCheckedContactSpec); - ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_HISTORY_FORMAT), (bIsCheckedContactSpec&&bIsCheckedHistory)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_HISTORY_FORMAT), (bIsCheckedContactSpec&&bIsCheckedHistory)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_HISTORY_DESCRIPTION), (bIsCheckedContactSpec&&bIsCheckedHistory)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_HISTORY_CONDITION), (bIsCheckedContactSpec&&bIsCheckedHistory)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_HISTORY_FORMAT), (bIsCheckedContactSpec && bIsCheckedHistory)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_HISTORY_FORMAT), (bIsCheckedContactSpec && bIsCheckedHistory)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_HISTORY_DESCRIPTION), (bIsCheckedContactSpec && bIsCheckedHistory)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_HISTORY_CONDITION), (bIsCheckedContactSpec && bIsCheckedHistory)); - bool bIsPopupServiceEnabled = 1 == ServiceExists(MS_POPUP_ADDPOPUPW); bool bIsCheckedShowPopup = (1 == ::IsDlgButtonChecked(hDlg, IDC_CHECK_SHOW_POPUP)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP), (bIsCheckedContactSpec&&bIsPopupServiceEnabled)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_POPUP_FORMAT), (bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED), (bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_POPUP_FORMAT), (bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_FORMAT_DESCRIPTION), (bIsCheckedContactSpec&&bIsPopupServiceEnabled&&bIsCheckedShowPopup)); - ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_SETTINGS), (bIsCheckedContactSpec&&bIsPopupServiceEnabled)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP), (bIsCheckedContactSpec)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_EDIT_POPUP_FORMAT), (bIsCheckedContactSpec && bIsCheckedShowPopup)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED), (bIsCheckedContactSpec && bIsCheckedShowPopup)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_STATIC_POPUP_FORMAT), (bIsCheckedContactSpec && bIsCheckedShowPopup)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_FORMAT_DESCRIPTION), (bIsCheckedContactSpec && bIsCheckedShowPopup)); + ::EnableWindow(::GetDlgItem(hDlg, IDC_BUTTON_POPUP_SETTINGS), (bIsCheckedContactSpec)); } std::vector<wchar_t> get_filter() @@ -393,7 +379,7 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L } } - if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty())) { + if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty())) { prepare_edit_ctrl_for_error(hwndHistoryFrmt); CurrencyRates_MessageBox(hWnd, TranslateT("Enter history format."), MB_OK | MB_ICONERROR); bOk = false; @@ -401,7 +387,7 @@ INT_PTR CALLBACK EditSettingsPerContactDlgProc(HWND hWnd, UINT msg, WPARAM wp, L HWND hwndPopupFrmt = ::GetDlgItem(hWnd, IDC_EDIT_POPUP_FORMAT); tstring sPopupFormat = get_window_text(hwndPopupFrmt); - if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty())) { + if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty())) { prepare_edit_ctrl_for_error(hwndPopupFrmt); CurrencyRates_MessageBox(hWnd, TranslateT("Enter popup window format."), MB_OK | MB_ICONERROR); bOk = false; @@ -503,8 +489,7 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, ::SetDlgItemText(hWnd, IDC_EDIT_POPUP_FORMAT, pAdvSettings->GetPopupFormat().c_str()); ::CheckDlgButton(hWnd, IDC_CHECK_SHOW_POPUP_ONLY_VALUE_CHANGED, (pAdvSettings->GetShowPopupIfValueChangedFlag()) ? BST_CHECKED : BST_UNCHECKED); - if (true == enable_popup_controls(hWnd)) - update_popup_controls(hWnd); + update_popup_controls(hWnd); ::SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pAdvSettings)); } @@ -552,7 +537,7 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, HWND hwndHistoryFrmt = ::GetDlgItem(hWnd, IDC_EDIT_HISTORY_FORMAT); tstring sHistoryFormat = get_window_text(hwndHistoryFrmt); - if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty())) { + if ((true == bOk) && (nLogMode&lmInternalHistory) && (true == sHistoryFormat.empty())) { prepare_edit_ctrl_for_error(hwndHistoryFrmt); CurrencyRates_MessageBox(hWnd, TranslateT("Enter history format."), MB_OK | MB_ICONERROR); bOk = false; @@ -560,7 +545,7 @@ INT_PTR CALLBACK EditSettingsPerProviderDlgProc(HWND hWnd, UINT msg, WPARAM wp, HWND hwndPopupFrmt = ::GetDlgItem(hWnd, IDC_EDIT_POPUP_FORMAT); tstring sPopupFormat = get_window_text(hwndPopupFrmt); - if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty())) { + if ((true == bOk) && (nLogMode&lmPopup) && (true == sPopupFormat.empty())) { prepare_edit_ctrl_for_error(hwndPopupFrmt); CurrencyRates_MessageBox(hWnd, TranslateT("Enter popup window format."), MB_OK | MB_ICONERROR); bOk = false; @@ -790,14 +775,14 @@ CPopupSettings::CPopupSettings() : { BYTE m = db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupColourMode, static_cast<BYTE>(m_modeColour)); - if (m >= colourDefault && m <= colourUserDefined) + if (m >= colourDefault && m <= colourUserDefined) m_modeColour = static_cast<EColourMode>(m); m_rgbBkg = db_get_dw(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupBkColour, m_rgbBkg); m_rgbText = db_get_dw(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupTextColour, m_rgbText); m = db_get_b(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupDelayMode, static_cast<BYTE>(m_modeDelay)); - if (m >= delayFromPopup && m <= delayPermanent) { + if (m >= delayFromPopup && m <= delayPermanent) { m_modeDelay = static_cast<EDelayMode>(m); } m_wDelay = db_get_w(0, CURRENCYRATES_MODULE_NAME, DB_KEY_PopupDelayTimeout, m_wDelay); @@ -819,7 +804,7 @@ COLORREF CPopupSettings::GetDefColourText() void CPopupSettings::InitForContact(MCONTACT hContact) { BYTE m = db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_MODE, static_cast<BYTE>(m_modeColour)); - if (m >= CPopupSettings::colourDefault && m <= CPopupSettings::colourUserDefined) { + if (m >= CPopupSettings::colourDefault && m <= CPopupSettings::colourUserDefined) { m_modeColour = static_cast<CPopupSettings::EColourMode>(m); } @@ -827,7 +812,7 @@ void CPopupSettings::InitForContact(MCONTACT hContact) m_rgbText = db_get_dw(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_COLOUR_TEXT, m_rgbText); m = db_get_b(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_DELAY_MODE, static_cast<BYTE>(m_modeDelay)); - if (m >= CPopupSettings::delayFromPopup && m <= CPopupSettings::delayPermanent) { + if (m >= CPopupSettings::delayFromPopup && m <= CPopupSettings::delayPermanent) { m_modeDelay = static_cast<CPopupSettings::EDelayMode>(m); } m_wDelay = db_get_w(hContact, CURRENCYRATES_MODULE_NAME, DB_STR_CURRENCYRATE_POPUP_DELAY_TIMEOUT, m_wDelay); diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index 7f2cfaae14..fdcc2029af 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -68,24 +68,21 @@ HWND FacebookProto::NotifyEvent(const wchar_t* title, const wchar_t* text, MCONT } if (!getByte(FACEBOOK_KEY_SYSTRAY_NOTIFY, DEFAULT_SYSTRAY_NOTIFY)) { - if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) { - POPUPDATACLASS pd = { sizeof(pd) }; - pd.pwszTitle = title; - pd.pwszText = text; - pd.pszClassName = name; - pd.hContact = contact; - - if (url != nullptr || notification_id != nullptr) { - popup_data *data = new popup_data(this); - if (url != nullptr) - data->url = *url; - if (notification_id != nullptr) - data->notification_id = *notification_id; - pd.PluginData = data; - } - - return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&pd); + POPUPDATACLASS pd = { sizeof(pd) }; + pd.pwszTitle = title; + pd.pwszText = text; + pd.pszClassName = name; + pd.hContact = contact; + + if (url != nullptr || notification_id != nullptr) { + popup_data *data = new popup_data(this); + if (url != nullptr) + data->url = *url; + if (notification_id != nullptr) + data->notification_id = *notification_id; + pd.PluginData = data; } + return (HWND)CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&pd); } else { if (!Clist_TrayNotifyW(m_szModuleName, title, text, type == EVENT_CLIENT ? NIIF_WARNING : NIIF_INFO, 10000)) diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 705e1ae521..21293f11b3 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -328,10 +328,7 @@ void FacebookProto::LoadHistory(void *pParam) wcsncpy(pd.lpwzContactName, m_tszUserName, MAX_CONTACTNAME); wcsncpy(pd.lpwzText, TranslateT("Loading history started."), MAX_SECONDLINE); - HWND popupHwnd = nullptr; - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - popupHwnd = (HWND)CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, (LPARAM)APF_RETURN_HWND); - } + HWND popupHwnd = (HWND)PUAddPopupW(&pd, (LPARAM)APF_RETURN_HWND); std::vector<facebook_message> messages; std::string firstTimestamp; @@ -409,13 +406,12 @@ void FacebookProto::LoadHistory(void *pParam) CMStringW text; text.AppendFormat(TranslateT("Loading messages: %d/%d"), loadedMessages, messagesCount); - if (ServiceExists(MS_POPUP_CHANGETEXTW) && popupHwnd) { + if (popupHwnd) PUChangeTextW(popupHwnd, text); - } - else if (ServiceExists(MS_POPUP_ADDPOPUPW)) { + else { wcsncpy(pd.lpwzText, text, MAX_SECONDLINE); pd.iSeconds = 1; - popupHwnd = (HWND)CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, (LPARAM)0); + popupHwnd = (HWND)PUAddPopupW(&pd); } // There is no more messages @@ -431,12 +427,12 @@ void FacebookProto::LoadHistory(void *pParam) // Reset loading history flag facy.loading_history = false; - if (ServiceExists(MS_POPUP_CHANGETEXTW) && popupHwnd) + if (popupHwnd) PUChangeTextW(popupHwnd, TranslateT("Loading history completed.")); - else if (ServiceExists(MS_POPUP_ADDPOPUPW)) { + else { pd.iSeconds = 5; wcsncpy(pd.lpwzText, TranslateT("Loading history completed."), MAX_SECONDLINE); - popupHwnd = (HWND)CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&pd, (LPARAM)0); + popupHwnd = (HWND)PUAddPopupW(&pd); } } diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 9176da06e7..4807733917 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -949,22 +949,19 @@ retry: }
gg_LeaveCriticalSection(&sessions_mutex, "mainthread", 19, 1, "sessions_mutex", 1);
sessions_updatedlg();
- if (ServiceExists(MS_POPUP_ADDPOPUPCLASS))
- {
- const wchar_t* szText = time(0) - logonTime > 3
- ? TranslateT("You have logged in at another location")
- : TranslateT("You are logged in at another location");
- for (i = 0; i < e->event.multilogon_info.count; i++)
- {
- wchar_t szMsg[MAX_SECONDLINE];
- if (iIndexes && iIndexes[i])
- continue;
-
- mir_snwprintf(szMsg, L"%s (%s)", szText,
- *e->event.multilogon_info.sessions[i].name != '\0' ?
- _A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
- showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
- }
+
+ const wchar_t* szText = time(0) - logonTime > 3
+ ? TranslateT("You have logged in at another location")
+ : TranslateT("You are logged in at another location");
+ for (i = 0; i < e->event.multilogon_info.count; i++) {
+ wchar_t szMsg[MAX_SECONDLINE];
+ if (iIndexes && iIndexes[i])
+ continue;
+
+ mir_snwprintf(szMsg, L"%s (%s)", szText,
+ *e->event.multilogon_info.sessions[i].name != '\0' ?
+ _A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
+ showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
}
mir_free(iIndexes);
}
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index dd9c32d105..962c570002 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -105,48 +105,21 @@ void GaduProto::initpopups() //
void CALLBACK sttMainThreadCallback(PVOID dwParam)
{
- PopupData* puData = (PopupData*)dwParam;
- GaduProto* gg = puData->gg;
-
- if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- char szName[256];
- POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = puData->title;
- ppd.pwszText = puData->text;
- ppd.PluginData = puData;
- ppd.pszClassName = szName;
-
- if (puData->flags & GG_POPUP_ERROR || puData->flags & GG_POPUP_WARNING)
- mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Error");
- else
- mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Notify");
-
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
- return;
- }
-
- if (puData->flags & GG_POPUP_ALLOW_MSGBOX) {
- BOOL bShow = TRUE;
-
- if (puData->flags & GG_POPUP_ONCE) {
- HWND hWnd = FindWindow(nullptr, gg->m_tszUserName);
- while (hWnd != nullptr) {
- if (FindWindowEx(hWnd, nullptr, nullptr, puData->text) != nullptr) {
- bShow = FALSE;
- break;
- }
- hWnd = FindWindowEx(nullptr, hWnd, nullptr, gg->m_tszUserName);
- }
- }
-
- if (bShow) {
- UINT uIcon = puData->flags & GG_POPUP_ERROR ? MB_ICONERROR : puData->flags & GG_POPUP_WARNING ? MB_ICONEXCLAMATION : MB_ICONINFORMATION;
- MessageBox(nullptr, puData->text, gg->m_tszUserName, MB_OK | uIcon);
- }
- }
- mir_free(puData->title);
- mir_free(puData->text);
- mir_free(puData);
+ PopupData *puData = (PopupData*)dwParam;
+ GaduProto *gg = puData->gg;
+
+ char szName[256];
+ POPUPDATACLASS ppd = { sizeof(ppd) };
+ ppd.pwszTitle = puData->title;
+ ppd.pwszText = puData->text;
+ ppd.PluginData = puData;
+ ppd.pszClassName = szName;
+
+ if (puData->flags & GG_POPUP_ERROR || puData->flags & GG_POPUP_WARNING)
+ mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Error");
+ else
+ mir_snprintf(szName, "%s_%s", gg->m_szModuleName, "Notify");
+ CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
void GaduProto::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags)
diff --git a/protocols/ICQ-WIM/src/main.cpp b/protocols/ICQ-WIM/src/main.cpp index 21232e7d25..5b5449eb8e 100644 --- a/protocols/ICQ-WIM/src/main.cpp +++ b/protocols/ICQ-WIM/src/main.cpp @@ -20,7 +20,7 @@ #include "stdafx.h" -bool g_bPopupService, g_bSecureIM, g_bMessageState; +bool g_bSecureIM, g_bMessageState; HWND g_hwndHeartbeat; @@ -96,7 +96,6 @@ static INT_PTR ICQPermitDeny(WPARAM hContact, LPARAM, LPARAM bAllow) static int ModuleLoad(WPARAM, LPARAM) { g_bSecureIM = ServiceExists("SecureIM/IsContactSecured"); - g_bPopupService = ServiceExists(MS_POPUP_ADDPOPUPW); g_bMessageState = ServiceExists(MS_MESSAGESTATE_UPDATE); return 0; } diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index ce82808092..21f0b57ddb 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -126,28 +126,25 @@ void CIcqProto::ConnectionFailed(int iReason, int iErrorCode) { debugLogA("ConnectionFailed -> reason %d", iReason); - if (g_bPopupService) { - POPUPDATAW Popup = {}; - Popup.lchIcon = IcoLib_GetIconByHandle(Skin_GetIconHandle(SKINICON_ERROR), true); - wcscpy_s(Popup.lpwzContactName, m_tszUserName); - switch (iReason) { - case LOGINERR_BADUSERID: - mir_snwprintf(Popup.lpwzText, LPGENW("You have not entered an ICQ number.\nConfigure this in Options -> Network -> ICQ and try again.")); - break; - case LOGINERR_WRONGPASSWORD: - mir_snwprintf(Popup.lpwzText, LPGENW("Connection failed.\nYour ICQ number or password was rejected (%d)."), iErrorCode); - break; - case LOGINERR_NONETWORK: - case LOGINERR_NOSERVER: - mir_snwprintf(Popup.lpwzText, LPGENW("Connection failed.\nThe server is temporarily unavailable (%d)."), iErrorCode); - break; - default: - mir_snwprintf(Popup.lpwzText, LPGENW("Connection failed.\nUnknown error during sign on: %d"), iErrorCode); - break; - } - - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&Popup, 0); + POPUPDATAW Popup = {}; + Popup.lchIcon = IcoLib_GetIconByHandle(Skin_GetIconHandle(SKINICON_ERROR), true); + wcscpy_s(Popup.lpwzContactName, m_tszUserName); + switch (iReason) { + case LOGINERR_BADUSERID: + mir_snwprintf(Popup.lpwzText, LPGENW("You have not entered an ICQ number.\nConfigure this in Options -> Network -> ICQ and try again.")); + break; + case LOGINERR_WRONGPASSWORD: + mir_snwprintf(Popup.lpwzText, LPGENW("Connection failed.\nYour ICQ number or password was rejected (%d)."), iErrorCode); + break; + case LOGINERR_NONETWORK: + case LOGINERR_NOSERVER: + mir_snwprintf(Popup.lpwzText, LPGENW("Connection failed.\nThe server is temporarily unavailable (%d)."), iErrorCode); + break; + default: + mir_snwprintf(Popup.lpwzText, LPGENW("Connection failed.\nUnknown error during sign on: %d"), iErrorCode); + break; } + PUAddPopupW(&Popup); ProtoBroadcastAck(0, ACKTYPE_LOGIN, ACKRESULT_FAILED, nullptr, iReason); ShutdownSession(); diff --git a/protocols/ICQ-WIM/src/stdafx.h b/protocols/ICQ-WIM/src/stdafx.h index e229041482..b216ec459a 100644 --- a/protocols/ICQ-WIM/src/stdafx.h +++ b/protocols/ICQ-WIM/src/stdafx.h @@ -103,5 +103,5 @@ int StatusFromString(const CMStringW&); char* time2text(time_t time); extern HWND g_hwndHeartbeat; -extern bool g_bPopupService, g_bSecureIM, g_bMessageState; +extern bool g_bSecureIM, g_bMessageState; extern IconItem iconList[]; diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index 988984d781..7004bfa6c1 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -320,16 +320,14 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA void CIcqProto::EmailNotification(const wchar_t *pwszText) { - if (g_bPopupService) { - POPUPDATAW Popup = {}; - Popup.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib); - wcsncpy_s(Popup.lpwzText, pwszText, _TRUNCATE); - wcsncpy_s(Popup.lpwzContactName, m_tszUserName, _TRUNCATE); - Popup.iSeconds = 20; - Popup.PluginData = this; - Popup.PluginWindowProc = PopupDlgProc; - PUAddPopupW(&Popup); - } + POPUPDATAW Popup = {}; + Popup.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib); + wcsncpy_s(Popup.lpwzText, pwszText, _TRUNCATE); + wcsncpy_s(Popup.lpwzContactName, m_tszUserName, _TRUNCATE); + Popup.iSeconds = 20; + Popup.PluginData = this; + Popup.PluginWindowProc = PopupDlgProc; + PUAddPopupW(&Popup); if (m_bUseTrayIcon) { char szServiceFunction[MAX_PATH]; diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index 57c1fa9dfd..beb3ad7389 100755 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -425,22 +425,15 @@ void CJabberProto::InitPopups(void) void CJabberProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar_t *szTitle)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- char name[256];
-
- POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = szTitle;
- ppd.pwszText = szMsg;
- ppd.pszClassName = name;
- ppd.hContact = hContact;
- mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
+ char name[256];
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
- }
- else {
- DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP;
- MessageBox(nullptr, szMsg, szTitle, mtype);
- }
+ POPUPDATACLASS ppd = { sizeof(ppd) };
+ ppd.pwszTitle = szTitle;
+ ppd.pwszText = szMsg;
+ ppd.pszClassName = name;
+ ppd.hContact = hContact;
+ mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
+ CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
CMStringA CJabberProto::ExtractImage(const TiXmlElement *node)
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 3f22ea4e3d..51c75757c1 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -828,7 +828,7 @@ void CALLBACK sttMainThreadCallback(void *param) PopupData* pud = (PopupData*)param;
bool iserr = (pud->flags & MSN_SHOW_ERROR) != 0;
- if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups) || !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
+ if ((iserr && !pud->proto->MyOptions.ShowErrorsAsPopups)) {
if (pud->flags & MSN_ALLOW_MSGBOX) {
wchar_t szMsg[MAX_SECONDLINE + MAX_CONTACTNAME];
mir_snwprintf(szMsg, L"%s:\n%s", pud->title, pud->text);
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index 505a4d6538..44fddd4a4d 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -159,12 +159,6 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA }
}
-
- if (!ServiceExists(MS_POPUP_ADDPOPUPW)) {
- HWND hw = GetDlgItem(hwndDlg, IDC_RAD_ERRPOP);
- EnableWindow(hw, FALSE);
- }
-
switch (proto->options.err_method) {
case ED_POP: CheckDlgButton(hwndDlg, IDC_RAD_ERRPOP, BST_CHECKED); break;
case ED_MB: CheckDlgButton(hwndDlg, IDC_RAD_ERRMB, BST_CHECKED); break;
@@ -396,15 +390,10 @@ void CSametimeProto::LoadOptions() // if popups not installed, will be changed to 'ED_BAL' (balloons) in main.cpp, modules loaded
options.err_method = (ErrorDisplay)db_get_b(0, m_szModuleName, "ErrorDisplay", ED_POP);
- // funny logic :) ... try to avoid message boxes
- // if want popups but no popups, try baloons
- if (options.err_method == ED_POP && !ServiceExists(MS_POPUP_SHOWMESSAGE))
- options.err_method = ED_BAL;
-
- debugLogW(L"LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]", options.server_name == nullptr ? -1 : mir_strlen(options.server_name), options.id == nullptr ? -1 : mir_strlen(options.id), options.pword == nullptr ? -1 : mir_strlen(options.pword));
- debugLogW(L"LoadOptions() loaded: port=[%d], encrypt_session=[%d], ClientID=[%d], ClientVersionMajor=[%d], ClientVersionMinor=[%d]", options.port, options.encrypt_session, options.client_id, options.client_versionMajor, options.client_versionMinor);
- debugLogW(L"LoadOptions() loaded: get_server_contacts=[%d], add_contacts=[%d], idle_as_away=[%d], err_method=[%d]", options.get_server_contacts, options.add_contacts, options.idle_as_away, options.err_method);
+ debugLogA("LoadOptions() loaded: ServerName:len=[%d], id:len=[%d], pword:len=[%d]", options.server_name == nullptr ? -1 : mir_strlen(options.server_name), options.id == nullptr ? -1 : mir_strlen(options.id), options.pword == nullptr ? -1 : mir_strlen(options.pword));
+ debugLogA("LoadOptions() loaded: port=[%d], encrypt_session=[%d], ClientID=[%d], ClientVersionMajor=[%d], ClientVersionMinor=[%d]", options.port, options.encrypt_session, options.client_id, options.client_versionMajor, options.client_versionMinor);
+ debugLogA("LoadOptions() loaded: get_server_contacts=[%d], add_contacts=[%d], idle_as_away=[%d], err_method=[%d]", options.get_server_contacts, options.add_contacts, options.idle_as_away, options.err_method);
}
void CSametimeProto::SaveOptions()
diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp index e20178b2a5..ba00d60709 100644 --- a/protocols/SkypeWeb/src/skype_popups.cpp +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -47,35 +47,28 @@ void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *messag if (Miranda_IsTerminated())
return;
- if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- CMStringA className(FORMAT, "%s_", m_szModuleName);
+ CMStringA className(FORMAT, "%s_", m_szModuleName);
- switch (type) {
- case 1:
- className.Append("Error");
- break;
-
- case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
- className.Append("Call");
- break;
-
- default:
- className.Append("Notification");
- break;
- }
+ switch (type) {
+ case 1:
+ className.Append("Error");
+ break;
- POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = caption;
- ppd.pwszText = message;
- ppd.pszClassName = className.GetBuffer();
- ppd.hContact = hContact;
+ case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
+ className.Append("Call");
+ break;
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
- }
- else {
- DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP;
- MessageBox(nullptr, message, caption, mtype);
+ default:
+ className.Append("Notification");
+ break;
}
+
+ POPUPDATACLASS ppd = { sizeof(ppd) };
+ ppd.pwszTitle = caption;
+ ppd.pwszText = message;
+ ppd.pszClassName = className.GetBuffer();
+ ppd.hContact = hContact;
+ CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
void CSkypeProto::ShowNotification(const wchar_t *message, MCONTACT hContact)
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp index 3ddab742f8..901fc4089d 100644 --- a/protocols/Steam/src/steam_utils.cpp +++ b/protocols/Steam/src/steam_utils.cpp @@ -51,8 +51,7 @@ void CSteamProto::ShowNotification(const wchar_t *caption, const wchar_t *messag if (Miranda_IsTerminated())
return;
- if (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1))
- {
+ if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
POPUPDATAW ppd = { 0 };
ppd.lchContact = hContact;
wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 3a80c48044..421f16e09e 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -104,7 +104,7 @@ void CToxProto::ShowNotification(const wchar_t *caption, const wchar_t *message, return;
}
- if (ServiceExists(MS_POPUP_ADDPOPUPW) && db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
+ if (db_get_b(0, "Popup", "ModuleIsEnabled", 1)) {
POPUPDATAW ppd = { 0 };
ppd.lchContact = hContact;
wcsncpy(ppd.lpwzContactName, caption, MAX_CONTACTNAME);
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 195fca892f..096ef0bb4c 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -484,9 +484,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM void TwitterProto::ShowContactPopup(MCONTACT hContact, const std::string &text, const std::string *url)
{
- if (!ServiceExists(MS_POPUP_ADDPOPUPW) || getByte(TWITTER_KEY_POPUP_SHOW) == 0) {
+ if (!getByte(TWITTER_KEY_POPUP_SHOW))
return;
- }
POPUPDATAW popup = {};
popup.lchContact = hContact;
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 2664441c12..8ff0f75444 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -279,12 +279,10 @@ int TwitterProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.pfnDlgProc = options_proc;
g_plugin.addOptions(wParam, &odp);
- if (ServiceExists(MS_POPUP_ADDPOPUPW)) {
- odp.szTab.w = LPGENW("Popups");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS);
- odp.pfnDlgProc = popup_options_proc;
- g_plugin.addOptions(wParam, &odp);
- }
+ odp.szTab.w = LPGENW("Popups");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS_POPUPS);
+ odp.pfnDlgProc = popup_options_proc;
+ g_plugin.addOptions(wParam, &odp);
return 0;
}
@@ -344,11 +342,7 @@ void TwitterProto::ShowPopup(const wchar_t *text, int Error) popup.colorBack = 0x000000FF;
popup.colorText = 0x00FFFFFF;
}
-
- if (ServiceExists(MS_POPUP_ADDPOPUPW))
- PUAddPopupW(&popup);
- else
- MessageBox(nullptr, popup.lpwzText, popup.lpwzContactName, 0);
+ PUAddPopupW(&popup);
}
void TwitterProto::ShowPopup(const char *text, int Error)
@@ -361,11 +355,7 @@ void TwitterProto::ShowPopup(const char *text, int Error) popup.colorBack = 0x000000FF;
popup.colorText = 0x00FFFFFF;
}
-
- if (ServiceExists(MS_POPUP_ADDPOPUPW))
- PUAddPopupW(&popup);
- else
- MessageBox(nullptr, popup.lpwzText, popup.lpwzContactName, 0);
+ PUAddPopupW(&popup);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 15cd3d4451..ffe457b3ad 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -433,23 +433,16 @@ void CVkProto::InitPopups(void) void CVkProto::MsgPopup(MCONTACT hContact, const wchar_t *wszMsg, const wchar_t *wszTitle, bool err)
{
- if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- char name[256];
-
- POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.pwszTitle = wszTitle;
- ppd.pwszText = wszMsg;
- ppd.pszClassName = name;
- ppd.hContact = hContact;
- ppd.PluginData = new CVkSendMsgParam(hContact);
- mir_snprintf(name, "%s_%s", m_szModuleName, err ? "Error" : "Notification");
-
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
- }
- else {
- DWORD mtype = MB_OK | MB_SETFOREGROUND | (err ? MB_ICONERROR : MB_ICONINFORMATION);
- MessageBoxW(nullptr, wszMsg, wszTitle, mtype);
- }
+ char name[256];
+
+ POPUPDATACLASS ppd = { sizeof(ppd) };
+ ppd.pwszTitle = wszTitle;
+ ppd.pwszText = wszMsg;
+ ppd.pszClassName = name;
+ ppd.hContact = hContact;
+ ppd.PluginData = new CVkSendMsgParam(hContact);
+ mir_snprintf(name, "%s_%s", m_szModuleName, err ? "Error" : "Notification");
+ CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
}
void CVkProto::MsgPopup(const wchar_t *wszMsg, const wchar_t *wszTitle, bool err)
diff --git a/protocols/Weather/src/weather_opt.cpp b/protocols/Weather/src/weather_opt.cpp index daf84d36c7..edadf953fa 100644 --- a/protocols/Weather/src/weather_opt.cpp +++ b/protocols/Weather/src/weather_opt.cpp @@ -588,14 +588,11 @@ int OptInit(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp); // if popup service exists, load the weather popup options - if ((ServiceExists(MS_POPUP_ADDPOPUPW))) { - odp.position = 100000000; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); - odp.szGroup.a = LPGEN("Popups"); - odp.szTab.a = nullptr; - odp.pfnDlgProc = DlgPopupOpts; - g_plugin.addOptions(wParam, &odp); - } - + odp.position = 100000000; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); + odp.szGroup.a = LPGEN("Popups"); + odp.szTab.a = nullptr; + odp.pfnDlgProc = DlgPopupOpts; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/protocols/Weather/src/weather_svcs.cpp b/protocols/Weather/src/weather_svcs.cpp index 7c3d2611aa..4119eab464 100644 --- a/protocols/Weather/src/weather_svcs.cpp +++ b/protocols/Weather/src/weather_svcs.cpp @@ -349,18 +349,15 @@ void AddMenuItems(void) mi.pszService = MS_WEATHER_REFRESHALL; Menu_AddMainMenuItem(&mi); - // only run if popup service exists - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - SET_UID(mi, 0xdc5411cb, 0xb7c7, 0x443b, 0x88, 0x5a, 0x90, 0x24, 0x43, 0xde, 0x54, 0x3e); - CreateServiceFunction(MODULENAME "/PopupMenu", MenuitemNotifyCmd); - mi.name.a = LPGEN("Weather Notification"); - mi.hIcolibItem = GetIconHandle("popup"); - mi.position = 0; - mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); - mi.pszService = MODULENAME "/PopupMenu"; - hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); - UpdatePopupMenu(opt.UsePopup); - } + SET_UID(mi, 0xdc5411cb, 0xb7c7, 0x443b, 0x88, 0x5a, 0x90, 0x24, 0x43, 0xde, 0x54, 0x3e); + CreateServiceFunction(MODULENAME "/PopupMenu", MenuitemNotifyCmd); + mi.name.a = LPGEN("Weather Notification"); + mi.hIcolibItem = GetIconHandle("popup"); + mi.position = 0; + mi.root = g_plugin.addRootMenu(MO_MAIN, LPGENW("Popups"), 0); + mi.pszService = MODULENAME "/PopupMenu"; + hEnableDisablePopupMenu = Menu_AddMainMenuItem(&mi); + UpdatePopupMenu(opt.UsePopup); if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) { SET_UID(mi, 0xe193fe9b, 0xf6ad, 0x41ac, 0x95, 0x29, 0x45, 0x4, 0x44, 0xb1, 0xeb, 0x5d); diff --git a/protocols/WebView/src/webview.cpp b/protocols/WebView/src/webview.cpp index 87e5baf4a1..2075151f90 100644 --- a/protocols/WebView/src/webview.cpp +++ b/protocols/WebView/src/webview.cpp @@ -299,12 +299,10 @@ int OptInitialise(WPARAM wParam, LPARAM) g_plugin.addOptions(wParam, &odp); // if popup service exists - if ((ServiceExists(MS_POPUP_ADDPOPUPW))) { - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); - odp.szGroup.a = LPGEN("Popups"); - odp.pfnDlgProc = DlgPopUpOpts; - g_plugin.addOptions(wParam, &odp); - } + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUP); + odp.szGroup.a = LPGEN("Popups"); + odp.pfnDlgProc = DlgPopUpOpts; + g_plugin.addOptions(wParam, &odp); return 0; } diff --git a/protocols/WebView/src/webview_alerts.cpp b/protocols/WebView/src/webview_alerts.cpp index 1b068f099e..776b100181 100644 --- a/protocols/WebView/src/webview_alerts.cpp +++ b/protocols/WebView/src/webview_alerts.cpp @@ -142,10 +142,7 @@ int PopupAlert(WPARAM hContact, LPARAM lParam) ppd.PluginWindowProc = nullptr; ppd.iSeconds = g_plugin.getDword(POP_DELAY_KEY, 0); - - if (ServiceExists(MS_POPUP_ADDPOPUPW)) - CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&ppd, 0); - + PUAddPopupW(&ppd); return 0; } @@ -184,7 +181,7 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam) return 0; wchar_t *ptszContactName = Clist_GetContactDisplayName(hContact); - if (ServiceExists(MS_POPUP_ADDPOPUPW) && g_plugin.getByte(ERROR_POPUP_KEY, 0)) { + if (g_plugin.getByte(ERROR_POPUP_KEY, 0)) { mir_snwprintf(newdisplaytext, L"%s\n%s", ptszContactName, displaytext); PUShowMessageW(newdisplaytext, SM_WARNING); } diff --git a/protocols/WebView/src/webview_opts.cpp b/protocols/WebView/src/webview_opts.cpp index 0c51759b42..35b47b8110 100644 --- a/protocols/WebView/src/webview_opts.cpp +++ b/protocols/WebView/src/webview_opts.cpp @@ -1092,12 +1092,10 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara } else { CheckDlgButton(hwndDlg, IDC_SUPPRESS, BST_UNCHECKED); - if ((ServiceExists(MS_POPUP_ADDPOPUPW) != 0)) - EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 1); + EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 1); } - if (ServiceExists(MS_POPUP_ADDPOPUPW) == 0) - EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 0); if (g_plugin.getByte(UPDATE_ONSTART_KEY, 0)) { EnableWindow(GetDlgItem(hwndDlg, IDC_START_DELAY), 1); @@ -1167,8 +1165,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara break; case IDC_SUPPRESS: - if ((ServiceExists(MS_POPUP_ADDPOPUPW) != 0)) - EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), (!(IsDlgButtonChecked(hwndDlg, IDC_SUPPRESS)))); + EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), (!(IsDlgButtonChecked(hwndDlg, IDC_SUPPRESS)))); break; case IDC_UPDATE_ONSTART: diff --git a/protocols/YAMN/src/proto/pop3/pop3opt.cpp b/protocols/YAMN/src/proto/pop3/pop3opt.cpp index b22b237e47..fe5d7dd0a3 100644 --- a/protocols/YAMN/src/proto/pop3/pop3opt.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3opt.cpp @@ -173,13 +173,11 @@ int YAMNOptInitSvc(WPARAM wParam, LPARAM) odp.pfnDlgProc = DlgProcPluginOpt; g_plugin.addOptions(wParam, &odp); - if (ServiceExists(MS_POPUP_ADDPOPUPW)) { - odp.szGroup.a = LPGEN("Popups"); - odp.szTab.a = LPGEN("YAMN"); - odp.pszTemplate = MAKEINTRESOURCEA(IDD_POP3ACCOUNTPOPUP); - odp.pfnDlgProc = DlgProcPOP3AccPopup; - g_plugin.addOptions(wParam, &odp); - } + odp.szGroup.a = LPGEN("Popups"); + odp.szTab.a = LPGEN("YAMN"); + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POP3ACCOUNTPOPUP); + odp.pfnDlgProc = DlgProcPOP3AccPopup; + g_plugin.addOptions(wParam, &odp); return 0; } |