mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
aa9d0e06d1
commit
44ddb8789c
@ -641,7 +641,10 @@ void Widget::setUsername(const QString& username)
|
||||
{
|
||||
ui->nameLabel->setText(username);
|
||||
ui->nameLabel->setToolTip(username); // for overlength names
|
||||
nameMention = QRegExp("\\b" + QRegExp::escape(username) + "\\b", Qt::CaseInsensitive);
|
||||
QString sanename = username;
|
||||
sanename.remove(QRegExp("[\\t\\n\\v\\f\\r\\x0000]"));
|
||||
nameMention = QRegExp("\\b" + QRegExp::escape(username) + "\\b", Qt::CaseInsensitive);
|
||||
sanitizedNameMention = QRegExp("\\b" + QRegExp::escape(sanename) + "\\b", Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage)
|
||||
@ -944,7 +947,7 @@ void Widget::onGroupMessageReceived(int groupnumber, int peernumber, const QStri
|
||||
return;
|
||||
|
||||
ToxID author = Core::getInstance()->getGroupPeerToxID(groupnumber, peernumber);
|
||||
bool targeted = (!author.isMine()) && message.contains(nameMention);
|
||||
bool targeted = !author.isMine() && (message.contains(nameMention) || message.contains(sanitizedNameMention));
|
||||
if (targeted && !isAction)
|
||||
g->getChatForm()->addAlertMessage(author, message, QDateTime::currentDateTime());
|
||||
else
|
||||
|
@ -171,7 +171,7 @@ private:
|
||||
Status beforeDisconnect = Status::Offline;
|
||||
QTimer* idleTimer;
|
||||
QTranslator* translator;
|
||||
QRegExp nameMention;
|
||||
QRegExp nameMention, sanitizedNameMention;
|
||||
};
|
||||
|
||||
void toxActivateEventHandler(const QByteArray& data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user