QTfrontend/ui/widget/chatwidget.cpp
changeset 6227 ce60b734fff1
parent 6222 96d10dcd6d84
child 6229 4c834af76c3b
--- a/QTfrontend/ui/widget/chatwidget.cpp	Sat Oct 29 09:19:04 2011 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Sat Oct 29 11:47:37 2011 +0200
@@ -483,13 +483,13 @@
 // "link" nick, but before that encode it in base64 to make sure it can't
 // intefere with html/url syntax the nick is put as querystring as putting
 // it as host would convert it to it's lower case variant
-QString HWChatWidget::linkedNick(const QString & nickName)
+QString HWChatWidget::linkedNick(const QString & nickname)
 {
-    if (nickName != m_userNick)
+    if (nickname != m_userNick)
         return QString("<a href=\"hwnick://?%1\" class=\"nick\">%2</a>").arg(
-                    QString(nickName.toUtf8().toBase64())).arg(nickName);
+                    QString(nickname.toUtf8().toBase64())).arg(nickname);
     else
-        return QString("<span class=\"nick\">%1</span>").arg(nickName);
+        return QString("<span class=\"nick\">%1</span>").arg(nickname);
 }
 
 
@@ -539,7 +539,8 @@
 
     bool isHL = false;
 
-    if ((!nick.isEmpty()) && (nick != m_userNick))
+    if ((c != 3) && (!nick.isEmpty()) &&
+        (nick != m_userNick) && (m_userNick.isEmpty()))
     {
         QString lcStr = str.toLower();
 
@@ -637,7 +638,6 @@
     chatText->clear();
     chatStrings.clear();
     chatNicks->clear();
-    m_userNick = gameSettings->value("net/nick","").toString();
 
     // clear and re compile regexp for highlighting
     m_highlights.clear();
@@ -971,3 +971,11 @@
 
     return false;
 }
+
+
+void HWChatWidget::setUser(const QString & nickname)
+{
+    m_userNick = nickname;
+    nickRemoved(nickname);
+    clear();
+}