Allow JOINED message in lobby
authorunc0rr
Mon, 13 Aug 2012 23:04:42 +0400
changeset 7535 87e5838103ff
parent 7532 d8bdd4ec1c34
child 7537 833a0c34fafc
Allow JOINED message in lobby
QTfrontend/net/newnetclient.cpp
--- a/QTfrontend/net/newnetclient.cpp	Mon Aug 13 21:07:28 2012 +0400
+++ b/QTfrontend/net/newnetclient.cpp	Mon Aug 13 23:04:42 2012 +0400
@@ -507,6 +507,30 @@
         return;
     }
 
+    if(netClientState == InLobby && lst[0] == "JOINED")
+    {
+        if(lst.size() < 2 || lst[1] != mynick)
+        {
+            qWarning("Net: Bad JOINED message");
+            return;
+        }
+
+        for(int i = 1; i < lst.size(); ++i)
+        {
+            if (lst[i] == mynick)
+            {
+                netClientState = InRoom;
+                emit EnteredGame();
+                emit roomMaster(isChief);
+                if (isChief)
+                    emit configAsked();
+            }
+
+            emit nickAdded(lst[i], isChief && (lst[i] != mynick));
+            emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i]));
+        }
+        return;
+    }
 
     if(netClientState == InRoom)
     {
@@ -628,15 +652,6 @@
 
             for(int i = 1; i < lst.size(); ++i)
             {
-                if (lst[i] == mynick)
-                {
-                    netClientState = InRoom;
-                    emit EnteredGame();
-                    emit roomMaster(isChief);
-                    if (isChief)
-                        emit configAsked();
-                }
-
                 emit nickAdded(lst[i], isChief && (lst[i] != mynick));
                 emit chatStringFromNet(tr("%1 *** %2 has joined the room").arg('\x03').arg(lst[i]));
             }