summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-07-31 09:58:21 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-07-31 09:58:21 +0300
commitdcaca323eab03e590bcd483af597c22c1c769a1a (patch)
treef331dbb3d8ccc0baf4eb5dd93c9d44b26be7751b /protocols/SkypeWeb
parent17a66929350b6e6ef1c72811382b5a49835d7f4d (diff)
useless crutch rolled back
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r--protocols/SkypeWeb/src/requests/oauth.h6
-rw-r--r--protocols/SkypeWeb/src/skype_oauth.cpp35
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h1
3 files changed, 20 insertions, 22 deletions
diff --git a/protocols/SkypeWeb/src/requests/oauth.h b/protocols/SkypeWeb/src/requests/oauth.h
index 6ab7e87c6e..dc579a238f 100644
--- a/protocols/SkypeWeb/src/requests/oauth.h
+++ b/protocols/SkypeWeb/src/requests/oauth.h
@@ -52,14 +52,14 @@ struct OAuthRequest : public AsyncHttpRequest
{
this << CHAR_PARAM("wa", "wsignin1.0") << CHAR_PARAM("wp", "MBI_SSL")
<< CHAR_PARAM("wreply", "https://lw.skype.com/login/oauth/proxy?site_name=lw.skype.com")
- << CHAR_PARAM("cobrandid", "90010")
- << CHAR_PARAM("opid", opid);
+ << CHAR_PARAM("cobrandid", "90010");
m_szUrl.AppendFormat("?%s", m_szParam.c_str());
m_szParam.Empty();
AddHeader("Cookie", cookies);
- this << CHAR_PARAM("type", "28") << CHAR_PARAM("PPFT", ppft);
+ this << CHAR_PARAM("type", "28") << CHAR_PARAM("PPFT", ppft) << CHAR_PARAM("opid", opid) << CHAR_PARAM("site_name", "lw.skype.com&")
+ << INT_PARAM("oauthPartner", 999) << INT_PARAM("client_id", 578134) << CHAR_PARAM("redirect_uri", "https://web.skype.com");
}
OAuthRequest(const char *t) :
diff --git a/protocols/SkypeWeb/src/skype_oauth.cpp b/protocols/SkypeWeb/src/skype_oauth.cpp
index 6ad4bdbe23..a0605346d3 100644
--- a/protocols/SkypeWeb/src/skype_oauth.cpp
+++ b/protocols/SkypeWeb/src/skype_oauth.cpp
@@ -17,6 +17,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
+static std::string sub(const std::string &str, const char *start, const char *end)
+{
+ size_t i1 = str.find(start);
+ if (i1 == -1)
+ return "";
+
+ i1 += strlen(start);
+ size_t i2 = str.find(end, i1);
+ return (i2 == -1) ? "" : str.substr(i1, i2 - i1);
+}
+
void CSkypeProto::OnOAuthStart(NETLIBHTTPREQUEST *response, AsyncHttpRequest*)
{
if (response == nullptr || response->pData == nullptr) {
@@ -36,7 +47,7 @@ void CSkypeProto::OnOAuthStart(NETLIBHTTPREQUEST *response, AsyncHttpRequest*)
SetStatus(ID_STATUS_OFFLINE);
return;
}
- PPFT = match[1];
+ std::string PPFT = match[1];
std::map<std::string, std::string> scookies;
for (int i = 0; i < response->headersCount; i++) {
@@ -82,35 +93,23 @@ void CSkypeProto::OnOAuthConfirm(NETLIBHTTPREQUEST *response, AsyncHttpRequest *
if (CheckOauth(response->pData))
return;
- std::regex regex;
- std::smatch match;
std::string content = response->pData;
-
- 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];
- }
-
- regex = "[&?]opid=(.+?)[&']";
- if (!std::regex_search(content, match, regex)) {
+ std::string PPFT = sub(content, "sFT:'", "'");
+ std::string opid = sub(content, "opid=", "&");
+ if (PPFT.empty() || opid.empty()) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
}
- std::string opid = match[1];
+ std::regex regex("^(.+?)=(.+?);");
+ std::smatch match;
std::map<std::string, std::string> scookies;
for (int i = 0; i < response->headersCount; i++) {
if (mir_strcmpi(response->headers[i].szName, "Set-Cookie"))
continue;
content = response->headers[i].szValue;
- regex = "^(.+?)=(.+?);";
if (std::regex_search(content, match, regex))
scookies[match[1]] = match[2];
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 02a34d42b3..4e0782f5a4 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -166,7 +166,6 @@ public:
private:
bool m_bHistorySynced;
- std::string PPFT;
std::map<std::string, std::string> cookies;
static std::map<std::wstring, std::wstring> languages;