From 54efd8968c7990f17678ad9b823c1a6e71ad91bb Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Fri, 17 Apr 2015 14:33:52 +0000 Subject: SkypeWeb: Chat fixes. git-svn-id: http://svn.miranda-ng.org/main/trunk@12890 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_chatrooms.cpp | 24 ++++++++++++++++-------- protocols/SkypeWeb/src/skype_proto.h | 2 ++ protocols/SkypeWeb/src/skype_utils.cpp | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index dee5b12629..8f629d0d5a 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -206,20 +206,21 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) } else if (!mir_strcmpi(messageType, "ThreadActivity/AddMember")) { - ptrA initiator, target; + ptrA xinitiator, xtarget, initiator, target; //content = 14291862291648:initiator8:user HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("addmember")); if (xml != NULL) { HXML node = xi.getChildByPath(xml, _T("initiator"), 0); - initiator = node != NULL ? mir_t2a(xi.getText(node)) : NULL; + xinitiator = node != NULL ? mir_t2a(xi.getText(node)) : NULL; node = xi.getChildByPath(xml, _T("target"), 0); - target = node != NULL ? mir_t2a(xi.getText(node)) : NULL; + xtarget = node != NULL ? mir_t2a(xi.getText(node)) : NULL; xi.destroyNode(xml); } + target = ParseUrl(xtarget, "8:"); GCDEST gcd = { m_szModuleName, ptrT(mir_a2t(chatname)), GC_EVENT_JOIN }; GCEVENT gce = { sizeof(GCEVENT), &gcd }; @@ -232,23 +233,30 @@ void CSkypeProto::OnChatEvent(JSONNODE *node) } else if (!mir_strcmpi(messageType, "ThreadActivity/DeleteMember")) { - ptrA initiator, target; + ptrA xinitiator, xtarget, initiator, target; //content = 14291862291648:initiator8:user HXML xml = xi.parseString(ptrT(mir_a2t(content)), 0, _T("deletemember")); if (xml != NULL) { HXML node = xi.getChildByPath(xml, _T("initiator"), 0); - initiator = node != NULL ? mir_t2a(xi.getText(node)) : NULL; + xinitiator = node != NULL ? mir_t2a(xi.getText(node)) : NULL; node = xi.getChildByPath(xml, _T("target"), 0); - target = node != NULL ? mir_t2a(xi.getText(node)) : NULL; + xtarget = node != NULL ? mir_t2a(xi.getText(node)) : NULL; xi.destroyNode(xml); } + if(xtarget == NULL) + return; + + target = ParseUrl(xtarget, "8:"); bool isKick = false; - if (initiator != NULL) - bool isKick = true; + if (xinitiator != NULL) + { + initiator = ParseUrl(xinitiator, "8:"); + isKick = true; + } if (isKick) { diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 51d00df246..3956db072b 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -252,6 +252,8 @@ private: static void ShowNotification(const TCHAR *caption, const TCHAR *message, int flags = 0, MCONTACT hContact = NULL); static bool IsFileExists(std::tstring path); + char *ParseUrl(const char *url, const char *token); + char *ChatUrlToName(const char *url); char *ContactUrlToName(const char *url); char *SelfUrlToName(const char *url); diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index aa429017be..7a6f9f682d 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -240,7 +240,7 @@ bool CSkypeProto::IsFileExists(std::tstring path) // url parsing -char *ParseUrl(const char *url, const char *token) +char *CSkypeProto::ParseUrl(const char *url, const char *token) { const char *start = strstr(url, token); if (start == NULL) -- cgit v1.2.3