QTfrontend/ui/widget/chatwidget.cpp
changeset 6194 32b7e0ece99a
parent 6193 4f234aa06182
child 6197 4ce7c29799b9
--- a/QTfrontend/ui/widget/chatwidget.cpp	Sun Oct 23 22:47:59 2011 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Mon Oct 24 01:09:33 2011 +0200
@@ -30,7 +30,6 @@
 #include <QScrollBar>
 #include <QItemSelectionModel>
 #include <QStringList>
-#include <QRegExp>
 
 
 #include "HWDataManager.h"
@@ -468,10 +467,7 @@
 
     bool isHL = (!nick.isEmpty() &&
                 (nick != m_userNick) &&
-                str.toLower().contains(
-                        QRegExp(QString("^(.* )?%1(( |: ).*)?$").
-                            arg(QRegExp::escape(m_userNick).toLower())))
-                );
+                str.toLower().contains(m_hlRegExp));
 
     addLine(cssClass, formattedStr, isHL);
 }
@@ -545,6 +541,8 @@
     chatStrings.clear();
     chatNicks->clear();
     m_userNick = gameSettings->value("net/nick","").toString();
+    m_hlRegExp = QRegExp(QString("^(.* )?%1(( |[^-a-z0-9_]( |$)).*)?$").
+                            arg(QRegExp::escape(m_userNick).toLower()));
 }
 
 void HWChatWidget::onKick()