From 6871ed051c1f30c79e838bbd25b7110dc4d1462d Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sun, 15 May 2022 15:11:34 +0200 Subject: [PATCH] Always send messages as HTML This works around limitations of Qt's rich text detection and prevents some messages from being shown wrong, like in #532. In theory it is not ideal to send every message as HTML, however it's not a significant problem and we already do it for edits and replies (which also explains why edited messages are sometimes magically rendered correctly while the original is not). --- src/neochatroom.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/neochatroom.cpp b/src/neochatroom.cpp index 08fcd5e53..6409e3084 100644 --- a/src/neochatroom.cpp +++ b/src/neochatroom.cpp @@ -650,7 +650,6 @@ void NeoChatRoom::postMessage(const QString &rawText, const QString &text, Messa void NeoChatRoom::postHtmlMessage(const QString &text, const QString &html, MessageEventType type, const QString &replyEventId, const QString &relateToEventId) { - bool isRichText = Qt::mightBeRichText(html); bool isReply = !replyEventId.isEmpty(); bool isEdit = !relateToEventId.isEmpty(); const auto replyIt = findInTimeline(replyEventId); @@ -696,7 +695,7 @@ void NeoChatRoom::postHtmlMessage(const QString &text, const QString &html, Mess "\">In reply to " + replyEvt.senderId() + "
" + eventToString(replyEvt, Qt::RichText) + - "" + (isRichText ? html : text) + "" + html } }; // clang-format on @@ -706,11 +705,7 @@ void NeoChatRoom::postHtmlMessage(const QString &text, const QString &html, Mess return; } - if (isRichText) { - Room::postHtmlMessage(text, html, type); - } else { - Room::postMessage(text, type); - } + Room::postHtmlMessage(text, html, type); } void NeoChatRoom::toggleReaction(const QString &eventId, const QString &reaction)