From 16bc842255921eefcc0d1e6319230dc544c0cfa2 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 18 Apr 2015 17:05:35 +0000 Subject: SkypeWeb: Login fix. git-svn-id: http://svn.miranda-ng.org/main/trunk@12915 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_login.cpp | 18 +++++++++++++++--- protocols/SkypeWeb/src/skype_proto.h | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index d5f5ad9a7b..10a9899ad7 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -184,9 +184,12 @@ void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response) return; } - ptrA skypename(getStringA(SKYPE_SETTINGS_ID)); - PushRequest(new SendCapabilitiesRequest(RegToken, EndpointId, Server)); - PushRequest(new SetStatusRequest(RegToken, MirandaToSkypeStatus(m_iDesiredStatus), Server), &CSkypeProto::OnStatusChanged); + PushRequest(new SendCapabilitiesRequest(RegToken, EndpointId, Server), &CSkypeProto::OnCapabilitiesSended); +} + +void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) +{ + SendRequest(new SetStatusRequest(RegToken, MirandaToSkypeStatus(m_iDesiredStatus), Server), &CSkypeProto::OnStatusChanged); LIST skypenames(1); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) @@ -202,6 +205,15 @@ void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response) if (getByte("AutoSync", 1)) SyncHistory(); + + if (response == NULL || response->pData == NULL) + return; + JSONROOT root(response->pData); + if (root == NULL) + return; + + ptrA SelfEndpointName(SelfUrlToName(mir_t2a(ptrT(json_as_string(json_get(root, "SelfLink")))))); + setString("SelfEndpointName", SelfEndpointName); } void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response) diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 7fd4f368c8..0520bbd594 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -140,6 +140,7 @@ private: void OnLoginSuccess(); void OnEndpointCreated(const NETLIBHTTPREQUEST *response); void OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response); + void OnCapabilitiesSended(const NETLIBHTTPREQUEST *response); void OnStatusChanged(const NETLIBHTTPREQUEST *response); // profile -- cgit v1.2.3