From 3f787920718a0b29d2a7cfb21aaef614732cc734 Mon Sep 17 00:00:00 2001 From: Dennis Beier <nanovim@gmail.com> Date: Sun, 23 Dec 2018 18:14:17 +0100 Subject: [PATCH] elimating arrows that could be considered html comments --- services/messageservice.cpp | 3 ++- utils.cpp | 8 ++++++++ utils.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/services/messageservice.cpp b/services/messageservice.cpp index 2ce7f33..e233464 100644 --- a/services/messageservice.cpp +++ b/services/messageservice.cpp @@ -144,8 +144,9 @@ QSharedPointer<RocketChatMessage> MessageService::parseMessage( const QJsonObjec msgString = Utils::linkiFy( msgString ); msgString = msgString.replace( QStringLiteral( "\n" ), QStringLiteral( "<br>" ) ); - + msgString = Utils::escapeHtml(msgString); msgString = Utils::emojiFy( msgString, mEmojiRepo ); + } QString msgType; diff --git a/utils.cpp b/utils.cpp index 764ba91..bb64678 100755 --- a/utils.cpp +++ b/utils.cpp @@ -314,6 +314,14 @@ QString Utils::emojiFy( const QString &pMessage, EmojiRepo *pEmojiRepo ) return returnText; } +QString Utils::escapeHtml(const QString &pText) +{ + QString buff = pText; + buff.replace("<--","â†"); + buff.replace("-->","→"); + return buff; +} + qint16 Utils::hash( const QStringList &pStrings ) { QByteArray stringSum; diff --git a/utils.h b/utils.h index fffe297..2e413b0 100755 --- a/utils.h +++ b/utils.h @@ -35,6 +35,7 @@ class Utils static QString removeUtf8Emojis( const QString &pText ); static QString linkiFy( const QString &pText ); static QString emojiFy( const QString &pText, EmojiRepo *pEmojiRepo ); + static QString escapeHtml( const QString &pText); static double getMessageTimestamp( const QJsonObject &pMessage ); static bool compareMessageTimestamps( const QJsonObject &pMessage1, const QJsonObject &pMessage2 ); static bool messageHasTimestamp( const QJsonObject &pMessage ); -- GitLab