1 files changed, 21 insertions, 0 deletions
diff --git a/src/Utils.h b/src/Utils.h
index 7a9eb777..e62b2d34 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -9,6 +9,7 @@
#include <QCoreApplication>
#include <QDateTime>
#include <QPixmap>
+#include <QRegularExpression>
#include <mtx/events/collections.hpp>
#include <mtx/events/common.hpp>
@@ -40,6 +41,26 @@ namespace utils {
using TimelineEvent = mtx::events::collections::TimelineEvents;
+//! Helper function to remove reply fallback from body
+static void
+stripReplyFromBody(QString &body)
+{
+ QRegularExpression plainQuote("^>.*?$\n?", QRegularExpression::MultilineOption);
+ while (body.startsWith(">"))
+ body.remove(plainQuote);
+ if (body.startsWith("\n"))
+ body.remove(0, 1);
+}
+
+//! Helper function to remove reply fallback from formatted body
+static void
+stripReplyFromFormattedBody(QString &formatted_body)
+{
+ formatted_body.remove(QRegularExpression("<mx-reply>.*</mx-reply>",
+ QRegularExpression::DotMatchesEverythingOption));
+ formatted_body.replace("@room", "@\u2060aroom");
+}
+
RelatedInfo
stripReplyFallbacks(const TimelineEvent &event, std::string id, QString room_id_);
|