From 85596094fcbd80e105f13b317c50305f94500251 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sun, 7 Jun 2015 08:55:07 +0000 Subject: SkypeWeb: Attempt support M$ account login. git-svn-id: http://svn.miranda-ng.org/main/trunk@14038 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/SkypeWeb.vcxproj | 1 + protocols/SkypeWeb/SkypeWeb.vcxproj.filters | 3 +++ protocols/SkypeWeb/src/skype_login.cpp | 19 +++++++++++++++++++ protocols/SkypeWeb/src/skype_proto.cpp | 10 +--------- protocols/SkypeWeb/src/skype_proto.h | 4 ++++ protocols/SkypeWeb/src/skype_utils.cpp | 6 +----- protocols/SkypeWeb/src/stdafx.h | 1 + 7 files changed, 30 insertions(+), 14 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj b/protocols/SkypeWeb/SkypeWeb.vcxproj index 25cf16511d..ebb88292b7 100644 --- a/protocols/SkypeWeb/SkypeWeb.vcxproj +++ b/protocols/SkypeWeb/SkypeWeb.vcxproj @@ -46,5 +46,6 @@ + \ No newline at end of file diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters index 0b41c204e3..3c54e2e212 100644 --- a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters +++ b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters @@ -52,6 +52,9 @@ Header Files\requests + + + Header Files\requests \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 453ae85d0f..9196ef4f77 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -19,6 +19,25 @@ along with this program. If not, see . UINT_PTR CSkypeProto::m_timer; +void CSkypeProto::Login() +{ + // login + m_iStatus = ID_STATUS_CONNECTING; + requestQueue->Start(); + int tokenExpires(getDword("TokenExpiresIn", 0)); + ptrA login(getStringA(SKYPE_SETTINGS_ID)); + HistorySynced = false; + if ((tokenExpires - 1800) > time(NULL)) + OnLoginSuccess(); + else + { + if (strstr(login, "@")) + SendRequest(new LoginMSRequest(), &CSkypeProto::OnMSLoginFirst); + else + SendRequest(new LoginOAuthRequest(login, ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth); + } +} + void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) { if (response == NULL || response->pData == NULL) diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 6d56dd99c7..c62a8e6db1 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -247,15 +247,7 @@ int CSkypeProto::SetStatus(int iNewStatus) if (old_status == ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_OFFLINE) { - // login - m_iStatus = ID_STATUS_CONNECTING; - requestQueue->Start(); - int tokenExpires(getDword("TokenExpiresIn", 0)); - HistorySynced = false; - if ((tokenExpires - 1800) > time(NULL)) - OnLoginSuccess(); - else - SendRequest(new LoginOAuthRequest(ptrA(getStringA(SKYPE_SETTINGS_ID)), ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth); + Login(); } else { diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 1c60444312..df55850287 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -165,6 +165,10 @@ private: int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam); // login + void Login(); + void OnMSLoginFirst(const NETLIBHTTPREQUEST *response); + void OnMSLoginSecond(const NETLIBHTTPREQUEST *response); + void OnMSLoginEnd(const NETLIBHTTPREQUEST *response); void OnLoginOAuth(const NETLIBHTTPREQUEST *response); void OnLoginSuccess(); void OnEndpointCreated(const NETLIBHTTPREQUEST *response); diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 4b3a2471da..bfc4cc3bdd 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -419,11 +419,7 @@ char *CSkypeProto::RemoveHtml(const char *text) bool CSkypeProto::IsMe(const char *skypeName) { - ptrA mySkypeName(getStringA(SKYPE_SETTINGS_ID)); - ptrA SelfEndpointName(getStringA("SelfEndpointName")); - if (!mir_strcmpi(skypeName, mySkypeName) || !mir_strcmp(skypeName, SelfEndpointName)) - return true; - return false; + return (!mir_strcmpi(skypeName, m_szSelfSkypeName) || !mir_strcmp(skypeName, ptrA(getStringA("SelfEndpointName")))); } char *CSkypeProto::MirandaToSkypeStatus(int status) diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index b627274e40..44f9f00b39 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -87,6 +87,7 @@ extern LIST Accounts; #include "requests\search.h" #include "requests\chatrooms.h" #include "requests\trouter.h" +#include "requests\mslogin.h" #include "request_queue.h" #include "skype_proto.h" -- cgit v1.2.3