summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-06 18:26:47 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-06 18:26:47 +0000
commita27b07c35565ced7f690890dcba29518ae2e4928 (patch)
treed599c43d8448816a5fcc5f09838dd817b59f3b3f /protocols
parenta609a99eebd89fca7955c8957fc0f2e99c8ededb (diff)
MS_CLIST_SYSTRAY_NOTIFY - more useless code removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@17268 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/events.cpp15
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp11
-rw-r--r--protocols/IRCG/src/ircproto.cpp9
-rw-r--r--protocols/Sametime/src/options.cpp12
-rw-r--r--protocols/Sametime/src/utils.cpp24
-rw-r--r--protocols/WhatsApp/src/proto.cpp19
-rw-r--r--protocols/Yahoo/src/util.cpp15
7 files changed, 20 insertions, 85 deletions
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;