summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp29
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h1
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);