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->setText(username);
|
||||||
ui->nameLabel->setToolTip(username); // for overlength names
|
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)
|
void Widget::onStatusMessageChanged(const QString& newStatusMessage, const QString& oldStatusMessage)
|
||||||
@ -944,7 +947,7 @@ void Widget::onGroupMessageReceived(int groupnumber, int peernumber, const QStri
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ToxID author = Core::getInstance()->getGroupPeerToxID(groupnumber, peernumber);
|
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)
|
if (targeted && !isAction)
|
||||||
g->getChatForm()->addAlertMessage(author, message, QDateTime::currentDateTime());
|
g->getChatForm()->addAlertMessage(author, message, QDateTime::currentDateTime());
|
||||||
else
|
else
|
||||||
|
@ -171,7 +171,7 @@ private:
|
|||||||
Status beforeDisconnect = Status::Offline;
|
Status beforeDisconnect = Status::Offline;
|
||||||
QTimer* idleTimer;
|
QTimer* idleTimer;
|
||||||
QTranslator* translator;
|
QTranslator* translator;
|
||||||
QRegExp nameMention;
|
QRegExp nameMention, sanitizedNameMention;
|
||||||
};
|
};
|
||||||
|
|
||||||
void toxActivateEventHandler(const QByteArray& data);
|
void toxActivateEventHandler(const QByteArray& data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user