summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-09-17 14:02:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-09-17 14:02:04 +0300
commitf513c977a39875aa8a180c2d70567957567f1724 (patch)
tree2c72a521ae41eb0d27e42e2ce4ad128ba4494809 /protocols/SkypeWeb
parentbc463864736e6eb2436fb83e922a46ff5ba9dbf5 (diff)
SkypeWeb: fix for login process
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r--protocols/SkypeWeb/src/skype_oauth.cpp34
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h1
-rw-r--r--protocols/SkypeWeb/src/version.h2
3 files changed, 23 insertions, 14 deletions
diff --git a/protocols/SkypeWeb/src/skype_oauth.cpp b/protocols/SkypeWeb/src/skype_oauth.cpp
index 1e6737b5cf..5dd8169c1d 100644
--- a/protocols/SkypeWeb/src/skype_oauth.cpp
+++ b/protocols/SkypeWeb/src/skype_oauth.cpp
@@ -58,13 +58,30 @@ void CSkypeProto::OnOAuthStart(NETLIBHTTPREQUEST *response, AsyncHttpRequest*)
PushRequest(new OAuthRequest(login, password, mscookies.c_str(), PPTF.c_str()));
}
-void CSkypeProto::OnOAuthConfirm(NETLIBHTTPREQUEST* response, AsyncHttpRequest*) {
+bool CSkypeProto::CheckOauth(const char *szResponse)
+{
+ std::string content = szResponse;
+ std::smatch match;
+ if (!std::regex_search(content, match, std::regex("<input.+?type=\"hidden\".+?name=\"t\".+?id=\"t\".+?value=\"(.+?)\".*?>")))
+ if (!std::regex_search(content, match, std::regex("<input.+?type=\"hidden\".+?name=\"ipt\".+?id=\"ipt\".+?value=\"(.+?)\".*?>")))
+ return false;
+
+ std::string t = match[1];
+ PushRequest(new OAuthRequest(t.c_str()));
+ return true;
+}
+
+void CSkypeProto::OnOAuthConfirm(NETLIBHTTPREQUEST *response, AsyncHttpRequest *)
+{
if (response == nullptr || response->pData == nullptr) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
}
+ if (CheckOauth(response->pData))
+ return;
+
std::regex regex;
std::smatch match;
std::string content = response->pData;
@@ -99,7 +116,6 @@ void CSkypeProto::OnOAuthConfirm(NETLIBHTTPREQUEST* response, AsyncHttpRequest*)
}
CMStringA mscookies(FORMAT, "MSPRequ=%s;MSPOK=%s;PPAuth=%s;OParams=%s;", cookies["MSPRequ"].c_str(), scookies["MSPOK"].c_str(), scookies["PPAuth"].c_str(), scookies["OParams"].c_str());
-
PushRequest(new OAuthRequest(mscookies.c_str(), PPTF.c_str(), opid.c_str()));
}
@@ -111,18 +127,10 @@ void CSkypeProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *response, AsyncHttpRequest
return;
}
- std::string content = response->pData;
- std::smatch match;
- if (!std::regex_search(content, match, std::regex("<input.+?type=\"hidden\".+?name=\"t\".+?id=\"t\".+?value=\"(.+?)\".*?>"))) {
- if (!std::regex_search(content, match, std::regex("<input.+?type=\"hidden\".+?name=\"ipt\".+?id=\"ipt\".+?value=\"(.+?)\".*?>"))) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
+ if (!CheckOauth(response->pData)) {
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
+ SetStatus(ID_STATUS_OFFLINE);
}
- std::string t = match[1];
-
- PushRequest(new OAuthRequest(t.c_str()));
}
void CSkypeProto::OnOAuthEnd(NETLIBHTTPREQUEST *response, AsyncHttpRequest*)
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index d16b8f55d3..bb1f42fd2f 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -144,6 +144,7 @@ public:
void OnGetChatInfo(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest);
void OnReceiveAwayMsg(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest);
+ bool CheckOauth(const char *szResponse);
void LoadProfile(NETLIBHTTPREQUEST *response, AsyncHttpRequest *pRequest);
private:
diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h
index 18bb6ad8b9..bd5f11f803 100644
--- a/protocols/SkypeWeb/src/version.h
+++ b/protocols/SkypeWeb/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 95
#define __RELEASE_NUM 12
-#define __BUILD_NUM 1
+#define __BUILD_NUM 2
#include <stdver.h>