From 0d9ca51da67752273947ae853b1cfc923e407627 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Sat, 18 Apr 2015 14:31:06 +0000 Subject: SkypeWeb: Chats history loading fix. git-svn-id: http://svn.miranda-ng.org/main/trunk@12912 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_history_sync.cpp | 4 ++-- protocols/SkypeWeb/src/skype_login.cpp | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 7c4bf07034..228b1be561 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -93,7 +93,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) { if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")) { - ptrA chatname(ContactUrlToName(conversationLink)); + ptrA chatname(ChatUrlToName(conversationLink)); GCDEST gcd = { m_szModuleName, ptrT(mir_a2t(chatname)), GC_EVENT_MESSAGE }; GCEVENT gce = { sizeof(GCEVENT), &gcd }; gce.bIsMe = IsMe(ContactUrlToName(from)); @@ -140,7 +140,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) { JSONNODE *conversation = json_at(conversations, i); JSONNODE *lastMessage = json_get(conversation, "lastMessage"); - if (lastMessage == NULL) + if (json_empty(lastMessage)) continue; char *clientMsgId = mir_t2a(json_as_string(json_get(lastMessage, "clientmessageid"))); diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index e7df084f9c..dbd2108aff 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -108,6 +108,7 @@ void CSkypeProto::OnLoginSecond(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnLoginSuccess() { TokenSecret = getStringA("TokenSecret"); + Server = getStringA("registrationToken"); SendRequest(new CreateEndpointRequest(TokenSecret), &CSkypeProto::OnEndpointCreated); PushRequest(new GetProfileRequest(TokenSecret), &CSkypeProto::LoadProfile); PushRequest(new GetAvatarRequest(TokenSecret), &CSkypeProto::OnReceiveAvatar, NULL); @@ -162,7 +163,7 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) if (response->resultCode != 201) { - PushRequest(new CreateEndpointRequest(TokenSecret, Server), &CSkypeProto::OnEndpointCreated); + SendRequest(new CreateEndpointRequest(TokenSecret, Server), &CSkypeProto::OnEndpointCreated); return; } @@ -184,13 +185,16 @@ void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response) } ptrA skypename(getStringA(SKYPE_SETTINGS_ID)); - PushRequest(new SendCapabilitiesRequest(RegToken, EndpointId, Server)); + SendRequest(new SendCapabilitiesRequest(RegToken, EndpointId, Server)); 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)) - skypenames.insert(getStringA(hContact, SKYPE_SETTINGS_ID)); - PushRequest(new CreateContactsRequest(RegToken, skypenames, Server)); + { + if (db_get_b(hContact, m_szModuleName, "ChatRoom", 0) == 0) + skypenames.insert(getStringA(hContact, SKYPE_SETTINGS_ID)); + } + SendRequest(new CreateContactsRequest(RegToken, skypenames, Server)); for (int i = 0; i < skypenames.getCount(); i++) mir_free(skypenames[i]); skypenames.destroy(); -- cgit v1.2.3