From 8ea94a560b5c37003f4fffa7ff4be86eab792fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 9 Nov 2015 21:49:32 +0000 Subject: SkypeWeb: Strip html from messages only when type is "RichText" (fixes #1085) git-svn-id: http://svn.miranda-ng.org/main/trunk@15705 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_chatrooms.cpp | 13 ++++++------- protocols/SkypeWeb/src/skype_history_sync.cpp | 2 +- protocols/SkypeWeb/src/skype_messages.cpp | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 32299ec583..8c2f8df693 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -290,7 +290,8 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) std::string messageType = node["messagetype"].as_string(); if (messageType == "Text" || messageType == "RichText") { - AddMessageToChat(_A2T(szConversationName), _A2T(szFromSkypename), strContent.c_str(), nEmoteOffset != NULL, nEmoteOffset, timestamp); + ptrA szClearedContent(messageType == "RichText" ? RemoveHtml(strContent.c_str()) : mir_strdup(strContent.c_str())); + AddMessageToChat(_A2T(szConversationName), _A2T(szFromSkypename), szClearedContent, nEmoteOffset != NULL, nEmoteOffset, timestamp); } else if (messageType == "ThreadActivity/AddMember") { @@ -436,19 +437,17 @@ void CSkypeProto::AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, cons gce.time = timestamp; gce.ptszUID = from; - ptrA szHtml(RemoveHtml(content)); - - CMString tszHtml(ptrT(mir_utf8decodeT(szHtml))); - tszHtml.Replace(L"%", L"%%"); + CMString tszText(ptrT(mir_utf8decodeT(content))); + tszText.Replace(L"%", L"%%"); if (!isAction) { - gce.ptszText = tszHtml; + gce.ptszText = tszText; gce.dwFlags = GCEF_ADDTOLOG; } else { - gce.ptszText = &(tszHtml.GetBuffer())[emoteOffset]; + gce.ptszText = &(tszText.GetBuffer())[emoteOffset]; } if (isLoading) gce.dwFlags = GCEF_NOTNOTIFY; diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 5028030d92..bab3b21fc9 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -72,7 +72,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) { if (messageType == "Text" || messageType == "RichText") { - ptrA szMessage(RemoveHtml(content.c_str())); + ptrA szMessage(messageType == "RichText" ? RemoveHtml(content.c_str()) : mir_strdup(content.c_str())); MEVENT dbevent = GetMessageFromDb(hContact, szMessageId); if (isEdited && dbevent != NULL) diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 91e61d0c43..799109e89e 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -162,7 +162,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) std::string strMessageType = node["messagetype"].as_string(); std::string strContent = node["content"].as_string(); - ptrA szClearedContent(RemoveHtml(strContent.c_str())); + ptrA szClearedContent(strMessageType == "RichText" ? RemoveHtml(strContent.c_str()) : mir_strdup(strContent.c_str())); bool bEdited = node["skypeeditedid"]; time_t timestamp = IsoToUnixTime(node["composetime"].as_string().c_str()); -- cgit v1.2.3