From 525151934b436f8d2a6a9609ffbbb403b4683f33 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Thu, 6 Aug 2015 06:53:50 +0000 Subject: SkypeWeb: Login optimization git-svn-id: http://svn.miranda-ng.org/main/trunk@14849 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/requests/login.h | 8 ++++---- protocols/SkypeWeb/src/skype_login.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/src/requests/login.h b/protocols/SkypeWeb/src/requests/login.h index 013292b3b1..5fc03c3436 100644 --- a/protocols/SkypeWeb/src/requests/login.h +++ b/protocols/SkypeWeb/src/requests/login.h @@ -26,19 +26,19 @@ public: { CMStringA user(username); user.MakeLower(); - CMStringA str(::FORMAT, "%s\nskyper\n%s", user, password); + pass_ptrA str(CMStringA(::FORMAT, "%s\nskyper\n%s", user, password).Detach()); BYTE digest[16]; - mir_md5_hash((BYTE*)str.GetString(), str.GetLength(), digest); + mir_md5_hash((BYTE*)((char*)str), mir_strlen(str), digest); - ptrA hash(mir_base64_encode(digest, sizeof(digest))); + pass_ptrA hash(mir_base64_encode(digest, sizeof(digest))); Body << CHAR_VALUE("scopes", "client") << CHAR_VALUE("clientVersion", ptrA(mir_urlEncode("0/7.4.85.102/259/"))) << CHAR_VALUE("username", ptrA(mir_urlEncode(user))) - << CHAR_VALUE("passwordHash", ptrA(mir_urlEncode(hash))); + << CHAR_VALUE("passwordHash", pass_ptrA(mir_urlEncode(hash))); } }; diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index 2132d7a7ad..acfc4d53b2 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -127,7 +127,6 @@ void CSkypeProto::OnLoginSuccess() if (m_szServer == NULL) m_szServer = mir_strdup(SKYPE_ENDPOINTS_HOST); SendRequest(new CreateEndpointRequest(m_szTokenSecret, m_szServer), &CSkypeProto::OnEndpointCreated); - PushRequest(new GetProfileRequest(m_szTokenSecret), &CSkypeProto::LoadProfile); } void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) @@ -194,7 +193,6 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) m_szRegToken = getStringA("registrationToken"); m_szEndpointId = getStringA("endpointId"); SendRequest(new CreateSubscriptionsRequest(m_szRegToken, m_szServer), &CSkypeProto::OnSubscriptionsCreated); - SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter); } void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response) @@ -251,22 +249,24 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) skypenames.insert(getStringA(hContact, SKYPE_SETTINGS_ID)); } SendRequest(new CreateContactsSubscriptionRequest(m_szRegToken, skypenames, m_szServer)); - FreeCharList(skypenames); skypenames.destroy(); m_hPollingThread = ForkThreadEx(&CSkypeProto::PollingThread, 0, NULL); - PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL); - PushRequest(new GetContactListRequest(m_szTokenSecret, m_szSelfSkypeName, NULL), &CSkypeProto::LoadContactList); - SendRequest(new LoadChatsRequest(m_szRegToken, m_szServer), &CSkypeProto::OnLoadChats); + SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter); + PushRequest(new GetContactListRequest(m_szTokenSecret, m_szSelfSkypeName, NULL), &CSkypeProto::LoadContactList); + PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL); + if (getBool("AutoSync", true)) PushRequest(new SyncHistoryFirstRequest(m_szRegToken, 100, m_szServer), &CSkypeProto::OnSyncHistory); JSONNode root = JSONNode::parse(response->pData); if (root) setString("SelfEndpointName", UrlToSkypename(root["selfLink"].as_string().c_str())); + + PushRequest(new GetProfileRequest(m_szTokenSecret), &CSkypeProto::LoadProfile); } void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response) -- cgit v1.2.3