summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2019-01-31 16:10:20 +0300
committerGeorge Hazan <ghazan@miranda.im>2019-01-31 16:10:27 +0300
commitd8aaed8d4fbec6147975e482f4b02a8e9521d99a (patch)
tree11a178b327428970ed38eeba172487ba3ab4d34c /protocols
parent332488b9d65e049c057bfd0b147f402ab0d8bf92 (diff)
fixes #1808 (ICQ10: implement login by email/password)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/ICQ-WIM/res/resources.rc27
-rw-r--r--protocols/ICQ-WIM/src/options.cpp4
-rw-r--r--protocols/ICQ-WIM/src/proto.cpp3
-rw-r--r--protocols/ICQ-WIM/src/proto.h1
-rw-r--r--protocols/ICQ-WIM/src/resource.h4
-rw-r--r--protocols/ICQ-WIM/src/server.cpp7
6 files changed, 30 insertions, 16 deletions
diff --git a/protocols/ICQ-WIM/res/resources.rc b/protocols/ICQ-WIM/res/resources.rc
index c8791da8f8..044259fa59 100644
--- a/protocols/ICQ-WIM/res/resources.rc
+++ b/protocols/ICQ-WIM/res/resources.rc
@@ -23,30 +23,34 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Dialog
//
-IDD_OPTIONS_ACCMGR DIALOGEX 0, 0, 186, 68
+IDD_OPTIONS_ACCMGR DIALOGEX 0, 0, 186, 69
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LTEXT "ICQ number:",IDC_STATIC,0,0,53,12
+ LTEXT "ICQ number:",IDC_STATIC,0,2,53,8
EDITTEXT IDC_UIN,54,0,131,12,ES_AUTOHSCROLL
- LTEXT "Password:",IDC_STATIC,0,16,53,12
- EDITTEXT IDC_PASSWORD,54,16,131,12,ES_PASSWORD | ES_AUTOHSCROLL
- PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,42,34,142,14
+ LTEXT "Email:",IDC_STATIC,0,18,53,8
+ EDITTEXT IDC_EMAIL,54,16,131,12,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,0,33,53,8
+ EDITTEXT IDC_PASSWORD,54,32,131,12,ES_PASSWORD | ES_AUTOHSCROLL
+ PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,42,49,142,14
END
-IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 81
+IDD_OPTIONS_FULL DIALOGEX 0, 0, 310, 97
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,60
+ GROUPBOX "ICQ",IDC_STATIC,4,0,302,76
RTEXT "ICQ number:",IDC_STATIC,12,14,51,8
EDITTEXT IDC_UIN,68,12,106,12,ES_AUTOHSCROLL
- RTEXT "Password:",IDC_STATIC,12,28,51,8
- EDITTEXT IDC_PASSWORD,68,26,106,12,ES_PASSWORD | ES_AUTOHSCROLL
- PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,163,63,142,14
- CONTROL "Hide group chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,45,285,10
+ RTEXT "Email:",IDC_STATIC,12,29,51,8
+ EDITTEXT IDC_EMAIL,68,27,106,12,ES_AUTOHSCROLL
+ RTEXT "Password:",IDC_STATIC,12,43,51,8
+ EDITTEXT IDC_PASSWORD,68,42,106,12,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Hide group chats on startup",IDC_HIDECHATS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,61,285,10
+ PUSHBUTTON "Sign in/sign up using phone",IDC_REGISTER,163,79,142,14
END
IDD_GROUPCHAT_INVITE DIALOGEX 0, 0, 215, 263
@@ -108,6 +112,7 @@ BEGIN
IDD_OPTIONS_FULL, DIALOG
BEGIN
+ BOTTOMMARGIN, 81
END
IDD_GROUPCHAT_INVITE, DIALOG
diff --git a/protocols/ICQ-WIM/src/options.cpp b/protocols/ICQ-WIM/src/options.cpp
index 1c94b55b15..13307d8d02 100644
--- a/protocols/ICQ-WIM/src/options.cpp
+++ b/protocols/ICQ-WIM/src/options.cpp
@@ -154,7 +154,7 @@ void CIcqProto::OnLoginViaPhone(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pRe
class CIcqOptionsDlg : public CProtoDlgBase<CIcqProto>
{
- CCtrlEdit edtUin, edtPassword;
+ CCtrlEdit edtUin, edtEmail, edtPassword;
CCtrlCheck chkHideChats;
CCtrlButton btnCreate;
CMStringW wszOldPass;
@@ -163,6 +163,7 @@ public:
CIcqOptionsDlg(CIcqProto *ppro, int iDlgID, bool bFullDlg) :
CProtoDlgBase<CIcqProto>(ppro, iDlgID),
edtUin(this, IDC_UIN),
+ edtEmail(this, IDC_EMAIL),
btnCreate(this, IDC_REGISTER),
edtPassword(this, IDC_PASSWORD),
chkHideChats(this, IDC_HIDECHATS)
@@ -170,6 +171,7 @@ public:
btnCreate.OnClick = Callback(this, &CIcqOptionsDlg::onClick_Register);
CreateLink(edtUin, ppro->m_dwUin);
+ CreateLink(edtEmail, ppro->m_szEmail);
CreateLink(edtPassword, ppro->m_szPassword);
if (bFullDlg)
CreateLink(chkHideChats, ppro->m_bHideGroupchats);
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp
index 6de8c1e60d..3520584a24 100644
--- a/protocols/ICQ-WIM/src/proto.cpp
+++ b/protocols/ICQ-WIM/src/proto.cpp
@@ -41,6 +41,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) :
arMarkReadQueue(10, NumericKeySortT),
m_evRequestsQueue(CreateEvent(nullptr, FALSE, FALSE, nullptr)),
m_dwUin(this, DB_KEY_UIN, 0),
+ m_szEmail(this, "Email"),
m_szPassword(this, "Password"),
m_bHideGroupchats(this, "HideChats", 1)
{
@@ -435,7 +436,7 @@ int CIcqProto::SetStatus(int iNewStatus)
m_iStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)iOldStatus, m_iStatus);
- if (m_dwUin == 0) {
+ if (m_dwUin == 0 && mir_wstrlen(m_szEmail) == 0) {
debugLogA("Thread ended, UIN/password are not configured");
ConnectionFailed(LOGINERR_BADUSERID);
return 0;
diff --git a/protocols/ICQ-WIM/src/proto.h b/protocols/ICQ-WIM/src/proto.h
index 68619e2a6c..827718e03e 100644
--- a/protocols/ICQ-WIM/src/proto.h
+++ b/protocols/ICQ-WIM/src/proto.h
@@ -302,6 +302,7 @@ public:
~CIcqProto();
CMOption<DWORD> m_dwUin; // our own id
+ CMOption<wchar_t*> m_szEmail; // email, if present
CMOption<wchar_t*> m_szPassword; // password, if present
CMOption<BYTE> m_bHideGroupchats; // don't pop up group chat windows on startup
diff --git a/protocols/ICQ-WIM/src/resource.h b/protocols/ICQ-WIM/src/resource.h
index e8bede4085..7af9c260d7 100644
--- a/protocols/ICQ-WIM/src/resource.h
+++ b/protocols/ICQ-WIM/src/resource.h
@@ -9,6 +9,7 @@
#define IDD_REGISTER 105
#define IDC_PASSWORD 1001
#define IDC_UIN 1002
+#define IDC_UIN2 1003
#define IDC_HIDECHATS 1004
#define IDC_REGISTER 1005
#define IDC_PHONE 1006
@@ -21,6 +22,7 @@
#define IDC_IDLETIME2 1013
#define IDC_MEMBERSINCE 1013
#define IDC_LASTSEEN 1014
+#define IDC_EMAIL 1015
// Next default values for new objects
//
@@ -28,7 +30,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1013
+#define _APS_NEXT_CONTROL_VALUE 1016
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp
index d39f2bfac9..5c6ec298ae 100644
--- a/protocols/ICQ-WIM/src/server.cpp
+++ b/protocols/ICQ-WIM/src/server.cpp
@@ -80,13 +80,17 @@ void CIcqProto::CheckPassword()
char mirVer[100];
Miranda_GetVersionText(mirVer, _countof(mirVer));
+ CMStringW wszId(m_szEmail);
+ if (wszId.IsEmpty())
+ wszId.Format(L"%d", (DWORD)m_dwUin);
+
m_szAToken = getMStringA(DB_KEY_ATOKEN);
m_iRClientId = getDword(DB_KEY_RCLIENTID);
m_szSessionKey = getMStringA(DB_KEY_SESSIONKEY);
if (m_szAToken.IsEmpty() || m_szSessionKey.IsEmpty()) {
auto *pReq = new AsyncHttpRequest(CONN_MAIN, REQUEST_POST, "https://api.login.icq.net/auth/clientLogin", &CIcqProto::OnCheckPassword);
pReq << CHAR_PARAM("clientName", "Miranda NG") << CHAR_PARAM("clientVersion", mirVer) << CHAR_PARAM("devId", ICQ_APP_ID)
- << CHAR_PARAM("f", "json") << CHAR_PARAM("tokenType", "longTerm") << INT_PARAM("s", m_dwUin) << WCHAR_PARAM("pwd", m_szPassword);
+ << CHAR_PARAM("f", "json") << CHAR_PARAM("tokenType", "longTerm") << WCHAR_PARAM("s", wszId) << WCHAR_PARAM("pwd", m_szPassword);
pReq->flags |= NLHRF_NODUMPSEND;
Push(pReq);
}
@@ -184,7 +188,6 @@ MCONTACT CIcqProto::ParseBuddyInfo(const JSONNode &buddy, MCONTACT hContact)
Json2string(hContact, buddy, "cellNumber", "Cellular");
Json2string(hContact, buddy, "phoneNumber", "Phone");
Json2string(hContact, buddy, "workNumber", "CompanyPhone");
- Json2string(hContact, buddy, "emailId", "e-mail");
// zero here means that a contact is currently online
int lastSeen = buddy["lastseen"].as_int();