Remove markdown links from 'body' of messages

- Markdown is not in the matrix spec
- Clients use the 'body' text for things like notifications, which render these links as plain text
This commit is contained in:
Tobias Fella
2021-01-17 01:54:41 +01:00
parent a653be8be8
commit fe1e3ee374

View File

@@ -529,7 +529,9 @@ QString msgTypeToString(MessageEventType msgType)
void NeoChatRoom::postMessage(const QString &text, MessageEventType type, const QString &replyEventId, const QString &relateToEventId)
{
const auto html = markdownToHTML(text);
postHtmlMessage(text, html, type, replyEventId, relateToEventId);
QString cleanText(text);
cleanText.replace(QRegularExpression("\\[(.+)\\]\\(.+\\)"), "\\1");
postHtmlMessage(cleanText, html, type, replyEventId, relateToEventId);
}
void NeoChatRoom::postHtmlMessage(const QString &text, const QString &html, MessageEventType type, const QString &replyEventId, const QString &relateToEventId)