summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r--protocols/SkypeWeb/src/skype_oauth.cpp20
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h1
2 files changed, 12 insertions, 9 deletions
diff --git a/protocols/SkypeWeb/src/skype_oauth.cpp b/protocols/SkypeWeb/src/skype_oauth.cpp
index e15578a571..6ad4bdbe23 100644
--- a/protocols/SkypeWeb/src/skype_oauth.cpp
+++ b/protocols/SkypeWeb/src/skype_oauth.cpp
@@ -36,7 +36,7 @@ void CSkypeProto::OnOAuthStart(NETLIBHTTPREQUEST *response, AsyncHttpRequest*)
SetStatus(ID_STATUS_OFFLINE);
return;
}
- std::string PPTF = match[1];
+ PPFT = match[1];
std::map<std::string, std::string> scookies;
for (int i = 0; i < response->headersCount; i++) {
@@ -55,7 +55,7 @@ void CSkypeProto::OnOAuthStart(NETLIBHTTPREQUEST *response, AsyncHttpRequest*)
cookies["MSPRequ"] = scookies["MSPRequ"];
- PushRequest(new OAuthRequest(login, password, mscookies.c_str(), PPTF.c_str()));
+ PushRequest(new OAuthRequest(login, password, mscookies.c_str(), PPFT.c_str()));
}
bool CSkypeProto::CheckOauth(const char *szResponse)
@@ -86,13 +86,15 @@ void CSkypeProto::OnOAuthConfirm(NETLIBHTTPREQUEST *response, AsyncHttpRequest *
std::smatch match;
std::string content = response->pData;
- regex = "<input.+?type=\"hidden\".+?name=\"PPFT\".+?id=\"i0327\".+?value=\"(.+?)\".*?/>";;
- if (!std::regex_search(content, match, regex)) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
+ if (PPFT.empty()) {
+ regex = "<input.+?type=\"hidden\".+?name=\"PPFT\".+?id=\"i0327\".+?value=\"(.+?)\".*?/>";;
+ if (!std::regex_search(content, match, regex)) {
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
+ SetStatus(ID_STATUS_OFFLINE);
+ return;
+ }
+ PPFT = match[1];
}
- std::string PPTF = match[1];
regex = "[&?]opid=(.+?)[&']";
if (!std::regex_search(content, match, regex)) {
@@ -114,7 +116,7 @@ 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()));
+ PushRequest(new OAuthRequest(mscookies.c_str(), PPFT.c_str(), opid.c_str()));
}
void CSkypeProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *response, AsyncHttpRequest*)
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 4e0782f5a4..02a34d42b3 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -166,6 +166,7 @@ public:
private:
bool m_bHistorySynced;
+ std::string PPFT;
std::map<std::string, std::string> cookies;
static std::map<std::wstring, std::wstring> languages;