gameServer/HWProtoLobbyState.hs
changeset 11464 a9957113404a
parent 11463 fe46826de291
child 11467 f2c36df8c7b1
--- a/gameServer/HWProtoLobbyState.hs	Mon Dec 28 08:43:38 2015 +0300
+++ b/gameServer/HWProtoLobbyState.hs	Mon Dec 28 09:06:29 2015 +0300
@@ -34,7 +34,14 @@
 handleCmd_lobby :: CmdHandler
 
 
-handleCmd_lobby ["LIST"] = return []
+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 $ if hasAskedList cl then [] else
+        [ ModifyClient (\c -> c{hasAskedList = True})
+        , AnswerClients [sendChan cl] ("ROOMS" : roomsInfoList rooms)]
 
 handleCmd_lobby ["CHAT", msg] = do
     n <- clientNick