diff options
author | George Hazan <ghazan@miranda.im> | 2018-12-26 23:17:49 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-12-26 23:17:49 +0300 |
commit | e864eb7ef50a26d693e10aa97f160e5b523b5407 (patch) | |
tree | f434e3dfb67e5e931c55d713855706d52e72fe40 /protocols/Icq10/src/server.cpp | |
parent | a9ffe609a8f6af668eebda668efd8e04a8989ef6 (diff) |
icq10: fix for expired session reestablishing
Diffstat (limited to 'protocols/Icq10/src/server.cpp')
-rw-r--r-- | protocols/Icq10/src/server.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/protocols/Icq10/src/server.cpp b/protocols/Icq10/src/server.cpp index be3e9941dd..93603815bd 100644 --- a/protocols/Icq10/src/server.cpp +++ b/protocols/Icq10/src/server.cpp @@ -22,6 +22,23 @@ #pragma comment(lib, "libeay32.lib") +void CIcqProto::CheckPassword() +{ + char mirVer[100]; + Miranda_GetVersionText(mirVer, _countof(mirVer)); + + m_szAToken = getMStringA("AToken"); + m_szSessionKey = getMStringA("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); + pReq->flags |= NLHRF_NODUMPSEND; + Push(pReq); + } + else StartSession(); +} + void CIcqProto::ConnectionFailed(int iReason) { debugLogA("ConnectionFailed -> reason %d", iReason); @@ -160,7 +177,12 @@ void CIcqProto::OnStartSession(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) break; case 401: - ConnectionFailed(LOGINERR_WRONGPASSWORD); + if (root.detail() == 1002) { // session expired + delSetting("AToken"); + delSetting("SessionKey"); + CheckPassword(); + } + else ConnectionFailed(LOGINERR_WRONGPASSWORD); return; default: |