summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_oauth.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-05-29 23:45:19 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-05-29 23:45:19 +0300
commitf63eb2bfc28dff8bbf9d56dd57b2bc6b53487f56 (patch)
treef2c2a56e945fc1ea44d5f22f95cd397a0d251fa2 /protocols/SkypeWeb/src/skype_oauth.cpp
parent133826f5022c5b0d9beca9285d66afcb604e2fc4 (diff)
Skype:
- fixes #829; - massive code cleaning
Diffstat (limited to 'protocols/SkypeWeb/src/skype_oauth.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_oauth.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/protocols/SkypeWeb/src/skype_oauth.cpp b/protocols/SkypeWeb/src/skype_oauth.cpp
index f09a5674bb..17d6455a82 100644
--- a/protocols/SkypeWeb/src/skype_oauth.cpp
+++ b/protocols/SkypeWeb/src/skype_oauth.cpp
@@ -19,8 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void CSkypeProto::OnOAuthStart(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL)
- {
+ if (response == NULL || response->pData == NULL) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -33,16 +32,14 @@ void CSkypeProto::OnOAuthStart(const NETLIBHTTPREQUEST *response)
regex = "<input type=\"hidden\" name=\"PPFT\" id=\"i0327\" value=\"(.+?)\"/>";
- if (!std::regex_search(content, match, 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 PPTF = match[1];
-
- for (int i = 0; i < response->headersCount; i++)
- {
+
+ for (int i = 0; i < response->headersCount; i++) {
if (mir_strcmpi(response->headers[i].szName, "Set-Cookie"))
continue;
@@ -61,8 +58,7 @@ void CSkypeProto::OnOAuthStart(const NETLIBHTTPREQUEST *response)
void CSkypeProto::OnOAuthAuthorize(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL)
- {
+ if (response == NULL || response->pData == NULL) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -73,8 +69,7 @@ void CSkypeProto::OnOAuthAuthorize(const NETLIBHTTPREQUEST *response)
std::string content = response->pData;
regex = "<input type=\"hidden\" name=\"t\" id=\"t\" value=\"(.+?)\">";
- if (!std::regex_search(content, match, regex))
- {
+ if (!std::regex_search(content, match, regex)) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -86,8 +81,7 @@ void CSkypeProto::OnOAuthAuthorize(const NETLIBHTTPREQUEST *response)
void CSkypeProto::OnOAuthEnd(const NETLIBHTTPREQUEST *response)
{
- if (response == NULL || response->pData == NULL)
- {
+ if (response == NULL || response->pData == NULL) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
SetStatus(ID_STATUS_OFFLINE);
return;
@@ -97,23 +91,21 @@ void CSkypeProto::OnOAuthEnd(const NETLIBHTTPREQUEST *response)
std::smatch match;
std::string content = response->pData;
- regex = "<input type=\"hidden\" name=\"skypetoken\" value=\"(.+?)\"/>";
- if (!std::regex_search(content, match, regex))
- {
+ regex = "<input type=\"hidden\" name=\"skypetoken\" 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 token = match[1];
- setString("TokenSecret", token.c_str());
- regex = "<input type=\"hidden\" name=\"expires_in\" value=\"(.+?)\"/>";
+ setString("TokenSecret", token.c_str());
+ regex = "<input type=\"hidden\" name=\"expires_in\" value=\"(.+?)\"/>";
- if (std::regex_search(content, match, regex))
- {
+ if (std::regex_search(content, match, regex)) {
std::string expiresIn = match[1];
int seconds = atoi(expiresIn.c_str());
setDword("TokenExpiresIn", time(NULL) + seconds);
}
OnLoginSuccess();
-} \ No newline at end of file
+}