summary refs log tree commit diff
path: root/src/Utils.cpp
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2019-12-07 21:39:47 -0500
committerJoseph Donofry <joedonofry@gmail.com>2019-12-07 21:39:47 -0500
commite79ae4ea0996f175ea607e22627a447a4de2a1dc (patch)
treea49d9a6936c22619d619f02e5a654c80f283f5c1 /src/Utils.cpp
parentMerge branch '0.7.0-dev' of ssh://github.com/Nheko-Reborn/nheko into 0.7.0-dev (diff)
parentSimplify scroll logic (diff)
downloadnheko-e79ae4ea0996f175ea607e22627a447a4de2a1dc.tar.xz
Merge branch '0.7.0-dev' of ssh://github.com/Nheko-Reborn/nheko into 0.7.0-dev
Diffstat (limited to 'src/Utils.cpp')
-rw-r--r--src/Utils.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/Utils.cpp b/src/Utils.cpp

index c60adb58..3e59d912 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp
@@ -40,9 +40,8 @@ utils::replaceEmoji(const QString &body) for (auto &code : utf32_string) { // TODO: Be more precise here. if (code > 9000) - fmtBody += - QString("<span style=\"font-family: " + userFontFamily + ";\">") + - QString::fromUcs4(&code, 1) + "</span>"; + fmtBody += QString("<font face=\"" + userFontFamily + "\">") + + QString::fromUcs4(&code, 1) + "</font>"; else fmtBody += QString::fromUcs4(&code, 1); } @@ -147,11 +146,6 @@ utils::getMessageDescription(const TimelineEvent &event, const auto ts = QDateTime::fromMSecsSinceEpoch(msg.origin_server_ts); DescInfo info; - if (sender == localUser) - info.username = QCoreApplication::translate("utils", "You"); - else - info.username = username; - info.userid = sender; info.body = QString(" %1").arg(messageDescription<Encrypted>()); info.timestamp = utils::descriptiveTime(ts); @@ -324,19 +318,29 @@ utils::linkifyMessage(const QString &body) return doc; } -QByteArray escapeRawHtml(const QByteArray &data) { - QByteArray buffer; - const size_t length = data.size(); - buffer.reserve(length); - for(size_t pos = 0; pos != length; ++pos) { - switch(data.at(pos)) { - case '&': buffer.append("&amp;"); break; - case '<': buffer.append("&lt;"); break; - case '>': buffer.append("&gt;"); break; - default: buffer.append(data.at(pos)); break; - } - } - return buffer; +QByteArray +escapeRawHtml(const QByteArray &data) +{ + QByteArray buffer; + const size_t length = data.size(); + buffer.reserve(length); + for (size_t pos = 0; pos != length; ++pos) { + switch (data.at(pos)) { + case '&': + buffer.append("&amp;"); + break; + case '<': + buffer.append("&lt;"); + break; + case '>': + buffer.append("&gt;"); + break; + default: + buffer.append(data.at(pos)); + break; + } + } + return buffer; } QString @@ -362,7 +366,7 @@ utils::getFormattedQuoteBody(const RelatedInfo &related, const QString &html) { return QString("<mx-reply><blockquote><a " "href=\"https://matrix.to/#/%1/%2\">In reply " - "to</a>* <a href=\"https://matrix.to/#/%3\">%4</a><br " + "to</a> <a href=\"https://matrix.to/#/%3\">%4</a><br" "/>%5</blockquote></mx-reply>") .arg(related.room, QString::fromStdString(related.related_event), @@ -378,9 +382,6 @@ utils::getQuoteBody(const RelatedInfo &related) using MsgType = mtx::events::MessageType; switch (related.type) { - case MsgType::Text: { - return markdownToHtml(related.quoted_body); - } case MsgType::File: { return QString(QCoreApplication::translate("utils", "sent a file.")); }