Mentions will now work with all legal chars

As the server has been updated to enforce username rules, we can now
check for the next position of whitespace. This allows ALL users to have
a working mention system. Currently "-" is available for users, this
will fix that.
This commit is contained in:
Matt Lowe 2015-04-18 14:42:39 +02:00
parent 69a9484e45
commit 2d34bfeb1b

View file

@ -247,7 +247,7 @@ void ChatView::appendMessage(QString message, QString sender, UserLevelFlags use
showSystemPopup(ref);
}
} else {
int mentionEndIndex = message.indexOf(QRegExp("\\W"), 1);// from 1 as @ is non-char
int mentionEndIndex = message.indexOf(QRegExp("\\s"), 1);// from 1 as @ is non-char
if (mentionEndIndex == -1)
mentionEndIndex = message.size(); // there is no text after the mention
QString userMention = message.left(mentionEndIndex);