diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-25 17:49:36 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-25 17:49:36 +0000 |
commit | 019b48b38636ea582501e4a86193cf54d2df0193 (patch) | |
tree | 01493ea7cc1f013b6f84a334e3e58b610158f483 | |
parent | 763ff998a4b78f958fdc73440682ccbaf7a66fe4 (diff) |
SkypeWeb: Leaved chats are not added to contact list.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13143 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 16 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_history_sync.cpp | 12 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 5 |
4 files changed, 21 insertions, 13 deletions
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 45902473da..d4fa10d41c 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -185,7 +185,7 @@ void CSkypeProto::StartChatRoom(const TCHAR *tid, const TCHAR *tname) CallServiceSync(MS_GC_EVENT, (hideChats ? WINDOW_HIDDEN : SESSION_INITDONE), reinterpret_cast<LPARAM>(&gce));
CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, reinterpret_cast<LPARAM>(&gce));
- SendRequest(new GetChatInfoRequest(RegToken, ptrA(mir_t2a(tid)), Server), &CSkypeProto::OnGetChatInfo);
+ //SendRequest(new GetChatInfoRequest(RegToken, ptrA(mir_t2a(tid)), Server), &CSkypeProto::OnGetChatInfo);
}
int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam)
@@ -416,17 +416,21 @@ void CSkypeProto::OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessa SendRequest(new SendChatMessageRequest(RegToken, szChatId, time(NULL), szMessage, Server));
}
-void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response)
+void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p)
{
+ TCHAR *topic = (TCHAR*)p;
if (response == NULL || response->pData == NULL)
return;
JSONROOT root(response->pData);
JSONNODE *members = json_get(root, "members");
JSONNODE *properties = json_get(root, "properties");
- ptrA topic(mir_t2a(json_as_string(json_get(properties, "topic"))));
- ptrA chatId(ChatUrlToName(ptrA(mir_t2a(ptrT(json_as_string(json_get(root, "messages")))))));
- //RenameChat(chatId, topic);
+
+ if (json_empty(json_get(properties, "capabilities")))
+ return;
+
+ ptrA chatId(ChatUrlToName(mir_t2a(ptrT(json_as_string(json_get(root, "messages"))))));
+ StartChatRoom(_A2T(chatId), mir_tstrdup(topic));
for (size_t i = 0; i < json_size(members); i++)
{
JSONNODE *member = json_at(members, i);
@@ -436,6 +440,8 @@ void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response) if (!IsChatContact(_A2T(chatId), username))
AddChatContact(_A2T(chatId), username, username, role, true);
}
+ PushRequest(new GetHistoryRequest(RegToken, chatId, 15, true, 0, Server), &CSkypeProto::OnGetServerHistory);
+ mir_free(topic);
}
void CSkypeProto::RenameChat(const char *chat_id, const char *name)
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index ff1b3c11d6..d0a119d5da 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -208,7 +208,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) bool isChat = false;
ptrA skypename;
- ptrT topic;
+ TCHAR *topic;
if (conversationLink != NULL && strstr(conversationLink, "/8:"))
{
@@ -217,16 +217,16 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) else if (conversationLink != NULL && strstr(conversationLink, "/19:"))
{
skypename = ChatUrlToName(conversationLink);
- isChat = true;
topic = json_as_string(json_get(threadProperties, "topic"));
- StartChatRoom(_A2T(skypename), topic);
+ SendRequest(new GetChatInfoRequest(RegToken, skypename, Server), &CSkypeProto::OnGetChatInfo, topic);
+ continue;
}
else
continue;
- MCONTACT hContact = isChat ? NULL : AddContact(skypename);
+ MCONTACT hContact = AddContact(skypename);
- if (hContact == NULL || GetMessageFromDb(hContact, clientMsgId, composeTime) == NULL)
- PushRequest(new GetHistoryRequest(RegToken, skypename, !isChat ? 100 : 15, isChat, 0,Server), &CSkypeProto::OnGetServerHistory);
+ if (GetMessageFromDb(hContact, clientMsgId, composeTime) == NULL)
+ PushRequest(new GetHistoryRequest(RegToken, skypename, 100, false, 0, Server), &CSkypeProto::OnGetServerHistory);
}
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index ea8ae50a82..3016cae380 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -105,6 +105,7 @@ void CSkypeProto::OnLoginSecond(const NETLIBHTTPREQUEST *response) void CSkypeProto::OnLoginSuccess()
{
+ SelfSkypeName = getStringA("Skypename");
TokenSecret = getStringA("TokenSecret");
Server = getStringA("registrationToken");
SendRequest(new CreateEndpointRequest(TokenSecret), &CSkypeProto::OnEndpointCreated);
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 1986867069..d82d0bfbae 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -91,7 +91,7 @@ private: // accounts
static LIST<CSkypeProto> Accounts;
- char *Server, *RegToken, *TokenSecret, *EndpointId;
+ char *Server, *RegToken, *TokenSecret, *EndpointId, *SelfSkypeName;
static int CompareAccounts(const CSkypeProto *p1, const CSkypeProto *p2);
@@ -210,6 +210,7 @@ private: void OnGetServerHistory (const NETLIBHTTPREQUEST *response);
void OnSyncHistory (const NETLIBHTTPREQUEST *response);
void SyncHistory();
+
//chats
void InitGroupChatModule();
void CloseAllChatChatSessions();
@@ -222,7 +223,7 @@ private: void StartChatRoom(const TCHAR *tid, const TCHAR *tname);
- void OnGetChatInfo(const NETLIBHTTPREQUEST *response);
+ void OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p);
INT_PTR __cdecl OnJoinChatRoom (WPARAM hContact, LPARAM);
INT_PTR __cdecl OnLeaveChatRoom (WPARAM hContact, LPARAM);
|