diff --git a/services/messageservice.cpp b/services/messageservice.cpp index 2ce7f336aee5e8bafd37fd89a5f875c2f242ea12..e23346462a42d1ff946ea8f39d5dc189379be84d 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 764ba915d503145595c7f2cf7c5b65f1b64f7c46..bb6467800349dadff0c4f2c91b9d12511aee7ab2 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 fffe29758b7e9de9ae18f75ada4e3714e2156cfb..2e413b016a88914b2130d53ffcf25f815a449690 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 );