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).
This commit is contained in:
Tobias Fella
2022-05-15 15:11:34 +02:00
parent 10da870ab3
commit 6871ed051c

View File

@@ -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</a> <a href=\"https://matrix.to/#/" +
replyEvt.senderId() + "\">" + replyEvt.senderId() +
"</a><br>" + eventToString(replyEvt, Qt::RichText) +
"</blockquote></mx-reply>" + (isRichText ? html : text)
"</blockquote></mx-reply>" + 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)