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/Ping/src/options.cpp | 7 +------ plugins/Ping/src/pingthread.cpp | 2 +- plugins/Ping/src/utils.cpp | 33 ++++----------------------------- 3 files changed, 6 insertions(+), 36 deletions(-) (limited to 'plugins/Ping/src') 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 -- cgit v1.2.3