GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1795570-chat-br-tags into lp:widelands.
Commit message: Fix br tag in chat server help message Requested reviews: Widelands Developers (widelands-dev) Related bugs: Bug #1795570 in widelands: "Chat /help prints <br> instead of using it" https://bugs.launchpad.net/widelands/+bug/1795570 For more details, see: https://code.launchpad.net/~widelands-dev/widelands/bug-1795570-chat-br-tags/+merge/356653 -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1795570-chat-br-tags into lp:widelands.
=== modified file 'src/wui/chat_msg_layout.cc' --- src/wui/chat_msg_layout.cc 2018-08-20 19:00:20 +0000 +++ src/wui/chat_msg_layout.cc 2018-10-12 10:30:39 +0000 @@ -19,6 +19,7 @@ #include "wui/chat_msg_layout.h" +#include <boost/algorithm/string.hpp> #include <boost/format.hpp> #include "chat/chat.h" @@ -39,6 +40,13 @@ return "999999"; } +std::string sanitize_message(const std::string& given_text) { + std::string result = richtext_escape(given_text); + // Preserve br tag + boost::replace_all(result, "<br>", "<br>"); + return result; +} + } // namespace // Returns a richtext string that can be displayed to the user. @@ -46,7 +54,7 @@ const std::string& font_face = "serif"; std::string message = "<p><font color=33ff33 size=9>"; - std::string sanitized = richtext_escape(chat_message.msg); + const std::string sanitized = sanitize_message(chat_message.msg); // time calculation char ts[13]; @@ -57,8 +65,8 @@ color(chat_message.playern)) .str(); - std::string sender_escaped = richtext_escape(chat_message.sender); - std::string recipient_escaped = richtext_escape(chat_message.recipient); + const std::string sender_escaped = richtext_escape(chat_message.sender); + const std::string recipient_escaped = richtext_escape(chat_message.recipient); if (chat_message.recipient.size() && chat_message.sender.size()) { // Personal message handling
_______________________________________________ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp