summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-03-01 11:47:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-03-01 11:47:16 +0300
commit35aba3d91e39932517046ff84ab7d3e4ef0cf932 (patch)
tree69015cd0169d2134b0e8a61b87c7dd9b27865069 /protocols
parent2e9d13165b4fd765d95f88d26282be022e708b0d (diff)
ICQ-WIM:
- advanced options moved to the separate dialog; - option added to launch a browser on tray icon click; - now additional email events aren't added if one is already active; - duplicate notification removed
Diffstat (limited to 'protocols')
-rw-r--r--protocols/ICQ-WIM/res/resources.rc46
-rw-r--r--protocols/ICQ-WIM/src/options.cpp101
-rw-r--r--protocols/ICQ-WIM/src/poll.cpp3
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp3
-rw-r--r--protocols/ICQ-WIM/src/proto.h2
-rw-r--r--protocols/ICQ-WIM/src/resource.h4
-rw-r--r--protocols/ICQ-WIM/src/utils.cpp10
7 files changed, 122 insertions, 47 deletions
diff --git a/protocols/ICQ-WIM/res/resources.rc b/protocols/ICQ-WIM/res/resources.rc
index 6e3fe41527..1abfa72b0d 100644
--- a/protocols/ICQ-WIM/res/resources.rc
+++ b/protocols/ICQ-WIM/res/resources.rc
@@ -47,29 +47,38 @@ BEGIN
PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,42,34,142,14
END
-IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 174
+IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 125
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,74
+ GROUPBOX "ICQ",IDC_STATIC,1,0,305,62
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,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
+ CONTROL "Use tray icon notifications",IDC_USETRAYICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,73,285,10
+ PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,165,106,142,14
+ GROUPBOX "E-mail",IDC_STATIC,1,62,306,40
+ CONTROL "Launch mailbox in a browser on click",IDC_LAUNCH_MAILBOX,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,21,86,281,10
+END
+
+IDD_OPTIONS_ADV DIALOGEX 0, 0, 310, 86
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ LTEXT "If a contact goes Offline, set this status instead and cache it for given timeout in seconds (0 - disabled)",IDC_STATIC,12,16,204,23
+ EDITTEXT IDC_DIFF1,221,13,54,12,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,275,12,11,14
+ COMBOBOX IDC_STATUS1,221,28,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,49,204,23
+ EDITTEXT IDC_DIFF2,221,46,54,12,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN2,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,275,45,11,14
+ COMBOBOX IDC_STATUS2,221,61,81,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_GROUPCHAT_INVITE DIALOGEX 0, 0, 215, 263
@@ -142,7 +151,11 @@ BEGIN
IDD_OPTIONS_FULL, DIALOG
BEGIN
- BOTTOMMARGIN, 169
+ BOTTOMMARGIN, 120
+ END
+
+ IDD_OPTIONS_ADV, DIALOG
+ BEGIN
END
IDD_GROUPCHAT_INVITE, DIALOG
@@ -204,6 +217,11 @@ BEGIN
0
END
+IDD_OPTIONS_ADV AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp
index 7faab09b7d..b93772543f 100644
--- a/protocols/ICQ-WIM/src/options.cpp
+++ b/protocols/ICQ-WIM/src/options.cpp
@@ -154,40 +154,31 @@ void CIcqProto::OnLoginViaPhone(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pRe
class CIcqOptionsDlg : public CProtoDlgBase<CIcqProto>
{
- CCtrlEdit edtUin, edtPassword, edtDiff1, edtDiff2;
- CCtrlSpin spin1, spin2;
- CCtrlCombo cmbStatus1, cmbStatus2;
- CCtrlCheck chkHideChats, chkTrayIcon;
+ CCtrlEdit edtUin, edtPassword;
+ CCtrlCheck chkHideChats, chkTrayIcon, chkLaunchMailbox;
CCtrlButton btnCreate;
CMStringW wszOldPass;
public:
CIcqOptionsDlg(CIcqProto *ppro, int iDlgID, bool bFullDlg) :
CProtoDlgBase<CIcqProto>(ppro, iDlgID),
- spin1(this, IDC_SPIN1, 32000),
- spin2(this, IDC_SPIN2, 32000),
edtUin(this, IDC_UIN),
- edtDiff1(this, IDC_DIFF1),
- edtDiff2(this, IDC_DIFF2),
btnCreate(this, IDC_REGISTER),
- cmbStatus1(this, IDC_STATUS1),
- cmbStatus2(this, IDC_STATUS2),
edtPassword(this, IDC_PASSWORD),
chkTrayIcon(this, IDC_USETRAYICON),
- chkHideChats(this, IDC_HIDECHATS)
+ chkHideChats(this, IDC_HIDECHATS),
+ chkLaunchMailbox(this, IDC_LAUNCH_MAILBOX)
{
btnCreate.OnClick = Callback(this, &CIcqOptionsDlg::onClick_Register);
- edtDiff1.OnChange = Callback(this, &CIcqOptionsDlg::onChange_Timeout1);
- edtDiff2.OnChange = Callback(this, &CIcqOptionsDlg::onChange_Timeout2);
-
CreateLink(edtUin, ppro->m_szOwnId);
CreateLink(edtPassword, ppro->m_szPassword);
if (bFullDlg) {
- CreateLink(spin1, ppro->m_iTimeDiff1);
- CreateLink(spin2, ppro->m_iTimeDiff2);
CreateLink(chkHideChats, ppro->m_bHideGroupchats);
CreateLink(chkTrayIcon, ppro->m_bUseTrayIcon);
+ CreateLink(chkLaunchMailbox, ppro->m_bLaunchMailbox);
+
+ chkTrayIcon.OnChange = Callback(this, &CIcqOptionsDlg::onChange_Tray);
}
wszOldPass = ppro->m_szPassword;
@@ -195,6 +186,62 @@ public:
bool OnInitDialog() override
{
+ onChange_Tray(0);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ if (wszOldPass != ptrW(edtPassword.GetText())) {
+ m_proto->delSetting(DB_KEY_ATOKEN);
+ m_proto->delSetting(DB_KEY_SESSIONKEY);
+ m_proto->delSetting(DB_KEY_PHONEREG);
+ }
+ return true;
+ }
+
+ void onChange_Tray(CCtrlCheck*)
+ {
+ chkLaunchMailbox.Enable(chkTrayIcon.GetState());
+ }
+
+ void onClick_Register(CCtrlButton*)
+ {
+ CIcqRegistrationDlg dlg(m_proto);
+ dlg.SetParent(m_hwnd);
+ if (dlg.DoModal()) // force exit to avoid data corruption
+ PostMessage(m_hwndParent, WM_COMMAND, MAKELONG(IDCANCEL, BN_CLICKED), 0);
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Advanced options
+
+class CIcqOptionsAdv : public CProtoDlgBase<CIcqProto>
+{
+ CCtrlEdit edtDiff1, edtDiff2;
+ CCtrlSpin spin1, spin2;
+ CCtrlCombo cmbStatus1, cmbStatus2;
+
+public:
+ CIcqOptionsAdv(CIcqProto *ppro) :
+ CProtoDlgBase<CIcqProto>(ppro, IDD_OPTIONS_ADV),
+ spin1(this, IDC_SPIN1, 32000),
+ spin2(this, IDC_SPIN2, 32000),
+ edtDiff1(this, IDC_DIFF1),
+ edtDiff2(this, IDC_DIFF2),
+ cmbStatus1(this, IDC_STATUS1),
+ cmbStatus2(this, IDC_STATUS2)
+ {
+ edtDiff1.OnChange = Callback(this, &CIcqOptionsAdv::onChange_Timeout1);
+ edtDiff2.OnChange = Callback(this, &CIcqOptionsAdv::onChange_Timeout2);
+
+ CreateLink(spin1, ppro->m_iTimeDiff1);
+ CreateLink(spin2, ppro->m_iTimeDiff2);
+ }
+
+ bool OnInitDialog() override
+ {
if (cmbStatus1.GetHwnd()) {
for (DWORD iStatus = ID_STATUS_OFFLINE; iStatus <= ID_STATUS_OUTTOLUNCH; iStatus++) {
int idx = cmbStatus1.AddString(Clist_GetStatusModeDescription(iStatus, 0));
@@ -221,22 +268,9 @@ public:
m_proto->m_iStatus2 = cmbStatus2.GetItemData(cmbStatus2.GetCurSel());
}
- if (wszOldPass != ptrW(edtPassword.GetText())) {
- m_proto->delSetting(DB_KEY_ATOKEN);
- m_proto->delSetting(DB_KEY_SESSIONKEY);
- m_proto->delSetting(DB_KEY_PHONEREG);
- }
return true;
}
- void onClick_Register(CCtrlButton*)
- {
- CIcqRegistrationDlg dlg(m_proto);
- dlg.SetParent(m_hwnd);
- if (dlg.DoModal()) // force exit to avoid data corruption
- PostMessage(m_hwndParent, WM_COMMAND, MAKELONG(IDCANCEL, BN_CLICKED), 0);
- }
-
void onChange_Timeout1(CCtrlEdit*)
{
bool bEnabled = edtDiff1.GetInt() != 0;
@@ -253,6 +287,9 @@ public:
}
};
+/////////////////////////////////////////////////////////////////////////////////////////
+// Services
+
INT_PTR CIcqProto::CreateAccMgrUI(WPARAM, LPARAM hwndParent)
{
CIcqOptionsDlg *pDlg = new CIcqOptionsDlg(this, IDD_OPTIONS_ACCMGR, false);
@@ -268,7 +305,13 @@ int CIcqProto::OnOptionsInit(WPARAM wParam, LPARAM)
odp.flags = ODPF_UNICODE | ODPF_BOLDGROUPS;
odp.szGroup.w = LPGENW("Network");
odp.position = 1;
+
+ odp.szTab.w = LPGENW("General");
odp.pDialog = new CIcqOptionsDlg(this, IDD_OPTIONS_FULL, true);
g_plugin.addOptions(wParam, &odp);
+
+ odp.szTab.w = LPGENW("Advanced");
+ odp.pDialog = new CIcqOptionsAdv(this);
+ g_plugin.addOptions(wParam, &odp);
return 0;
}
diff --git a/protocols/ICQ-WIM/src/poll.cpp b/protocols/ICQ-WIM/src/poll.cpp
index eaf477f384..8c0147bca8 100644
--- a/protocols/ICQ-WIM/src/poll.cpp
+++ b/protocols/ICQ-WIM/src/poll.cpp
@@ -220,7 +220,8 @@ void CIcqProto::ProcessNotification(const JSONNode &ev)
m_szMailBox = (*root)["email"].as_mstring();
m_unreadEmails = (*root)["unreadCount"].as_int();
- if (m_unreadEmails > 0) {
+ // we notify about initial mail count only during login
+ if (m_bFirstBos && m_unreadEmails > 0) {
CMStringW wszMessage(FORMAT, TranslateT("You have %d unread emails"), m_unreadEmails);
EmailNotification(wszMessage);
}
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index 247492bc45..8b6fe3b126 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -52,7 +52,8 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) :
m_iTimeDiff2(this, "TimeDiff2", 0),
m_szPassword(this, "Password"),
m_bHideGroupchats(this, "HideChats", true),
- m_bUseTrayIcon(this, "UseTrayIcon", false)
+ m_bUseTrayIcon(this, "UseTrayIcon", false),
+ m_bLaunchMailbox(this, "LaunchMailbox", true)
{
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 10b7280488..8dfa81a8cc 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -37,6 +37,7 @@
#define ICQ_API_SERVER "https://api.icq.net"
#define ICQ_ROBUST_SERVER "https://rapi.icq.net"
+#define PS_DUMMY "/DoNothing"
#define PS_GOTO_INBOX "/GotoInbox"
#define WIM_CAP_VOIP_VOICE "094613504c7f11d18222444553540000"
@@ -334,6 +335,7 @@ public:
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<BYTE> m_bLaunchMailbox; // launch browser to view email
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
diff --git a/protocols/ICQ-WIM/src/resource.h b/protocols/ICQ-WIM/src/resource.h
index f738e14180..32ab58a703 100644
--- a/protocols/ICQ-WIM/src/resource.h
+++ b/protocols/ICQ-WIM/src/resource.h
@@ -10,6 +10,7 @@
#define IDD_EDITIGNORE 106
#define IDI_INBOX 107
#define IDI_MAIL_NOTIFY 108
+#define IDD_OPTIONS_ADV 109
#define IDC_PASSWORD 1001
#define IDC_UIN 1002
#define IDC_UIN2 1003
@@ -29,6 +30,7 @@
#define IDC_SPIN1 1018
#define IDC_STATUS1 1019
#define IDC_USETRAYICON 1020
+#define IDC_LAUNCH_MAILBOX 1021
#define IDC_DIFF2 1023
#define IDC_SPIN2 1024
#define IDC_STATUS2 1025
@@ -37,7 +39,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 109
+#define _APS_NEXT_RESOURCE_VALUE 110
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1021
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp
index fb4df6b568..988984d781 100644
--- a/protocols/ICQ-WIM/src/utils.cpp
+++ b/protocols/ICQ-WIM/src/utils.cpp
@@ -333,7 +333,15 @@ void CIcqProto::EmailNotification(const wchar_t *pwszText)
if (m_bUseTrayIcon) {
char szServiceFunction[MAX_PATH];
- mir_snprintf(szServiceFunction, "%s%s", m_szModuleName, PS_GOTO_INBOX);
+ if (m_bLaunchMailbox)
+ mir_snprintf(szServiceFunction, "%s%s", m_szModuleName, PS_GOTO_INBOX);
+ else
+ mir_snprintf(szServiceFunction, "%s%s", m_szModuleName, PS_DUMMY);
+
+ int i = 0;
+ while (CLISTEVENT *pcle = g_clistApi.pfnGetEvent(-1, i++))
+ if (!mir_strcmp(pcle->pszService, szServiceFunction))
+ return;
CLISTEVENT cle = {};
cle.hDbEvent = 1;