# HG changeset patch
# User Wuzzy <Wuzzy2@mail.ru>
# Date 1540485335 -7200
# Node ID 4d761adb4e6c7f6fae2035a5eddbf6a5eed4cb39
# Parent  9468efabd33793bd96787ec4b83bc26e434dc8d1
Frontend: Make sure special nicks always show up in square brackets

diff -r 9468efabd337 -r 4d761adb4e6c QTfrontend/net/newnetclient.cpp
--- a/QTfrontend/net/newnetclient.cpp	Thu Oct 25 16:44:46 2018 +0200
+++ b/QTfrontend/net/newnetclient.cpp	Thu Oct 25 18:35:35 2018 +0200
@@ -383,18 +383,26 @@
 
         QString action;
         QString message;
+        QString sender = lst[1];
         // '[' is a special character used in fake nick names of server messages.
         // Those are supposed to be translated
-        if(!lst[1].startsWith('['))
+        if(!sender.startsWith('['))
         {
             // Normal message
             message = lst[2];
             // Another kind of fake nick. '(' nicks are server messages, but they must not be translated
-            if(!lst[1].startsWith('('))
+            if(!sender.startsWith('('))
             {
                 // Check for action (/me command)
                 action = HWProto::chatStringToAction(message);
             }
+            else
+            {
+                // If parenthesis were used, replace them with square brackets
+                // for a consistent style.
+                sender.replace(0, 1, '[');
+                sender.replace(sender.length()-1, 1, ']');
+            }
         }
         else
         {
@@ -406,17 +414,17 @@
         if (netClientState == InLobby)
         {
             if (!action.isNull())
-                emit lobbyChatAction(lst[1], action);
+                emit lobbyChatAction(sender, action);
             else
-                emit lobbyChatMessage(lst[1], message);
+                emit lobbyChatMessage(sender, message);
         }
         else
         {
-            emit chatStringFromNet(HWProto::formatChatMsg(lst[1], message));
+            emit chatStringFromNet(HWProto::formatChatMsg(sender, message));
             if (!action.isNull())
-                emit roomChatAction(lst[1], action);
+                emit roomChatAction(sender, action);
             else
-                emit roomChatMessage(lst[1], message);
+                emit roomChatMessage(sender, message);
         }
         return;
     }