Remove duplicate mxid regex

This commit is contained in:
Tobias Fella
2025-04-16 22:11:34 +02:00
parent 438d4ca3fd
commit 23803223bf

View File

@@ -7,6 +7,7 @@
#include "enums/messagetype.h"
#include "neochatconnection.h"
#include "neochatroom.h"
#include "utils.h"
#include <Quotient/events/eventcontent.h>
#include <Quotient/events/roommemberevent.h>
#include <Quotient/events/roompowerlevelsevent.h>
@@ -182,8 +183,7 @@ QList<ActionsModel::Action> actions{
Action{
u"invite"_s,
[](const QString &text, NeoChatRoom *room, ChatBarCache *) {
static const QRegularExpression mxidRegex(uR"((^|[][[:space:](){}`'";])([!#@][-a-z0-9_=#/.]{1,252}:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?))"_s);
auto regexMatch = mxidRegex.match(text);
auto regexMatch = TextRegex::mxId.match(text);
if (!regexMatch.hasMatch()) {
Q_EMIT room->showMessage(MessageType::Error, i18nc("'<text>' does not look like a matrix id.", "'%1' does not look like a matrix id.", text));
return QString();