From 5b1bc7e52323f6832e00a50c34f8143f4d7cbf33 Mon Sep 17 00:00:00 2001 From: crypto-universe Date: Wed, 16 Jan 2019 21:11:54 +0100 Subject: [PATCH] feat(chatfom): make magnet links clickable Add one more rergular expression that should match magnet links. Unfortunately, magnet links may contain a lot of spaces, so the message after the link may also be treated as a part of link. --- src/chatlog/textformatter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chatlog/textformatter.cpp b/src/chatlog/textformatter.cpp index 011ecb4d9..3ee2b8d11 100644 --- a/src/chatlog/textformatter.cpp +++ b/src/chatlog/textformatter.cpp @@ -90,6 +90,7 @@ static const QVector URI_WORD_PATTERNS = { QRegularExpression(QStringLiteral(R"((?<=^|\s)\S*(tox:[a-zA-Z\d]{76}))")), QRegularExpression(QStringLiteral(R"((?<=^|\s)\S*(mailto:\S+@\S+\.\S+))")), QRegularExpression(QStringLiteral(R"((?<=^|\s)\S*(tox:\S+@\S+))")), + QRegularExpression(QStringLiteral(R"((?<=^|\s)\S*(magnet:[?]((xt(.\d)?=urn:)|(mt=)|(kt=)|(tr=)|(dn=)|(xl=)|(xs=)|(as=)|(x.))[\S| ]+))")), };