summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_login.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2016-04-13 16:12:52 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2016-04-13 16:12:52 +0000
commit122306cee52b2da3694e3e04ad139fe92def1693 (patch)
treec5768c1aed3a65f3a74d0db80ffd7e05f5676e11 /protocols/SkypeWeb/src/skype_login.cpp
parentfdc5bdfae8a4a70cfd91ec0a8554005a3c0bbae2 (diff)
SkypeWeb: code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@16643 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_login.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
index 3bf80c0e37..5ffe9c610c 100644
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ b/protocols/SkypeWeb/src/skype_login.cpp
@@ -113,11 +113,9 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response)
SetStatus(ID_STATUS_OFFLINE);
return;
}
- std::string token = json["skypetoken"].as_string();
- setString("TokenSecret", token.c_str());
- int expiresIn = json["expiresIn"].as_int();
- setDword("TokenExpiresIn", time(NULL) + expiresIn);
+ setString("TokenSecret", json["skypetoken"].as_string().c_str());
+ setDword("TokenExpiresIn", time(NULL) + json["expiresIn"].as_int());
OnLoginSuccess();
}
@@ -164,6 +162,12 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response)
szCookieName = szToken.Tokenize("=", iStart2);
szCookieVal = szToken.Mid(iStart2);
setString(szCookieName, szCookieVal);
+
+ if (szCookieName == "registrationToken")
+ li.endpoint.szToken = szCookieVal.Detach();
+ else if (szCookieName == "endpointId")
+ li.endpoint.szId = szCookieVal.Detach();
+
}
}
else if (!mir_strcmpi(response->headers[i].szName, "Location"))
@@ -205,8 +209,6 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response)
}
}
- li.endpoint.szToken = getStringA("registrationToken");
- li.endpoint.szId = getStringA("endpointId");
SendRequest(new CreateSubscriptionsRequest(li), &CSkypeProto::OnSubscriptionsCreated);
}
@@ -230,9 +232,8 @@ void CSkypeProto::SendPresence(bool isLogin)
{
ptrA epname;
- ptrT place(getTStringA("Place"));
- if (!getBool("UseHostName", false) && place && *place)
- epname = mir_utf8encodeT(place);
+ if (!m_opts.bUseHostnameAsPlace && m_opts.wstrPlace && *m_opts.wstrPlace)
+ epname = mir_utf8encodeT(m_opts.wstrPlace);
else
{
TCHAR compName[MAX_COMPUTERNAME_LENGTH + 1];
@@ -277,7 +278,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response)
PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList);
PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL);
- if (getBool("AutoSync", true))
+ if (m_opts.bAutoHistorySync)
PushRequest(new SyncHistoryFirstRequest(100, li), &CSkypeProto::OnSyncHistory);
JSONNode root = JSONNode::parse(response->pData);