Don't make pseudo player names like [server] clickable in chat
authorWuzzy <Wuzzy2@mail.ru>
Sun, 12 Aug 2018 16:31:22 +0200
changeset 13661 edbe5d80ffbc
parent 13660 45b325bb9bb1
child 13662 2d38dc2d3414
Don't make pseudo player names like [server] clickable in chat
ChangeLog.txt
QTfrontend/ui/widget/chatwidget.cpp
--- a/ChangeLog.txt	Sat Aug 11 23:20:08 2018 +0200
+++ b/ChangeLog.txt	Sun Aug 12 16:31:22 2018 +0200
@@ -36,6 +36,7 @@
  * Fix rare crash when aborting video encoding in progress
  * Controllers are detected again
  * No longer allow having schemes with equal names (case-insensitive)
+ * Pseudo player names in chat (like “[server]”) are no longer clickable
  * Lobby/room: No longer allow opening context menu if no player selected
 
 Highlander:
--- a/QTfrontend/ui/widget/chatwidget.cpp	Sat Aug 11 23:20:08 2018 +0200
+++ b/QTfrontend/ui/widget/chatwidget.cpp	Sun Aug 12 16:31:22 2018 +0200
@@ -373,11 +373,13 @@
 // it as host would convert it to it's lower case variant
 QString HWChatWidget::linkedNick(const QString & nickname)
 {
-    if (nickname != m_userNick)
+    // '[' is reserved character used for fake player names in special server messages
+    if ((nickname != m_userNick) && (!nickname.contains('[')))
+        // linked nick
         return QString("<a href=\"hwnick://?%1\" class=\"nick\">%2</a>").arg(
                    QString(nickname.toUtf8().toBase64())).arg(nickname.toHtmlEscaped());
 
-    // unlinked nick (if own one)
+    // unlinked nick (if own one or fake player name)
     return QString("<span class=\"nick\">%1</span>").arg(nickname.toHtmlEscaped());
 }