summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-06-07 11:57:31 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-06-07 11:57:31 +0000
commit1dd4c9316543ff292ce250f7f08b25385fc8e37a (patch)
tree346ec117a056d7a5140e3447a87fac656f4ae0ad /protocols
parentc0f9a5967f49773d7a3784252ea6912929f469ae (diff)
SkypeWeb: MS login fix.
git-svn-id: http://svn.miranda-ng.org/main/trunk@14047 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/requests/mslogin.h19
-rw-r--r--protocols/SkypeWeb/src/skype_mslogin.cpp26
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h1
3 files changed, 45 insertions, 1 deletions
diff --git a/protocols/SkypeWeb/src/requests/mslogin.h b/protocols/SkypeWeb/src/requests/mslogin.h
index abbecdd900..b71160ed39 100644
--- a/protocols/SkypeWeb/src/requests/mslogin.h
+++ b/protocols/SkypeWeb/src/requests/mslogin.h
@@ -59,11 +59,28 @@ public:
Body
<< CHAR_VALUE ("t", ptrA(mir_urlEncode(t)))
<< INT_VALUE ("oauthPartner", 999)
+ << INT_VALUE ("client_id", 578134)
+ << CHAR_VALUE ("redirect_uri", ptrA(mir_urlEncode("https://web.skype.com")));
+ }
+
+ LoginMSRequest(const char *t, int) :
+ HttpRequest(REQUEST_POST, "secure.skype.com/login/oauth/proxy")
+ {
+ Url
<< INT_VALUE ("client_id", 578134)
<< CHAR_VALUE ("redirect_uri", ptrA(mir_urlEncode("https://web.skype.com")));
+
+ Headers
+ << CHAR_VALUE ("Content-Type", "application/x-www-form-urlencoded");
+
+ Body
+ << CHAR_VALUE ("t", ptrA(mir_urlEncode(t)))
+ << INT_VALUE ("oauthPartner", 999)
+ << INT_VALUE ("client_id", 578134)
+ << CHAR_VALUE ("redirect_uri", ptrA(mir_urlEncode("https://web.skype.com")));
}
- LoginMSRequest(const char *url,const char *login, const char *cookies_str, const char *ppft, const char *code) :
+ LoginMSRequest(const char *url, const char *login, const char *cookies_str, const char *ppft, const char *code) :
HttpRequest(REQUEST_POST, url)
{
Headers
diff --git a/protocols/SkypeWeb/src/skype_mslogin.cpp b/protocols/SkypeWeb/src/skype_mslogin.cpp
index 0ead57b1fd..637876f1e9 100644
--- a/protocols/SkypeWeb/src/skype_mslogin.cpp
+++ b/protocols/SkypeWeb/src/skype_mslogin.cpp
@@ -111,6 +111,32 @@ void CSkypeProto::OnMSLoginSecond(const NETLIBHTTPREQUEST *response)
}
std::string t = match[1];
+ SendRequest(new LoginMSRequest(t.c_str(), 0), &CSkypeProto::OnMSLoginThird);
+}
+
+void CSkypeProto::OnMSLoginThird(const NETLIBHTTPREQUEST *response)
+{
+ if (response == NULL || response->pData == NULL)
+ {
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
+ SetStatus(ID_STATUS_OFFLINE);
+ return;
+ }
+
+ std::regex regex;
+ std::smatch match;
+ std::string content = response->pData;
+
+ regex = "<input type=\"hidden\" name=\"t\" value=\"(.+?)\">";
+
+ if (!std::regex_search(content, match, regex))
+ {
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
+ SetStatus(ID_STATUS_OFFLINE);
+ return;
+ }
+ std::string t = match[1];
+
SendRequest(new LoginMSRequest(t.c_str()), &CSkypeProto::OnMSLoginEnd);
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index b5c32361f8..d65fd6d1e6 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -168,6 +168,7 @@ private:
void Login();
void OnMSLoginFirst(const NETLIBHTTPREQUEST *response);
void OnMSLoginSecond(const NETLIBHTTPREQUEST *response);
+ void OnMSLoginThird(const NETLIBHTTPREQUEST *response);
void OnMSLoginEnd(const NETLIBHTTPREQUEST *response);
void OnLoginOAuth(const NETLIBHTTPREQUEST *response);
void OnLoginSuccess();