From eea151525c703a7c211bc450fc6f747ee3234d72 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 20 Apr 2015 12:42:10 +0000 Subject: SkypeWeb: Topic change support. git-svn-id: http://svn.miranda-ng.org/main/trunk@12970 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_chatrooms.cpp | 29 +++++++++++++++++++++++++++++ protocols/SkypeWeb/src/skype_proto.h | 1 + 2 files changed, 30 insertions(+) (limited to 'protocols/SkypeWeb/src') 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=14295327021308:usertest topic + 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(&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(&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); -- cgit v1.2.3