summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/ICQ-WIM/res/resources.rc39
-rw-r--r--protocols/ICQ-WIM/src/options.cpp4
-rw-r--r--protocols/ICQ-WIM/src/poll.cpp25
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp3
-rw-r--r--protocols/ICQ-WIM/src/proto.h11
-rw-r--r--protocols/ICQ-WIM/src/resource.h5
-rw-r--r--protocols/ICQ-WIM/src/utils.cpp46
7 files changed, 83 insertions, 50 deletions
diff --git a/protocols/ICQ-WIM/res/resources.rc b/protocols/ICQ-WIM/res/resources.rc
index 9fd841398e..6e3fe41527 100644
--- a/protocols/ICQ-WIM/res/resources.rc
+++ b/protocols/ICQ-WIM/res/resources.rc
@@ -26,8 +26,10 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_INBOX ICON "Mail.ico"
+
IDI_MAIL_NOTIFY ICON "MailNotify.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
@@ -45,28 +47,29 @@ BEGIN
PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,42,34,142,14
END
-IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 161
+IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 174
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "ICQ",IDC_STATIC,4,0,302,63
- RTEXT "UIN/e-mail:",IDC_STATIC,12,14,51,8
- EDITTEXT IDC_UIN,68,12,106,12,ES_AUTOHSCROLL
- RTEXT "Password:",IDC_STATIC,12,30,51,8
- EDITTEXT IDC_PASSWORD,68,29,106,12,ES_PASSWORD | ES_AUTOHSCROLL
+ GROUPBOX "ICQ",IDC_STATIC,4,0,302,74
+ RTEXT "UIN/e-mail:",IDC_STATIC,10,14,79,8
+ EDITTEXT IDC_UIN,98,12,106,12,ES_AUTOHSCROLL
+ RTEXT "Password:",IDC_STATIC,10,30,79,8
+ EDITTEXT IDC_PASSWORD,98,29,106,12,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Do not open chat windows on creation",IDC_HIDECHATS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,48,285,10
- GROUPBOX "Advanced",IDC_STATIC,4,62,302,77
- LTEXT "If a contact goes Offline, set this status instead and cache it for given timeout in seconds (0 - disabled)",IDC_STATIC,12,75,204,23
- EDITTEXT IDC_DIFF1,221,72,54,12,ES_AUTOHSCROLL
- CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,275,71,11,14
- COMBOBOX IDC_STATUS1,221,87,81,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- LTEXT "After that, set this status to a contact and move it offline after specified timeout in seconds (0 - disabled)",IDC_STATIC,12,108,204,23
- EDITTEXT IDC_DIFF2,221,105,54,12,ES_AUTOHSCROLL
- CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,275,104,11,14
- COMBOBOX IDC_STATUS2,221,120,81,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,165,143,142,14
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,47,285,10
+ CONTROL "Use tray icon notifications",IDC_USETRAYICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,59,285,10
+ GROUPBOX "Advanced",IDC_STATIC,4,75,302,77
+ LTEXT "If a contact goes Offline, set this status instead and cache it for given timeout in seconds (0 - disabled)",IDC_STATIC,12,88,204,23
+ EDITTEXT IDC_DIFF1,221,85,54,12,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,275,84,11,14
+ COMBOBOX IDC_STATUS1,221,100,81,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ LTEXT "After that, set this status to a contact and move it offline after specified timeout in seconds (0 - disabled)",IDC_STATIC,12,121,204,23
+ EDITTEXT IDC_DIFF2,221,118,54,12,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,275,117,11,14
+ COMBOBOX IDC_STATUS2,221,133,81,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
+ PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,165,155,142,14
END
IDD_GROUPCHAT_INVITE DIALOGEX 0, 0, 215, 263
@@ -139,7 +142,7 @@ BEGIN
IDD_OPTIONS_FULL, DIALOG
BEGIN
- BOTTOMMARGIN, 156
+ BOTTOMMARGIN, 169
END
IDD_GROUPCHAT_INVITE, DIALOG
diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp
index 09fce66101..7faab09b7d 100644
--- a/protocols/ICQ-WIM/src/options.cpp
+++ b/protocols/ICQ-WIM/src/options.cpp
@@ -157,7 +157,7 @@ class CIcqOptionsDlg : public CProtoDlgBase<CIcqProto>
CCtrlEdit edtUin, edtPassword, edtDiff1, edtDiff2;
CCtrlSpin spin1, spin2;
CCtrlCombo cmbStatus1, cmbStatus2;
- CCtrlCheck chkHideChats;
+ CCtrlCheck chkHideChats, chkTrayIcon;
CCtrlButton btnCreate;
CMStringW wszOldPass;
@@ -173,6 +173,7 @@ public:
cmbStatus1(this, IDC_STATUS1),
cmbStatus2(this, IDC_STATUS2),
edtPassword(this, IDC_PASSWORD),
+ chkTrayIcon(this, IDC_USETRAYICON),
chkHideChats(this, IDC_HIDECHATS)
{
btnCreate.OnClick = Callback(this, &CIcqOptionsDlg::onClick_Register);
@@ -186,6 +187,7 @@ public:
CreateLink(spin1, ppro->m_iTimeDiff1);
CreateLink(spin2, ppro->m_iTimeDiff2);
CreateLink(chkHideChats, ppro->m_bHideGroupchats);
+ CreateLink(chkTrayIcon, ppro->m_bUseTrayIcon);
}
wszOldPass = ppro->m_szPassword;
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp
index 25d34b5e8d..eaf477f384 100644
--- a/protocols/ICQ-WIM/src/poll.cpp
+++ b/protocols/ICQ-WIM/src/poll.cpp
@@ -200,20 +200,6 @@ void CIcqProto::ProcessMyInfo(const JSONNode &ev)
CheckAvatarChange(0, ev);
}
-void CIcqProto::EmailNotification(const wchar_t *pwszText)
-{
- char szServiceFunction[MAX_PATH];
- mir_snprintf(szServiceFunction, "%s%s", m_szModuleName, PS_GOTO_INBOX);
-
- CLISTEVENT cle = {};
- cle.hDbEvent = 1;
- cle.hIcon = IcoLib_GetIconByHandle(iconList[1].hIcolib);
- cle.flags = CLEF_UNICODE;
- cle.pszService = szServiceFunction;
- cle.szTooltip.w = pwszText;
- g_clistApi.pfnAddEvent(&cle);
-}
-
void CIcqProto::ProcessNotification(const JSONNode &ev)
{
for (auto &fld : ev["fields"]) {
@@ -224,15 +210,8 @@ void CIcqProto::ProcessNotification(const JSONNode &ev)
CMStringW wszSubj((*root)["subject"].as_mstring());
m_unreadEmails = (*root)["unreadCount"].as_int();
- POPUPDATAW Popup = {};
- mir_snwprintf(Popup.lpwzText, LPGENW("You received e-mail from %s: %s"), wszFrom.c_str(), wszSubj.c_str());
- Popup.lchIcon = IcoLib_GetIconByHandle(iconList[1].hIcolib);
- if (g_bPopupService) {
- wcsncpy_s(Popup.lpwzContactName, m_tszUserName, _TRUNCATE);
- CallService(MS_POPUP_ADDPOPUPW, (WPARAM)&Popup, 0);
- }
-
- EmailNotification(Popup.lpwzText);
+ CMStringW wszMessage(FORMAT, TranslateT("You received e-mail from %s: %s"), wszFrom.c_str(), wszSubj.c_str());
+ EmailNotification(wszMessage);
}
const JSONNode &status = fld["mailbox.status"];
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index b587c1976f..247492bc45 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -51,7 +51,8 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) :
m_iTimeDiff1(this, "TimeDiff1", 0),
m_iTimeDiff2(this, "TimeDiff2", 0),
m_szPassword(this, "Password"),
- m_bHideGroupchats(this, "HideChats", 1)
+ m_bHideGroupchats(this, "HideChats", true),
+ m_bUseTrayIcon(this, "UseTrayIcon", false)
{
db_set_resident(m_szModuleName, "IdleTS");
db_set_resident(m_szModuleName, "OnlineTS");
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index 8125aae649..10b7280488 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -330,12 +330,13 @@ public:
CIcqProto(const char*, const wchar_t*);
~CIcqProto();
- CMOption<wchar_t*> m_szOwnId; // our own aim id
- CMOption<wchar_t*> m_szPassword; // password, if present
- CMOption<BYTE> m_bHideGroupchats; // don't pop up group chat windows on startup
- CMOption<DWORD> m_iTimeDiff1; // set this status to m_iStatus1 after this interval of secs
+ CMOption<wchar_t*> m_szOwnId; // our own aim id
+ CMOption<wchar_t*> m_szPassword; // password, if present
+ CMOption<BYTE> m_bHideGroupchats; // don't pop up group chat windows on startup
+ CMOption<BYTE> m_bUseTrayIcon; // use tray icon notifications
+ CMOption<DWORD> m_iTimeDiff1; // set this status to m_iStatus1 after this interval of secs
CMOption<DWORD> m_iStatus1;
- CMOption<DWORD> m_iTimeDiff2; // set this status to m_iStatus2 after this interval of secs
+ CMOption<DWORD> m_iTimeDiff2; // set this status to m_iStatus2 after this interval of secs
CMOption<DWORD> m_iStatus2;
void CheckStatus(void);
diff --git a/protocols/ICQ-WIM/src/resource.h b/protocols/ICQ-WIM/src/resource.h
index ce308ae793..f738e14180 100644
--- a/protocols/ICQ-WIM/src/resource.h
+++ b/protocols/ICQ-WIM/src/resource.h
@@ -8,7 +8,7 @@
#define IDD_INFO_ICQ 104
#define IDD_REGISTER 105
#define IDD_EDITIGNORE 106
-#define IDI_INBOX 107
+#define IDI_INBOX 107
#define IDI_MAIL_NOTIFY 108
#define IDC_PASSWORD 1001
#define IDC_UIN 1002
@@ -28,6 +28,7 @@
#define IDC_DIFF1 1017
#define IDC_SPIN1 1018
#define IDC_STATUS1 1019
+#define IDC_USETRAYICON 1020
#define IDC_DIFF2 1023
#define IDC_SPIN2 1024
#define IDC_STATUS2 1025
@@ -38,7 +39,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 109
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1020
+#define _APS_NEXT_CONTROL_VALUE 1021
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp
index 7467ffee31..fb4df6b568 100644
--- a/protocols/ICQ-WIM/src/utils.cpp
+++ b/protocols/ICQ-WIM/src/utils.cpp
@@ -298,3 +298,49 @@ char* time2text(time_t time)
return "<invalid>";
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+ switch (message) {
+ case WM_CONTEXTMENU:
+ PUDeletePopup(hWnd);
+ break;
+
+ case WM_COMMAND:
+ CIcqProto *ppro = (CIcqProto*)PUGetPluginData(hWnd);
+ CallProtoService(ppro->m_szModuleName, PS_GOTO_INBOX);
+ PUDeletePopup(hWnd);
+ break;
+ }
+
+ return DefWindowProc(hWnd, message, wParam, lParam);
+}
+
+void CIcqProto::EmailNotification(const wchar_t *pwszText)
+{
+ if (g_bPopupService) {
+ POPUPDATAW Popup = {};
+ Popup.lchIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
+ wcsncpy_s(Popup.lpwzText, pwszText, _TRUNCATE);
+ wcsncpy_s(Popup.lpwzContactName, m_tszUserName, _TRUNCATE);
+ Popup.iSeconds = 20;
+ Popup.PluginData = this;
+ Popup.PluginWindowProc = PopupDlgProc;
+ PUAddPopupW(&Popup);
+ }
+
+ if (m_bUseTrayIcon) {
+ char szServiceFunction[MAX_PATH];
+ mir_snprintf(szServiceFunction, "%s%s", m_szModuleName, PS_GOTO_INBOX);
+
+ CLISTEVENT cle = {};
+ cle.hDbEvent = 1;
+ cle.hIcon = IcoLib_GetIconByHandle(iconList[0].hIcolib);
+ cle.flags = CLEF_UNICODE;
+ cle.pszService = szServiceFunction;
+ cle.szTooltip.w = pwszText;
+ g_clistApi.pfnAddEvent(&cle);
+ }
+}