summaryrefslogtreecommitdiff
path: root/src
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 /src
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 'src')
-rw-r--r--src/core/stdmsg/src/msgoptions.cpp17
-rw-r--r--src/core/stdmsg/src/msgs.cpp14
-rw-r--r--src/mir_app/src/clc.h1
-rw-r--r--src/mir_app/src/clistcore.cpp1
-rw-r--r--src/mir_app/src/clisttray.cpp103
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
7 files changed, 62 insertions, 78 deletions
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