Browse Source

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.
reviewable/pr5500/r1
crypto-universe 7 years ago
parent
commit
5b1bc7e523
  1. 1
      src/chatlog/textformatter.cpp

1
src/chatlog/textformatter.cpp

@ -90,6 +90,7 @@ static const QVector<QRegularExpression> URI_WORD_PATTERNS = { @@ -90,6 +90,7 @@ static const QVector<QRegularExpression> 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| ]+))")),
};

Loading…
Cancel
Save