diff --git a/src/Utils.cpp b/src/Utils.cpp
index 99d337c4..4838f4e1 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -42,6 +42,9 @@
#include "MatrixClient.h"
#include "UserSettingsPage.h"
+static QString
+getQuoteBody(const RelatedInfo &related);
+
//! Match widgets/events with a description message.
namespace {
template<class T>
@@ -267,7 +270,7 @@ utils::stripReplyFallbacks(const mtx::events::collections::TimelineEvents &event
related.quoted_body = QString::fromStdString(mtx::accessors::body(event));
related.quoted_body =
QString::fromStdString(stripReplyFromBody(related.quoted_body.toStdString()));
- related.quoted_body = utils::getQuoteBody(related);
+ related.quoted_body = getQuoteBody(related);
// get quoted body and strip reply fallback
related.quoted_formatted_body = mtx::accessors::formattedBodyWithFallback(event);
@@ -1149,44 +1152,7 @@ utils::markdownToHtml(const QString &text, bool rainbowify_, bool noExtensions)
}
QString
-utils::getFormattedQuoteBody(const RelatedInfo &related, const QString &html)
-{
- auto getFormattedBody = [related]() -> QString {
- using MsgType = mtx::events::MessageType;
-
- switch (related.type) {
- case MsgType::File: {
- return QStringLiteral("sent a file.");
- }
- case MsgType::Image: {
- return QStringLiteral("sent an image.");
- }
- case MsgType::Audio: {
- return QStringLiteral("sent an audio file.");
- }
- case MsgType::Video: {
- return QStringLiteral("sent a video");
- }
- default: {
- return escapeBlacklistedHtml(related.quoted_formatted_body);
- }
- }
- };
-
- return QStringLiteral("<mx-reply><blockquote><a "
- "href=\"https://matrix.to/#/%1/%2\">In reply "
- "to</a> <a href=\"https://matrix.to/#/%3\">%4</a><br"
- "/>%5</blockquote></mx-reply>")
- .arg(related.room,
- QString::fromStdString(related.related_event),
- QUrl::toPercentEncoding(related.quoted_user),
- related.quoted_user.toHtmlEscaped(),
- getFormattedBody()) +
- html;
-}
-
-QString
-utils::getQuoteBody(const RelatedInfo &related)
+getQuoteBody(const RelatedInfo &related)
{
using MsgType = mtx::events::MessageType;
diff --git a/src/Utils.h b/src/Utils.h
index 9c5e4713..cf7e5a80 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -147,14 +147,6 @@ escapeMentionMarkdown(QString input);
QString
escapeBlacklistedHtml(const QString &data);
-//! Generate a Rich Reply quote message
-QString
-getFormattedQuoteBody(const RelatedInfo &related, const QString &html);
-
-//! Get the body for the quote, depending on the event type.
-QString
-getQuoteBody(const RelatedInfo &related);
-
//! Retrieve the color of the links based on the current theme.
QString
linkColor();
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index e967da8c..270e261e 100644
--- a/src/timeline/InputBar.cpp
+++ b/src/timeline/InputBar.cpp
@@ -560,41 +560,6 @@ InputBar::message(const QString &msg, MarkdownOverride useMarkdown, bool rainbow
text.mentions = generateMentions();
text.relations = generateRelations();
- if (!room->reply().isEmpty() && room->thread().isEmpty() && room->edit().isEmpty()) {
- auto related = room->relatedInfo(room->reply());
-
- // Skip reply fallbacks to users who would cause a room ping with the fallback.
- // This should be fine, since in some cases the reply fallback can be omitted now and the
- // alternative is worse! On Element Android this applies to any substring, but that is their
- // bug to fix.
- if (!related.quoted_user.startsWith("@room:")) {
- QString body;
- bool firstLine = true;
- auto lines = QStringView(related.quoted_body).split(u'\n');
- for (auto line : std::as_const(lines)) {
- if (firstLine) {
- firstLine = false;
- body = QStringLiteral("> <%1> %2\n").arg(related.quoted_user, line);
- } else {
- body += QStringLiteral("> %1\n").arg(line);
- }
- }
-
- text.body = fmt::format("{}\n{}", body.toStdString(), text.body);
-
- // NOTE(Nico): rich replies always need a formatted_body!
- text.format = "org.matrix.custom.html";
- if ((ChatPage::instance()->userSettings()->markdown() &&
- useMarkdown == MarkdownOverride::NOT_SPECIFIED) ||
- useMarkdown == MarkdownOverride::ON)
- text.formatted_body =
- utils::getFormattedQuoteBody(related, utils::markdownToHtml(msg, rainbowify))
- .toStdString();
- else
- text.formatted_body =
- utils::getFormattedQuoteBody(related, msg.toHtmlEscaped()).toStdString();
- }
- }
room->sendMessageEvent(text, mtx::events::EventType::RoomMessage);
}
|