From 2dfa40e017c9880164936b50a0ab698dd83a125b Mon Sep 17 00:00:00 2001 From: targetakhil Date: Sun, 18 Apr 2021 11:22:44 +0530 Subject: strip reply fallbacks from forwarded message --- src/Utils.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/Utils.cpp') diff --git a/src/Utils.cpp b/src/Utils.cpp index ca2d3adc..11e7b1af 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -63,19 +63,13 @@ utils::stripReplyFallbacks(const TimelineEvent &event, std::string id, QString r // get body, strip reply fallback, then transform the event to text, if it is a media event // etc related.quoted_body = QString::fromStdString(mtx::accessors::body(event)); - QRegularExpression plainQuote("^>.*?$\n?", QRegularExpression::MultilineOption); - while (related.quoted_body.startsWith(">")) - related.quoted_body.remove(plainQuote); - if (related.quoted_body.startsWith("\n")) - related.quoted_body.remove(0, 1); + stripReplyFromBody(related.quoted_body); related.quoted_body = utils::getQuoteBody(related); related.quoted_body.replace("@room", QString::fromUtf8("@\u2060room")); // get quoted body and strip reply fallback related.quoted_formatted_body = mtx::accessors::formattedBodyWithFallback(event); - related.quoted_formatted_body.remove(QRegularExpression( - ".*", QRegularExpression::DotMatchesEverythingOption)); - related.quoted_formatted_body.replace("@room", "@\u2060aroom"); + stripReplyFromFormattedBody(related.quoted_formatted_body); related.room = room_id_; return related; -- cgit 1.5.1