From a27b07c35565ced7f690890dcba29518ae2e4928 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 6 Sep 2016 18:26:47 +0000 Subject: MS_CLIST_SYSTRAY_NOTIFY - more useless code removed git-svn-id: http://svn.miranda-ng.org/main/trunk@17268 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- bin10/lib/mir_app.lib | Bin 73668 -> 74136 bytes bin10/lib/mir_app64.lib | Bin 71018 -> 71438 bytes bin12/lib/mir_app.lib | Bin 73668 -> 74136 bytes bin12/lib/mir_app64.lib | Bin 71018 -> 71438 bytes bin14/lib/mir_app.lib | Bin 73668 -> 74136 bytes bin14/lib/mir_app64.lib | Bin 71018 -> 71438 bytes include/delphi/m_clist.inc | 67 -------------------- include/delphi/m_clistint.inc | 2 +- include/m_clist.h | 81 ++++++++++-------------- include/m_clistint.h | 2 +- plugins/AssocMgr/src/utils.cpp | 16 +---- plugins/AutoShutdown/src/utils.cpp | 13 +--- plugins/MirOTR/src/utils.cpp | 106 +++++++++++--------------------- plugins/PluginUpdater/src/DlgUpdate.cpp | 20 +----- plugins/Scriver/src/msgoptions.cpp | 16 +---- plugins/Scriver/src/msgs.cpp | 24 +------- plugins/TabSRMM/src/mim.cpp | 13 +--- plugins/TabSRMM/src/msgoptions.cpp | 5 -- plugins/TabSRMM/src/srmm.cpp | 20 ++---- plugins/WebView/src/webview_alerts.cpp | 12 +--- protocols/FacebookRM/src/events.cpp | 15 +---- protocols/IRCG/src/commandmonitor.cpp | 11 +--- protocols/IRCG/src/ircproto.cpp | 9 +-- protocols/Sametime/src/options.cpp | 12 +--- protocols/Sametime/src/utils.cpp | 24 +++----- protocols/WhatsApp/src/proto.cpp | 19 ++---- protocols/Yahoo/src/util.cpp | 15 +---- src/core/stdmsg/src/msgoptions.cpp | 17 +---- src/core/stdmsg/src/msgs.cpp | 14 +---- src/mir_app/src/clc.h | 1 - src/mir_app/src/clistcore.cpp | 1 - src/mir_app/src/clisttray.cpp | 103 ++++++++++++++++--------------- src/mir_app/src/mir_app.def | 2 + src/mir_app/src/mir_app64.def | 2 + 34 files changed, 175 insertions(+), 467 deletions(-) diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib index 60b0f6d8c8..4bab0ad512 100644 Binary files a/bin10/lib/mir_app.lib and b/bin10/lib/mir_app.lib differ diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib index 8e9c42ba5c..e4501109e0 100644 Binary files a/bin10/lib/mir_app64.lib and b/bin10/lib/mir_app64.lib differ diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib index 60b0f6d8c8..4bab0ad512 100644 Binary files a/bin12/lib/mir_app.lib and b/bin12/lib/mir_app.lib differ diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib index 8e9c42ba5c..e4501109e0 100644 Binary files a/bin12/lib/mir_app64.lib and b/bin12/lib/mir_app64.lib differ diff --git a/bin14/lib/mir_app.lib b/bin14/lib/mir_app.lib index 60b0f6d8c8..4bab0ad512 100644 Binary files a/bin14/lib/mir_app.lib and b/bin14/lib/mir_app.lib differ diff --git a/bin14/lib/mir_app64.lib b/bin14/lib/mir_app64.lib index 8e9c42ba5c..e4501109e0 100644 Binary files a/bin14/lib/mir_app64.lib and b/bin14/lib/mir_app64.lib differ diff --git a/include/delphi/m_clist.inc b/include/delphi/m_clist.inc index ea4ce13e31..f4af29552d 100644 --- a/include/delphi/m_clist.inc +++ b/include/delphi/m_clist.inc @@ -187,71 +187,4 @@ function Clist_GroupCreate(hParentGroup:integer; groupName:PWideChar) : integer; procedure Clist_ContactDoubleClicked(hContact:TMCONTACT); stdcall; external AppDll; -const - { - wParam=0 (not used) - lParam=(LPARAM) &MIRANDASYSTRAYNOTIFY - - Affects: Show a message in a ballon tip against a protocol icon (if installed) - Returns: 0 on success, non zero on failure - Notes : This service will not be created on systems that haven't got the Windows - support for ballontips, also note that it's upto Windows if it shows your - message and it keeps check of delays (don't be stupid about showing messages) - - Version: 0.3.1a - } - NIIF_INFO = $00000001; - NIIF_WARNING = $00000002; - NIIF_ERROR = $00000003; - NIIF_ICON_MASK = $0000000F; - NIIF_NOSOUND = $00000010; - NIIF_INTERN_UNICODE = $00000100; - -type - PMIRANDASYSTRAYNOTIFY = ^TMIRANDASYSTRAYNOTIFY; - TMIRANDASYSTRAYNOTIFY = record - cbSize :int; // sizeof(MIRANDASYSTRAY) - szProto :PAnsiChar; // protocol to show under (may have no effect) - szInfoTitle:TChar; // only 64chars of it will be used, TCHAR if NIIF_INTERN_UNICODE is specified - szInfo :TChar; // only 256chars of it will be used, TCHAR if NIIF_INTERN_UNICODE is specified - dwInfoFlags:dword; // see NIIF_* stuff - uTimeout :uint; // how long to show the tip for - end; - -const - MS_CLIST_SYSTRAY_NOTIFY:PAnsiChar = 'Miranda/Systray/Notify'; - -const - SETTING_TOOLWINDOW_DEFAULT = 1; - SETTING_SHOWMAINMENU_DEFAULT = 1; - SETTING_SHOWCAPTION_DEFAULT = 1; - SETTING_CLIENTDRAG_DEFAULT = 0; - SETTING_ONTOP_DEFAULT = 1; - SETTING_MIN2TRAY_DEFAULT = 1; - SETTING_TRAY1CLICK_DEFAULT = 0; - SETTING_HIDEOFFLINE_DEFAULT = 0; - SETTING_HIDEEMPTYGROUPS_DEFAULT = 0; - SETTING_USEGROUPS_DEFAULT = 1; - SETTING_SORTBYSTATUS_DEFAULT = 0; - SETTING_SORTBYPROTO_DEFAULT = 0; - SETTING_TRANSPARENT_DEFAULT = 0; - SETTING_ALPHA_DEFAULT = 200; - SETTING_AUTOALPHA_DEFAULT = 150; - SETTING_CONFIRMDELETE_DEFAULT = 1; - SETTING_AUTOHIDE_DEFAULT = 0; - SETTING_HIDETIME_DEFAULT = 30; - SETTING_CYCLETIME_DEFAULT = 4; - SETTING_ALWAYSSTATUS_DEFAULT = 0; - SETTING_ALWAYSMULTI_DEFAULT = 0; - - SETTING_TRAYICON_SINGLE = 0; - SETTING_TRAYICON_CYCLE = 1; - SETTING_TRAYICON_MULTI = 2; - SETTING_TRAYICON_DEFAULT = SETTING_TRAYICON_SINGLE; - - SETTING_STATE_HIDDEN = 0; - SETTING_STATE_MINIMIZED = 1; - SETTING_STATE_NORMAL = 2; - SETTING_BRINGTOFRONT_DEFAULT = 0; - {$ENDIF} diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc index f472cd2775..26d8b125f5 100644 --- a/include/delphi/m_clistint.inc +++ b/include/delphi/m_clistint.inc @@ -403,7 +403,7 @@ type pfnTrayIconIconsChanged : procedure ; cdecl; pfnTrayIconPauseAutoHide : function (wParam:WPARAM; lParam:LPARAM):int; cdecl; pfnTrayIconProcessMessage : function (wParam:WPARAM; lParam:LPARAM):int_ptr; cdecl; - pfnCListTrayNotify : function (_para1:PMIRANDASYSTRAYNOTIFY):int; cdecl; + blablabla5 : procedure; cdecl; (* clui.c *) pfnContactListWndProc:function(hwnd:HWND; msg:uint; wParam:WPARAM; lParam:LPARAM):int; stdcall; diff --git a/include/m_clist.h b/include/m_clist.h index 68e269b71e..ceb97c6b44 100644 --- a/include/m_clist.h +++ b/include/m_clist.h @@ -498,9 +498,6 @@ EXTERN_C MIR_APP_DLL(int) Clist_ContactCompare(MCONTACT hContact1, MCONTACT hCon #define ME_CLUI_CONTACTDRAGSTOP "CLUI/ContactDragStop" ///////////////////////////////////////////////////////////////////////////////////////// -// wParam = 0 (not used) -// lParam = (LPARAM) &MIRANDASYSTRAYNOTIFY -// // Affects: Show a message in a ballon tip against a protocol icon (if installed) // Returns: 0 on success, non zero on failure // Notes : This service will not be created on systems that haven't got the Windows @@ -512,54 +509,42 @@ EXTERN_C MIR_APP_DLL(int) Clist_ContactCompare(MCONTACT hContact1, MCONTACT hCon #define NIIF_ERROR 0x00000003 #define NIIF_ICON_MASK 0x0000000F #define NIIF_NOSOUND 0x00000010 -#define NIIF_INTERN_UNICODE 0x00000100 -typedef struct { - int cbSize; // sizeof(MIRANDASYSTRAY) - char *szProto; // protocol to show under (may have no effect) - union { - char *szInfoTitle; // only 64chars of it will be used - wchar_t *tszInfoTitle; // used if NIIF_INTERN_UNICODE is specified - }; - union { - char *szInfo; // only 256chars of it will be used - wchar_t *tszInfo; // used if NIIF_INTERN_UNICODE is specified - }; - DWORD dwInfoFlags; // see NIIF_* stuff - UINT uTimeout; // how long to show the tip for -} MIRANDASYSTRAYNOTIFY; -#define MS_CLIST_SYSTRAY_NOTIFY "Miranda/Systray/Notify" - -#define SETTING_TOOLWINDOW_DEFAULT 1 -#define SETTING_SHOWMAINMENU_DEFAULT 1 -#define SETTING_SHOWCAPTION_DEFAULT 1 -#define SETTING_CLIENTDRAG_DEFAULT 1 -#define SETTING_ONTOP_DEFAULT 1 -#define SETTING_MIN2TRAY_DEFAULT 1 -#define SETTING_TRAY1CLICK_DEFAULT (IsWinVer7Plus()?1:0) -#define SETTING_HIDEOFFLINE_DEFAULT 0 +EXTERN_C MIR_APP_DLL(int) Clist_TrayNotifyA(const char *szProto, const char *szInfoTitle, const char *szInfo, DWORD dwInfoFlags, UINT uTimeout); +EXTERN_C MIR_APP_DLL(int) Clist_TrayNotifyW(const char *szProto, const wchar_t *wszInfoTitle, const wchar_t *wszInfo, DWORD dwInfoFlags, UINT uTimeout); + +///////////////////////////////////////////////////////////////////////////////////////// + +#define SETTING_TOOLWINDOW_DEFAULT 1 +#define SETTING_SHOWMAINMENU_DEFAULT 1 +#define SETTING_SHOWCAPTION_DEFAULT 1 +#define SETTING_CLIENTDRAG_DEFAULT 1 +#define SETTING_ONTOP_DEFAULT 1 +#define SETTING_MIN2TRAY_DEFAULT 1 +#define SETTING_TRAY1CLICK_DEFAULT (IsWinVer7Plus()?1:0) +#define SETTING_HIDEOFFLINE_DEFAULT 0 #define SETTING_HIDEEMPTYGROUPS_DEFAULT 0 -#define SETTING_USEGROUPS_DEFAULT 1 -#define SETTING_SORTBYSTATUS_DEFAULT 0 -#define SETTING_SORTBYPROTO_DEFAULT 0 -#define SETTING_TRANSPARENT_DEFAULT 0 -#define SETTING_ALPHA_DEFAULT 200 -#define SETTING_AUTOALPHA_DEFAULT 150 +#define SETTING_USEGROUPS_DEFAULT 1 +#define SETTING_SORTBYSTATUS_DEFAULT 0 +#define SETTING_SORTBYPROTO_DEFAULT 0 +#define SETTING_TRANSPARENT_DEFAULT 0 +#define SETTING_ALPHA_DEFAULT 200 +#define SETTING_AUTOALPHA_DEFAULT 150 #define SETTING_CONFIRMDELETE_DEFAULT 1 -#define SETTING_AUTOHIDE_DEFAULT 0 -#define SETTING_HIDETIME_DEFAULT 30 -#define SETTING_CYCLETIME_DEFAULT 4 -#define SETTING_TRAYICON_DEFAULT SETTING_TRAYICON_SINGLE -#define SETTING_ALWAYSSTATUS_DEFAULT 0 -#define SETTING_ALWAYSMULTI_DEFAULT 0 - -#define SETTING_TRAYICON_SINGLE 0 -#define SETTING_TRAYICON_CYCLE 1 -#define SETTING_TRAYICON_MULTI 2 - -#define SETTING_STATE_HIDDEN 0 -#define SETTING_STATE_MINIMIZED 1 -#define SETTING_STATE_NORMAL 2 +#define SETTING_AUTOHIDE_DEFAULT 0 +#define SETTING_HIDETIME_DEFAULT 30 +#define SETTING_CYCLETIME_DEFAULT 4 +#define SETTING_TRAYICON_DEFAULT SETTING_TRAYICON_SINGLE +#define SETTING_ALWAYSSTATUS_DEFAULT 0 +#define SETTING_ALWAYSMULTI_DEFAULT 0 + +#define SETTING_TRAYICON_SINGLE 0 +#define SETTING_TRAYICON_CYCLE 1 +#define SETTING_TRAYICON_MULTI 2 + +#define SETTING_STATE_HIDDEN 0 +#define SETTING_STATE_MINIMIZED 1 +#define SETTING_STATE_NORMAL 2 #define SETTING_BRINGTOFRONT_DEFAULT 0 diff --git a/include/m_clistint.h b/include/m_clistint.h index 648eb84dda..232ff67afd 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -383,7 +383,7 @@ struct CLIST_INTERFACE void (*pfnTrayIconIconsChanged)(void); int (*pfnTrayIconPauseAutoHide)(WPARAM wParam, LPARAM lParam); INT_PTR (*pfnTrayIconProcessMessage)(WPARAM wParam, LPARAM lParam); - int (*pfnCListTrayNotify)(MIRANDASYSTRAYNOTIFY*); + int (*blablabla5)(); /* clui.c */ LRESULT (CALLBACK *pfnContactListWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp index 494dd298c5..6028343440 100644 --- a/plugins/AssocMgr/src/utils.cpp +++ b/plugins/AssocMgr/src/utils.cpp @@ -139,26 +139,16 @@ static void MessageBoxIndirectFree(void *param) void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) { char szText[256]; /* max for systray */ - MSGBOXPARAMSA *mbp; va_list va; va_start(va,pszTextFmt); mir_vsnprintf(szText,_countof(szText),pszTextFmt,va); va_end(va); - if(ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - MIRANDASYSTRAYNOTIFY msn; - msn.cbSize=sizeof(msn); - msn.szProto=NULL; - msn.szInfoTitle=(char*)pszTitle; - msn.szInfo=(char*)szText; - msn.uTimeout=30000; /* max timeout */ - msn.dwInfoFlags=flags; - if (!CallServiceSync(MS_CLIST_SYSTRAY_NOTIFY,0,(LPARAM)&msn)) - return; /* success */ - } + if (!Clist_TrayNotifyA(NULL, pszTitle, szText, flags, 30000)) // success + return; - mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp)); + MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp)); if(mbp == NULL) return; diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index d071125a2c..c854534161 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -84,17 +84,8 @@ void ShowInfoMessage(BYTE flags, const char *pszTitle, const char *pszTextFmt, . mir_vsnprintf(szText, _countof(szText), pszTextFmt, va); va_end(va); - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - MIRANDASYSTRAYNOTIFY msn; - msn.cbSize = sizeof(msn); - msn.szProto = NULL; - msn.szInfoTitle = (char*)pszTitle; - msn.szInfo = (char*)szText; - msn.uTimeout = 30000; /* max timeout */ - msn.dwInfoFlags = flags; - if (!CallServiceSync(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&msn)) - return; /* success */ - } + if (!Clist_TrayNotifyA(NULL, pszTitle, szText, flags, 30000)) // success + return; MSGBOXPARAMSA *mbp = (MSGBOXPARAMSA*)mir_calloc(sizeof(*mbp)); if (mbp == NULL) return; diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index 5b10c37451..d0447831d6 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -158,45 +158,28 @@ void ShowWarning(wchar_t *msg) { wchar_t buffer[512]; ErrorDisplay disp = options.err_method; // funny logic :) ... try to avoid message boxes - // if want baloons but no balloons, try popups // if want popups but no popups, try baloons - // if, after that, you want balloons but no balloons, revert to message boxes - if(disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_POP; - if(disp == ED_POP && !options.bHavePopups) disp = ED_BAL; - if(disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_MB; + if(disp == ED_POP && !options.bHavePopups) + disp = ED_BAL; mir_snwprintf(buffer, L"%s Warning", _A2W(MODULENAME)); - - switch(disp) { - case ED_POP: - { - int size = int(mir_wstrlen(msg) + 515); - wchar_t *message = new wchar_t[size]; // newline and null terminator - mir_snwprintf(message, size, L"%s\r\n%s", buffer, msg); - PUShowMessageT(message, SM_WARNING); - delete[] message; - } - break; - case ED_MB: - MessageBox(0, msg, buffer, MB_OK | MB_ICONWARNING); - break; - case ED_BAL: - { - MIRANDASYSTRAYNOTIFY sn = {0}; - sn.cbSize = sizeof(sn); - sn.szProto= MODULENAME; - sn.tszInfoTitle = buffer; - sn.tszInfo = msg; - - sn.dwInfoFlags = NIIF_WARNING | NIIF_INTERN_UNICODE; - - sn.uTimeout = 10; - - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&sn); - } - - break; + switch (disp) { + case ED_POP: + { + int size = int(mir_wstrlen(msg) + 515); + wchar_t *message = new wchar_t[size]; // newline and null terminator + mir_snwprintf(message, size, L"%s\r\n%s", buffer, msg); + PUShowMessageT(message, SM_WARNING); + delete[] message; + } + break; + case ED_MB: + MessageBox(0, msg, buffer, MB_OK | MB_ICONWARNING); + break; + case ED_BAL: + Clist_TrayNotifyW(MODULENAME, buffer, msg, NIIF_WARNING, 10000); + break; } } @@ -204,46 +187,29 @@ void ShowError(wchar_t *msg) { wchar_t buffer[512]; ErrorDisplay disp = options.err_method; // funny logic :) ... try to avoid message boxes - // if want baloons but no balloons, try popups // if want popups but no popups, try baloons - // if, after that, you want balloons but no balloons, revert to message boxes - if(disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_POP; - if(disp == ED_POP && !options.bHavePopups) disp = ED_BAL; - if(disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_MB; + if(disp == ED_POP && !options.bHavePopups) + disp = ED_BAL; mir_snwprintf(buffer, L"%s Error", _A2W(MODULENAME)); - wchar_t *message; - switch(disp) { - case ED_POP: - { - int size = int(mir_wstrlen(msg) + 515); - message = new wchar_t[size]; // newline and null terminator - mir_snwprintf(message, size, L"%s\r\n%s", buffer, msg); - PUShowMessageT(message, SM_WARNING); - delete[] message; - } - break; - case ED_MB: - MessageBox(0, msg, buffer, MB_OK | MB_ICONERROR); - break; - case ED_BAL: - { - MIRANDASYSTRAYNOTIFY sn = {0}; - sn.cbSize = sizeof(sn); - sn.szProto = MODULENAME; - sn.tszInfoTitle = buffer; - sn.tszInfo = msg; - - sn.dwInfoFlags = NIIF_ERROR | NIIF_INTERN_UNICODE; - - sn.uTimeout = 10; - - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&sn); - } - - break; + switch (disp) { + case ED_POP: + { + int size = int(mir_wstrlen(msg) + 515); + message = new wchar_t[size]; // newline and null terminator + mir_snwprintf(message, size, L"%s\r\n%s", buffer, msg); + PUShowMessageT(message, SM_WARNING); + delete[] message; + } + break; + case ED_MB: + MessageBox(0, msg, buffer, MB_OK | MB_ICONERROR); + break; + case ED_BAL: + Clist_TrayNotifyW(MODULENAME, buffer, msg, NIIF_ERROR, 10000); + break; } } diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 06a9badcf1..7bbb59b784 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -495,24 +495,10 @@ static void DlgUpdateSilent(void *param) wchar_t tszTitle[100]; mir_snwprintf(tszTitle, TranslateT("%d component(s) was updated"), count); - if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) { + if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1)) ShowPopup(tszTitle,TranslateT("You need to restart your Miranda to apply installed updates."),POPUP_TYPE_MSG); - } else { - bool notified = false; - - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - MIRANDASYSTRAYNOTIFY err; - err.szProto = MODULEA; - err.cbSize = sizeof(err); - err.dwInfoFlags = NIIF_INTERN_UNICODE | NIIF_INFO; - err.tszInfoTitle = tszTitle; - err.tszInfo = TranslateT("You need to restart your Miranda to apply installed updates."); - err.uTimeout = 30000; - - notified = !CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&err); - } - - if (!notified) { + else { + if (Clist_TrayNotifyW(MODULEA, tszTitle, TranslateT("You need to restart your Miranda to apply installed updates."), NIIF_INFO, 30000)) { // Error, let's try to show MessageBox as last way to inform user about successful update wchar_t tszText[200]; mir_snwprintf(tszText, L"%s\n\n%s", TranslateT("You need to restart your Miranda to apply installed updates."), TranslateT("Would you like to restart it now?")); diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 98198af1a6..abb4b38229 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -880,23 +880,14 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); - if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), FALSE); - CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, BST_CHECKED); - SetDlgItemText(hwndDlg, IDC_NOTIFYBALLOON, TranslateT("Show balloon popup (unsupported system)")); - } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_TYPETRAY: if (IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)) { - if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); - else { - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TRUE); - } + EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TRUE); } else { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), FALSE); @@ -908,8 +899,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEWIN), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY) - && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)); + EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); //fall-thru case IDC_TYPEWIN: case IDC_NOTIFYTRAY: diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 19f42b14f9..49310e20e8 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -207,29 +207,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) { wchar_t szTip[256]; mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); - - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags2 & SMF2_SHOWTYPINGCLIST)) { - MIRANDASYSTRAYNOTIFY tn; - tn.szProto = NULL; - tn.cbSize = sizeof(tn); - tn.tszInfoTitle = TranslateT("Typing notification"); - tn.tszInfo = szTip; - tn.dwInfoFlags = NIIF_INFO | NIIF_INTERN_UNICODE; - tn.uTimeout = 1000 * 4; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&tn); - } - else { - pcli->pfnRemoveEvent(hContact, 1); - - CLISTEVENT cle = {}; - cle.hContact = hContact; - cle.hDbEvent = 1; - cle.flags = CLEF_ONLYAFEW | CLEF_TCHAR; - cle.hIcon = GetCachedIcon("scriver_TYPING"); - cle.pszService = "SRMsg/TypingMessage"; - cle.ptszTooltip = szTip; - pcli->pfnAddEvent(&cle); - } + Clist_TrayNotifyW(NULL, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); } return 0; } diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 000043e8b6..b222fdc845 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -300,16 +300,9 @@ int CMimAPI::TypingMessage(WPARAM hContact, LPARAM mode) if (mode) { wchar_t szTip[256]; mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); - if (fShowOnClist && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0)) { - MIRANDASYSTRAYNOTIFY tn; - tn.szProto = NULL; - tn.cbSize = sizeof(tn); - tn.tszInfoTitle = TranslateT("Typing notification"); - tn.tszInfo = szTip; - tn.dwInfoFlags = NIIF_INFO | NIIF_INTERN_UNICODE; - tn.uTimeout = 1000 * 4; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&tn); - } + if (fShowOnClist && M.GetByte(SRMSGMOD, "ShowTypingBalloon", 0)) + Clist_TrayNotifyW(NULL, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); + if (fShowOnClist) { pcli->pfnRemoveEvent(hContact, 1); diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index ddf7c16651..68bb2837a4 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -915,11 +915,6 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam Utils::enableDlgControl(hwndDlg, IDC_TYPEFLASHWIN, IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY) != 0); Utils::enableDlgControl(hwndDlg, IDC_MTN_POPUPMODE, IsDlgButtonChecked(hwndDlg, IDC_NOTIFYPOPUP) != 0); - if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - Utils::enableDlgControl(hwndDlg, IDC_NOTIFYBALLOON, false); - SetDlgItemText(hwndDlg, IDC_NOTIFYBALLOON, TranslateT("Show balloon popup (unsupported system)")); - } - SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always")); SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Always, but no popup when window is focused")); SendDlgItemMessage(hwndDlg, IDC_MTN_POPUPMODE, CB_INSERTSTRING, -1, (LPARAM)TranslateT("Only when no message window is open")); diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 3f3cb18bb1..750f006ed3 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -150,20 +150,10 @@ int _DebugPopup(MCONTACT hContact, const wchar_t *fmt, ...) va_start(va, fmt); mir_vsnwprintf(debug, ibsize, fmt, va); - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - MIRANDASYSTRAYNOTIFY tn; - wchar_t szTitle[128]; - mir_snwprintf(szTitle, TranslateT("TabSRMM message (%s)"), - (hContact != 0) ? pcli->pfnGetContactDisplayName(hContact, 0) : TranslateT("Global")); - - tn.szProto = NULL; - tn.cbSize = sizeof(tn); - tn.tszInfoTitle = szTitle; - tn.tszInfo = debug; - tn.dwInfoFlags = NIIF_INFO; - tn.dwInfoFlags |= NIIF_INTERN_UNICODE; - tn.uTimeout = 1000 * 4; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&tn); - } + wchar_t szTitle[128]; + mir_snwprintf(szTitle, TranslateT("TabSRMM message (%s)"), + (hContact != 0) ? pcli->pfnGetContactDisplayName(hContact, 0) : TranslateT("Global")); + + Clist_TrayNotifyW(NULL, szTitle, debug, NIIF_INFO, 1000 * 4); return 0; } diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index f5e40cb45d..a816dfb319 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -195,16 +195,8 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam) mir_snwprintf(newdisplaytext, L"%s: %s", ptszContactName, TranslateW(displaytext)); CallService("OSD/Announce", (WPARAM)newdisplaytext, 0); } - else if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - MIRANDASYSTRAYNOTIFY webview_tip = {0}; - webview_tip.cbSize = sizeof(MIRANDASYSTRAYNOTIFY); - webview_tip.szProto = NULL; - webview_tip.tszInfoTitle = ptszContactName; - webview_tip.tszInfo = TranslateW(displaytext); - webview_tip.dwInfoFlags = NIIF_ERROR | NIIF_INTERN_UNICODE; - webview_tip.uTimeout = 15000; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) &webview_tip); - } + + Clist_TrayNotifyW(NULL, ptszContactName, TranslateW(displaytext), NIIF_ERROR, 15000); return 0; } diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index 069baa3806..9bbd836067 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -97,19 +97,8 @@ HWND FacebookProto::NotifyEvent(wchar_t* title, wchar_t* info, MCONTACT contact, } } else { - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) - { - MIRANDASYSTRAYNOTIFY err; - err.szProto = m_szModuleName; - err.cbSize = sizeof(err); - err.dwInfoFlags = NIIF_INTERN_UNICODE | (type == EVENT_CLIENT ? NIIF_WARNING : NIIF_INFO); - err.tszInfoTitle = title; - err.tszInfo = info; - err.uTimeout = 10000; - - if (CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&err) == 0) - return NULL; - } + if (!Clist_TrayNotifyW(m_szModuleName, title, info, type == EVENT_CLIENT ? NIIF_WARNING : NIIF_INFO, 10000)) + return NULL; } if (type == EVENT_CLIENT) diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index cfd91e12b1..6b369de31f 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -1894,21 +1894,12 @@ bool CIrcProto::OnIrc_NOOFCHANNELS(const CIrcMessage* pmsg) bool CIrcProto::OnIrc_ERROR(const CIrcMessage* pmsg) { if (pmsg->m_bIncoming && !m_disableErrorPopups && m_iDesiredStatus != ID_STATUS_OFFLINE) { - MIRANDASYSTRAYNOTIFY msn; - msn.cbSize = sizeof(MIRANDASYSTRAYNOTIFY); - msn.szProto = m_szModuleName; - msn.tszInfoTitle = TranslateT("IRC error"); - CMStringW S; if (pmsg->parameters.getCount() > 0) S = DoColorCodes(pmsg->parameters[0].c_str(), TRUE, FALSE); else S = TranslateT("Unknown"); - - msn.tszInfo = (wchar_t*)S.c_str(); - msn.dwInfoFlags = NIIF_ERROR | NIIF_INTERN_UNICODE; - msn.uTimeout = 15000; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&msn); + Clist_TrayNotifyW(m_szModuleName, TranslateT("IRC error"), S, NIIF_ERROR, 15000); } ShowMessage(pmsg); return true; diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 222691d3d7..50ac719935 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -732,14 +732,7 @@ int CIrcProto::SetStatusInternal(int iNewStatus, bool bIsInternal) } if (iNewStatus != ID_STATUS_OFFLINE && !m_nick[0] || !m_userID[0] || !m_name[0]) { - MIRANDASYSTRAYNOTIFY msn; - msn.cbSize = sizeof(MIRANDASYSTRAYNOTIFY); - msn.szProto = m_szModuleName; - msn.tszInfoTitle = TranslateT("IRC error"); - msn.tszInfo = TranslateT("Connection cannot be established! You have not completed all necessary fields (Nickname, User ID and m_name)."); - msn.dwInfoFlags = NIIF_ERROR | NIIF_INTERN_UNICODE; - msn.uTimeout = 15000; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&msn); + Clist_TrayNotifyW(m_szModuleName, TranslateT("IRC error"), TranslateT("Connection cannot be established! You have not completed all necessary fields (Nickname, User ID and m_name)."), NIIF_ERROR, 15000); return 0; } diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index 672b7e3d11..08f8bd8b61 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -165,11 +165,6 @@ static INT_PTR CALLBACK DlgProcOptNet(HWND hwndDlg, UINT msg, WPARAM wParam, LPA EnableWindow(hw, FALSE); } - if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - HWND hw = GetDlgItem(hwndDlg, IDC_RAD_ERRBAL); - 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; @@ -403,12 +398,9 @@ 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 baloons but no balloons, try popups // if want popups but no popups, try baloons - // if, after that, you want balloons but no balloons, revert to message boxes - if (options.err_method == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) options.err_method = ED_POP; - if (options.err_method == ED_POP && !ServiceExists(MS_POPUP_SHOWMESSAGE)) options.err_method = ED_BAL; - if (options.err_method == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) options.err_method = ED_MB; + 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 == NULL ? -1 : mir_strlen(options.server_name), options.id == NULL ? -1 : mir_strlen(options.id), options.pword == NULL ? -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); diff --git a/protocols/Sametime/src/utils.cpp b/protocols/Sametime/src/utils.cpp index 7bbc3ff804..b5ab55d29e 100644 --- a/protocols/Sametime/src/utils.cpp +++ b/protocols/Sametime/src/utils.cpp @@ -79,9 +79,6 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) // if want baloons but no balloons, try popups // if want popups but no popups, try baloons // if, after that, you want balloons but no balloons, revert to message boxes - if (disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_POP; - if (disp == ED_POP && !ServiceExists(MS_POPUP_ADDPOPUPCLASS)) disp = ED_BAL; - if (disp == ED_BAL && !ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) disp = ED_MB; if (disp == ED_POP) { POPUPDATACLASS ppd = { sizeof(ppd) }; @@ -96,20 +93,13 @@ void CALLBACK sttMainThreadCallback(PVOID dwParam) CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd); } else if (disp == ED_BAL) { - MIRANDASYSTRAYNOTIFY sn = { sizeof(sn) }; - sn.szProto = proto->m_szModuleName; - sn.tszInfoTitle = puData->title; - sn.tszInfo = puData->text; - sn.dwInfoFlags = NIIF_INTERN_UNICODE; - if (puData->flag == SAMETIME_POPUP_ERROR) { - sn.dwInfoFlags = sn.dwInfoFlags | NIIF_WARNING; - sn.uTimeout = 1000 * 10; - } - else { - sn.dwInfoFlags = sn.dwInfoFlags | NIIF_INFO; - sn.uTimeout = 1000 * 8; - } - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)&sn); + int flags, timeout; + if (puData->flag == SAMETIME_POPUP_ERROR) + flags = NIIF_WARNING, timeout = 1000 * 10; + else + flags = NIIF_INFO, timeout = 1000 * 8; + + Clist_TrayNotifyW(proto->m_szModuleName, puData->title, puData->text, flags, timeout); } else { //disp == ED_MB if (puData->flag == SAMETIME_POPUP_ERROR) diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index a0b3b3cbe4..caeb7613af 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -424,21 +424,10 @@ void WhatsAppProto::NotifyEvent(const wchar_t *title, const wchar_t *info, MCONT } } else { - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - MIRANDASYSTRAYNOTIFY err; - int niif_flags = flags; - REMOVE_FLAG(niif_flags, WHATSAPP_EVENT_CLIENT | WHATSAPP_EVENT_NOTIFICATION | WHATSAPP_EVENT_OTHER); - err.szProto = m_szModuleName; - err.cbSize = sizeof(err); - err.dwInfoFlags = NIIF_INTERN_TCHAR | niif_flags; - err.tszInfoTitle = (wchar_t*)title; - err.tszInfo = (wchar_t*)info; - err.uTimeout = 1000 * timeout; - ret = CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)& err); - - if (ret == 0) - goto exit; - } + int niif_flags = flags; + REMOVE_FLAG(niif_flags, WHATSAPP_EVENT_CLIENT | WHATSAPP_EVENT_NOTIFICATION | WHATSAPP_EVENT_OTHER); + if (!Clist_TrayNotifyW(m_szModuleName, title, info, niif_flags, 1000 * timeout)) + goto exit; } if (FLAG_CONTAINS(flags, WHATSAPP_EVENT_CLIENT)) diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 4e792b6162..656135fbb0 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -129,18 +129,9 @@ int CYahooProto::ShowPopup(const wchar_t* nickname, const wchar_t* msg, const ch int CYahooProto::ShowNotification(const wchar_t *title, const wchar_t *info, DWORD flags) { - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - MIRANDASYSTRAYNOTIFY err; - err.szProto = m_szModuleName; - err.cbSize = sizeof(err); - err.tszInfoTitle = (wchar_t*)title; - err.tszInfo = (wchar_t*)info; - err.dwInfoFlags = flags | NIIF_INTERN_UNICODE; - err.uTimeout = 1000 * 3; - INT_PTR ret = CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)& err); - if (ret == 0) - return 1; - } + int ret = Clist_TrayNotifyW(m_szModuleName, title, info, flags, 1000 * 3); + if (ret == 0) + return 1; MessageBox(NULL, info, title, MB_OK | MB_ICONINFORMATION); return 0; diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 5fb40206cf..9935c9d747 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -482,24 +482,14 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); - if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), FALSE); - CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, BST_CHECKED); - SetDlgItemText(hwndDlg, IDC_NOTIFYBALLOON, TranslateT("Show balloon popup (unsupported system)")); - } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_TYPETRAY: if (IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)) { - if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); - } - else { - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TRUE); - } + EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); + EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TRUE); } else { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), FALSE); @@ -511,8 +501,7 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEWIN), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); - EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY) - && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)); + EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); //fall-thru case IDC_TYPEWIN: case IDC_NOTIFYTRAY: diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index b38fea7b07..c35b3821ef 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -169,16 +169,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) wchar_t szTip[256]; mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); - if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags & SMF_SHOWTYPINGCLIST)) { - MIRANDASYSTRAYNOTIFY tn = { sizeof(tn) }; - tn.tszInfoTitle = TranslateT("Typing notification"); - tn.tszInfo = szTip; - tn.dwInfoFlags = NIIF_INFO; - tn.dwInfoFlags |= NIIF_INTERN_UNICODE; - tn.uTimeout = 1000 * 4; - CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM)& tn); - } - else { + if (g_dat.flags & SMF_SHOWTYPINGCLIST) { pcli->pfnRemoveEvent(hContact, 1); CLISTEVENT cle = {}; @@ -189,9 +180,10 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) cle.pszService = "SRMsg/ReadMessage"; cle.ptszTooltip = szTip; pcli->pfnAddEvent(&cle); - + IcoLib_ReleaseIcon(cle.hIcon); } + else Clist_TrayNotifyW(NULL, TranslateT("Typing notification"), szTip, NIIF_INFO, 1000 * 4); } return 0; } diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index ab06801d8e..b58e36d1fc 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -157,7 +157,6 @@ extern mir_cs trayLockCS; void fnInitTray(void); void fnUninitTray(void); -int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY *msn); int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int status); int fnTrayIconDestroy(HWND hwnd); void fnTrayIconIconsChanged(void); diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index 7e16017196..684b76d63d 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -173,7 +173,6 @@ MIR_APP_DLL(CLIST_INTERFACE*) Clist_GetInterface(void) cli.pfnTrayIconUpdateBase = fnTrayIconUpdateBase; cli.pfnTrayCalcChanged = fnTrayCalcChanged; cli.pfnTrayIconUpdateWithImageList = fnTrayIconUpdateWithImageList; - cli.pfnCListTrayNotify = fnCListTrayNotify; cli.pfnContactListWndProc = fnContactListWndProc; cli.pfnLoadCluiGlobalOpts = fnLoadCluiGlobalOpts; diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 1b58b6647e..eae3fccf6c 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -764,71 +764,73 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // processes tray icon's notifications -int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn) +static int sttGetIcon(const char *szProto) { - if (msn == NULL) - return 1; - - if (msn->cbSize != sizeof(MIRANDASYSTRAYNOTIFY) || msn->szInfo == NULL || msn->szInfoTitle == NULL) - return 1; - - if (cli.trayIcon == NULL) - return 2; + if (szProto == NULL) + return cli.trayIcon[0].id; UINT iconId = 0; - if (msn->szProto) { - for (int j = 0; j < cli.trayIconCount; j++) { - if (cli.trayIcon[j].szProto != NULL) { - if (!mir_strcmp(msn->szProto, cli.trayIcon[j].szProto)) { - iconId = cli.trayIcon[j].id; - break; - } - } - else if (cli.trayIcon[j].isBase) { + + for (int j = 0; j < cli.trayIconCount; j++) { + if (cli.trayIcon[j].szProto != NULL) { + if (!mir_strcmp(szProto, cli.trayIcon[j].szProto)) { iconId = cli.trayIcon[j].id; break; } } + else if (cli.trayIcon[j].isBase) { + iconId = cli.trayIcon[j].id; + break; + } } - else iconId = cli.trayIcon[0].id; - - if (msn->dwInfoFlags & NIIF_INTERN_UNICODE) { - NOTIFYICONDATAW nid = { 0 }; - nid.cbSize = NOTIFYICONDATAW_V2_SIZE; - nid.hWnd = cli.hwndContactList; - nid.uID = iconId; - nid.uFlags = NIF_INFO; - mir_wstrncpy(nid.szInfo, msn->tszInfo, _countof(nid.szInfo)); - mir_wstrncpy(nid.szInfoTitle, msn->tszInfoTitle, _countof(nid.szInfoTitle)); - nid.szInfo[_countof(nid.szInfo) - 1] = 0; - nid.szInfoTitle[_countof(nid.szInfoTitle) - 1] = 0; - nid.uTimeout = msn->uTimeout; - nid.dwInfoFlags = (msn->dwInfoFlags & ~NIIF_INTERN_UNICODE); - return Shell_NotifyIconW(NIM_MODIFY, &nid) == 0; - } - else { - NOTIFYICONDATAA nid = { 0 }; - nid.cbSize = NOTIFYICONDATAA_V2_SIZE; - nid.hWnd = cli.hwndContactList; - nid.uID = iconId; - nid.uFlags = NIF_INFO; - strncpy_s(nid.szInfo, msn->szInfo, _TRUNCATE); - strncpy_s(nid.szInfoTitle, msn->szInfoTitle, _TRUNCATE); - nid.uTimeout = msn->uTimeout; - nid.dwInfoFlags = msn->dwInfoFlags; - return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0; - } + + return iconId; } -///////////////////////////////////////////////////////////////////////////////////////// +MIR_APP_DLL(int) Clist_TrayNotifyA(const char *szProto, const char *szInfoTitle, const char *szInfo, DWORD dwInfoFlags, UINT uTimeout) +{ + if (szInfo == NULL || szInfoTitle == NULL) + return 1; + if (cli.trayIcon == NULL) + return 2; -static DLLVERSIONINFO dviShell = { sizeof(dviShell) }; + NOTIFYICONDATAA nid = { 0 }; + nid.cbSize = NOTIFYICONDATAA_V2_SIZE; + nid.hWnd = cli.hwndContactList; + nid.uID = sttGetIcon(szProto); + nid.uFlags = NIF_INFO; + strncpy_s(nid.szInfo, szInfo, _TRUNCATE); + strncpy_s(nid.szInfoTitle, szInfoTitle, _TRUNCATE); + nid.uTimeout = uTimeout; + nid.dwInfoFlags = dwInfoFlags; + return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0; +} -static INT_PTR pfnCListTrayNotifyStub(WPARAM, LPARAM lParam) +MIR_APP_DLL(int) Clist_TrayNotifyW(const char *szProto, const wchar_t *wszInfoTitle, const wchar_t *wszInfo, DWORD dwInfoFlags, UINT uTimeout) { - return cli.pfnCListTrayNotify((MIRANDASYSTRAYNOTIFY*)lParam); + if (wszInfo == NULL || wszInfoTitle == NULL) + return 1; + if (cli.trayIcon == NULL) + return 2; + + NOTIFYICONDATAW nid = { 0 }; + nid.cbSize = NOTIFYICONDATAW_V2_SIZE; + nid.hWnd = cli.hwndContactList; + nid.uID = sttGetIcon(szProto); + nid.uFlags = NIF_INFO; + mir_wstrncpy(nid.szInfo, wszInfo, _countof(nid.szInfo)); + mir_wstrncpy(nid.szInfoTitle, wszInfoTitle, _countof(nid.szInfoTitle)); + nid.szInfo[_countof(nid.szInfo) - 1] = 0; + nid.szInfoTitle[_countof(nid.szInfoTitle) - 1] = 0; + nid.uTimeout = uTimeout; + nid.dwInfoFlags = dwInfoFlags; + return Shell_NotifyIconW(NIM_MODIFY, &nid) == 0; } +///////////////////////////////////////////////////////////////////////////////////////// + +static DLLVERSIONINFO dviShell = { sizeof(dviShell) }; + void fnInitTray(void) { if (HMODULE hLib = GetModuleHandleA("shell32")) { @@ -838,7 +840,6 @@ void fnInitTray(void) } } - CreateServiceFunction(MS_CLIST_SYSTRAY_NOTIFY, pfnCListTrayNotifyStub); fTrayInited = TRUE; } diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 0eb0475b37..00556c908f 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -273,3 +273,5 @@ Clist_ContactCompare @272 Clist_ContactDoubleClicked @273 Clist_GetImageList @274 Clist_GetInterface @275 +Clist_TrayNotifyA @276 +Clist_TrayNotifyW @277 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 1d6f6103f9..7a39c78b76 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -273,3 +273,5 @@ Clist_ContactCompare @272 Clist_ContactDoubleClicked @273 Clist_GetImageList @274 Clist_GetInterface @275 +Clist_TrayNotifyA @276 +Clist_TrayNotifyW @277 -- cgit v1.2.3