Don't send LIST command on join
authorunc0rr
Mon, 28 Dec 2015 08:43:38 +0300
changeset 11463 fe46826de291
parent 11461 5dbc0f976b4a
child 11464 a9957113404a
Don't send LIST command on join
QTfrontend/net/newnetclient.cpp
gameServer/Actions.hs
gameServer/HWProtoLobbyState.hs
--- a/QTfrontend/net/newnetclient.cpp	Tue Dec 22 11:18:40 2015 -0500
+++ b/QTfrontend/net/newnetclient.cpp	Mon Dec 28 08:43:38 2015 +0300
@@ -552,7 +552,7 @@
                 }
 
                 netClientState = InLobby;
-                RawSendNet(QString("LIST"));
+                //RawSendNet(QString("LIST")); //deprecated
                 emit connected();
             }
 
@@ -945,7 +945,7 @@
         qWarning("Illegal try to get rooms list!");
         return;
     }
-    RawSendNet(QString("LIST"));
+    //RawSendNet(QString("LIST")); //deprecated
 }
 
 HWNewNet::ClientState HWNewNet::clientState()
--- a/gameServer/Actions.hs	Tue Dec 22 11:18:40 2015 -0500
+++ b/gameServer/Actions.hs	Mon Dec 28 08:43:38 2015 +0300
@@ -508,6 +508,7 @@
     chan <- client's sendChan
     rnc <- gets roomsClients
     clientNick <- client's nick
+    clProto <- client's clientProto
     isAuthenticated <- liftM (not . B.null) $ client's webPassword
     isAdmin <- client's isAdministrator
     isContr <- client's isContributor
@@ -521,6 +522,13 @@
         >>= filterM (liftM ((/=) lobbyId) . clientRoomM rnc)
         >>= mapM (client'sM rnc nick)
     let clFlags = B.concat . L.concat $ [["u" | isAuthenticated], ["a" | isAdmin], ["c" | isContr]]
+
+    roomsInfoList <- io $ do
+        rooms <- roomsM rnc
+        mapM (\r -> (if isNothing $ masterID r then return "" else client'sM rnc nick (fromJust $ masterID r))
+            >>= \cn -> return $ roomInfo clProto cn r)
+            $ filter (\r -> (roomProto r == clProto)) rooms
+
     mapM_ processAction . concat $ [
         [AnswerClients clientsChans ["LOBBY:JOINED", clientNick]]
         , [AnswerClients [chan] ("LOBBY:JOINED" : clientNick : lobbyNicks)]
@@ -531,6 +539,7 @@
         , [AnswerClients (chan : clientsChans) ["CLIENT_FLAGS",  B.concat["+" , clFlags], clientNick] | not $ B.null clFlags]
         , [ModifyClient (\cl -> cl{logonPassed = True, isVisible = True})]
         , [SendServerMessage]
+        , [AnswerClients [chan] ("ROOMS" : concat roomsInfoList)]
         ]
 
 
--- a/gameServer/HWProtoLobbyState.hs	Tue Dec 22 11:18:40 2015 -0500
+++ b/gameServer/HWProtoLobbyState.hs	Mon Dec 28 08:43:38 2015 +0300
@@ -34,12 +34,7 @@
 handleCmd_lobby :: CmdHandler
 
 
-handleCmd_lobby ["LIST"] = do
-    (ci, irnc) <- ask
-    let cl = irnc `client` ci
-    rooms <- allRoomInfos
-    let roomsInfoList = concatMap (\r -> roomInfo (clientProto cl) (maybeNick . liftM (client irnc) $ masterID r) r) . filter (\r -> (roomProto r == clientProto cl))
-    return [AnswerClients [sendChan cl] ("ROOMS" : roomsInfoList rooms)]
+handleCmd_lobby ["LIST"] = return []
 
 handleCmd_lobby ["CHAT", msg] = do
     n <- clientNick