Add support for spotify hyperlinking (#597)
* Add support for spotify hyperlinking * Change open link in browser to open link
This commit is contained in:
committed by
fourtf
parent
77f904fae4
commit
727ccd2ff4
@@ -49,6 +49,7 @@ QString MessageBuilder::matchLink(const QString &string)
|
||||
|
||||
static QRegularExpression httpRegex("\\bhttps?://", QRegularExpression::CaseInsensitiveOption);
|
||||
static QRegularExpression ftpRegex("\\bftps?://", QRegularExpression::CaseInsensitiveOption);
|
||||
static QRegularExpression spotifyRegex("\\bspotify:", QRegularExpression::CaseInsensitiveOption);
|
||||
|
||||
if (!linkParser.hasMatch()) {
|
||||
return QString();
|
||||
@@ -56,10 +57,8 @@ QString MessageBuilder::matchLink(const QString &string)
|
||||
|
||||
QString captured = linkParser.getCaptured();
|
||||
|
||||
if (!captured.contains(httpRegex)) {
|
||||
if (!captured.contains(ftpRegex)) {
|
||||
captured.insert(0, "http://");
|
||||
}
|
||||
if (!captured.contains(httpRegex) && !captured.contains(ftpRegex) && !captured.contains(spotifyRegex)) {
|
||||
captured.insert(0, "http://");
|
||||
}
|
||||
|
||||
return captured;
|
||||
|
||||
Reference in New Issue
Block a user