diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-20 12:42:10 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-20 12:42:10 +0000 |
commit | eea151525c703a7c211bc450fc6f747ee3234d72 (patch) | |
tree | a8dbc249a939147d1b840eaf6702376b1c2bfe3d | |
parent | 856b4c2c2d7832d99d7fa85304f943b3e5d268b8 (diff) |
SkypeWeb: Topic change support.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12970 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 29 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 1 |
2 files changed, 30 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 80a38fbbee..bae0f32d60 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -339,7 +339,22 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) }
else if (!mir_strcmpi(messageType, "ThreadActivity/TopicUpdate"))
{
+ //content=<topicupdate><eventtime>1429532702130</eventtime><initiator>8:user</initiator><value>test topic</value></topicupdate>
+ ptrA xinitiator, value, initiator;
+ HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("topicupdate"));
+ if (xml != NULL) {
+ HXML xmlNode = xi.getChildByPath(xml, _T("initiator"), 0);
+ xinitiator = node != NULL ? mir_t2a(xi.getText(xmlNode)) : NULL;
+
+ xmlNode = xi.getChildByPath(xml, _T("value"), 0);
+ value = node != NULL ? mir_t2a(xi.getText(xmlNode)) : NULL;
+ xi.destroyNode(xml);
+ }
+ initiator = ParseUrl(xinitiator, "8:");
+
+ RenameChat(chatname, value);
+ ChangeChatTopic(chatname, value, initiator);
}
else if (!mir_strcmpi(messageType, "ThreadActivity/RoleUpdate"))
{
@@ -380,6 +395,20 @@ void CSkypeProto::RenameChat(const char *chat_id, const char *name) CallService(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
}
+void CSkypeProto::ChangeChatTopic(const char *chat_id, const char *topic, const char *initiator)
+{
+ ptrT tchat_id(mir_a2t(chat_id));
+ ptrT tname(mir_a2t(initiator));
+ ptrT ttopic(mir_a2t(topic));
+
+ GCDEST gcd = { m_szModuleName, tchat_id, GC_EVENT_TOPIC };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.ptszUID = tname;
+ gce.ptszNick = tname;
+ gce.ptszText = ttopic;
+ CallService(MS_GC_EVENT, 0, reinterpret_cast<LPARAM>(&gce));
+}
+
bool CSkypeProto::IsChatContact(const TCHAR *chat_id, const char *id)
{
ptrA users(GetChatUsers(chat_id));
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index a921089d45..9fc42a035b 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -241,6 +241,7 @@ private: void RemoveChatContact(const TCHAR *tchat_id, const char *id, const char *name, bool isKick = false, const char *initiator = "");
void RenameChat(const char *chat_id, const char *name);
+ void ChangeChatTopic(const char * chat_id, const char *topic, const char *initiator);
static INT_PTR __stdcall InviteDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
|