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/SeenPlugin/src/options.cpp | 77 +++++++++++++++++++------------------- plugins/SeenPlugin/src/utils.cpp | 3 -- 2 files changed, 39 insertions(+), 41 deletions(-) (limited to 'plugins/SeenPlugin/src') 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; -- cgit v1.2.3