2018-10-24 13:15:26 +00:00
|
|
|
#ifndef Utils_H
|
|
|
|
#define Utils_H
|
|
|
|
|
|
|
|
#include "room.h"
|
2018-11-26 01:15:43 +00:00
|
|
|
#include "user.h"
|
2018-10-24 13:15:26 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
2018-11-29 02:41:38 +00:00
|
|
|
#include <QRegularExpression>
|
2018-10-24 13:15:26 +00:00
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include <events/redactionevent.h>
|
|
|
|
#include <events/roomavatarevent.h>
|
|
|
|
#include <events/roommemberevent.h>
|
|
|
|
#include <events/simplestateevents.h>
|
|
|
|
|
|
|
|
namespace utils {
|
2018-11-29 02:41:38 +00:00
|
|
|
static const QRegularExpression removeReplyRegex{
|
|
|
|
"> <.*?>.*?\\n\\n", QRegularExpression::DotMatchesEverythingOption};
|
|
|
|
static const QRegularExpression removeRichReplyRegex{
|
|
|
|
"<mx-reply>.*?</mx-reply>", QRegularExpression::DotMatchesEverythingOption};
|
|
|
|
static const QRegularExpression codePillRegExp{
|
|
|
|
"<pre>(.*?)</pre>", QRegularExpression::DotMatchesEverythingOption};
|
|
|
|
static const QRegularExpression userPillRegExp{
|
|
|
|
"<a href=\"https://matrix.to/#/@.*?:.*?\">(.*?)</a>",
|
|
|
|
QRegularExpression::DotMatchesEverythingOption};
|
2018-10-24 13:15:26 +00:00
|
|
|
|
|
|
|
QString removeReply(const QString& text);
|
2018-11-29 02:41:38 +00:00
|
|
|
QString cleanHTML(const QString& text, QMatrixClient::Room* room);
|
2018-10-24 13:15:26 +00:00
|
|
|
} // namespace utils
|
|
|
|
|
|
|
|
#endif
|