From 1dd4c9316543ff292ce250f7f08b25385fc8e37a Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sun, 7 Jun 2015 11:57:31 +0000 Subject: SkypeWeb: MS login fix. git-svn-id: http://svn.miranda-ng.org/main/trunk@14047 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/requests/mslogin.h | 19 ++++++++++++++++++- protocols/SkypeWeb/src/skype_mslogin.cpp | 26 ++++++++++++++++++++++++++ protocols/SkypeWeb/src/skype_proto.h | 1 + 3 files changed, 45 insertions(+), 1 deletion(-) (limited to 'protocols/SkypeWeb') 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 = ""; + + 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(); -- cgit v1.2.3