diff options
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 18 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_polling.cpp | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 11 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 1 |
4 files changed, 20 insertions, 11 deletions
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 2df0ff7ceb..dc86c654dc 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -84,13 +84,13 @@ void CSkypeProto::OnLoginSecond(const NETLIBHTTPREQUEST *response) std::string token = match[1];
setString("TokenSecret", token.c_str());
- /*regex = "<input type=\"hidden\" name=\"expires_in\" value=\"(.+?)\"/>";
+ regex = "<input type=\"hidden\" name=\"expires_in\" value=\"(.+?)\"/>";
if (std::regex_search(content, match, regex))
{
std::string expiresIn = match[1];
int seconds = atoi(expiresIn.c_str());
setDword("TokenExpiresIn", time(NULL) + seconds);
- }*/
+ }
for (int i = 0; i < response->headersCount; i++)
{
@@ -102,13 +102,15 @@ void CSkypeProto::OnLoginSecond(const NETLIBHTTPREQUEST *response) if (std::regex_search(content, match, regex))
cookies[match[1]] = match[2];
}
+ OnLoginSuccess();
+}
- PushRequest(new CreateEndpointRequest(token.c_str()), &CSkypeProto::OnEndpointCreated);
-
- PushRequest(new GetProfileRequest(token.c_str()), &CSkypeProto::LoadProfile);
- ptrA szUrl(getStringA("AvatarUrl"));
- PushRequest(new GetAvatarRequest(szUrl), &CSkypeProto::OnReceiveAvatar, NULL);
- PushRequest(new GetContactListRequest(token.c_str()), &CSkypeProto::LoadContactList);
+void CSkypeProto::OnLoginSuccess()
+{
+ PushRequest(new CreateEndpointRequest(ptrA(getStringA("TokenSecret"))), &CSkypeProto::OnEndpointCreated);
+ PushRequest(new GetProfileRequest(ptrA(getStringA("TokenSecret"))), &CSkypeProto::LoadProfile);
+ PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL);
+ PushRequest(new GetContactListRequest(ptrA(getStringA("TokenSecret"))), &CSkypeProto::LoadContactList);
}
void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response)
diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index be69a83bdd..921b2178e2 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -74,6 +74,7 @@ void CSkypeProto::PollingThread(void*) if (response == NULL)
{
errors++;
+ delete request;
continue;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 1f363811ca..2016277832 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -172,7 +172,7 @@ int CSkypeProto::SetStatus(int iNewStatus) if (m_pollingConnection)
CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0);
- if (m_iStatus > ID_STATUS_CONNECTING + 1)
+ /*if (m_iStatus > ID_STATUS_CONNECTING + 1)
{
LogoutRequest *logoutRequest = new LogoutRequest();
if (!cookies.empty())
@@ -183,7 +183,7 @@ int CSkypeProto::SetStatus(int iNewStatus) logoutRequest->Headers << CHAR_VALUE("Cookie", allCookies);
}
PushRequest(logoutRequest);
- }
+ }*/
requestQueue->Stop();
if (!Miranda_Terminated())
@@ -201,7 +201,12 @@ int CSkypeProto::SetStatus(int iNewStatus) // login
m_iStatus = ID_STATUS_CONNECTING;
requestQueue->Start();
- PushRequest(new LoginRequest(), &CSkypeProto::OnLoginFirst);
+ int tokenExpires(getDword("TokenExpiresIn", 0));
+ debugLogA("%lli %lli", tokenExpires, time(NULL));
+ if ((tokenExpires - 1800) > time(NULL))
+ OnLoginSuccess();
+ else
+ PushRequest(new LoginRequest(), &CSkypeProto::OnLoginFirst);
}
else
{
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index f837fc36b5..e4664d453c 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -131,6 +131,7 @@ private: // login
void OnLoginFirst(const NETLIBHTTPREQUEST *response);
void OnLoginSecond(const NETLIBHTTPREQUEST *response);
+ void OnLoginSuccess();
void OnEndpointCreated(const NETLIBHTTPREQUEST *response);
void OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response);
void OnStatusChanged(const NETLIBHTTPREQUEST *response);
|