summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp16
-rw-r--r--protocols/SkypeWeb/src/skype_oauth.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h2
3 files changed, 9 insertions, 11 deletions
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
index a766f6ac34..804160fc6a 100644
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ b/protocols/SkypeWeb/src/skype_login.cpp
@@ -70,7 +70,7 @@ void CSkypeProto::Login()
m_bHistorySynced = false;
if ((tokenExpires - 1800) > time(0))
- OnLoginSuccess();
+ TryCreateEndpoint();
else
PushRequest(new OAuthRequest());
}
@@ -135,20 +135,14 @@ void CSkypeProto::OnLoginOAuth(MHttpResponse *response, AsyncHttpRequest*)
setString("TokenSecret", json["skypetoken"].as_string().c_str());
setDword("TokenExpiresIn", time(NULL) + json["expiresIn"].as_int());
- OnLoginSuccess();
+ TryCreateEndpoint();
}
-void CSkypeProto::OnLoginSuccess()
+void CSkypeProto::TryCreateEndpoint()
{
if (!IsStatusConnecting(m_iStatus))
return;
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_SUCCESS, NULL, 0);
-
- int oldStatus = m_iStatus;
- m_iStatus = m_iDesiredStatus;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
-
m_szApiToken = getStringA("TokenSecret");
m_impl.m_heartBeat.StartSafe(600 * 1000);
@@ -199,6 +193,10 @@ void CSkypeProto::OnEndpointCreated(MHttpResponse *response, AsyncHttpRequest*)
}
// Succeeded, decode the answer
+ int oldStatus = m_iStatus;
+ m_iStatus = m_iDesiredStatus;
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
+
if (auto *hdr = response->FindHeader("Set-RegistrationToken")) {
CMStringA szValue = hdr;
int iStart = 0;
diff --git a/protocols/SkypeWeb/src/skype_oauth.cpp b/protocols/SkypeWeb/src/skype_oauth.cpp
index 1c519ec660..a22d1b0662 100644
--- a/protocols/SkypeWeb/src/skype_oauth.cpp
+++ b/protocols/SkypeWeb/src/skype_oauth.cpp
@@ -144,5 +144,5 @@ void CSkypeProto::OnOAuthEnd(MHttpResponse *response, AsyncHttpRequest*)
setDword("TokenExpiresIn", time(NULL) + seconds);
}
- OnLoginSuccess();
+ TryCreateEndpoint();
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 17d8740256..a7ab5a6df6 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -236,7 +236,7 @@ private:
// login
void Login();
- void OnLoginSuccess();
+ void TryCreateEndpoint();
void SendPresence();
// profile