summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-04-18 14:31:06 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-04-18 14:31:06 +0000
commit0d9ca51da67752273947ae853b1cfc923e407627 (patch)
tree437ec80361a3682c5f54b4465d865b2300164f46
parent54f4449e9183407bd8cd09fdcb81f4e3d55ac3e5 (diff)
SkypeWeb: Chats history loading fix.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12912 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/SkypeWeb/src/skype_history_sync.cpp4
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp12
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<char> 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();