gameServer/HWProtoLobbyState.hs
branchserver_refactor
changeset 4618 0f56fa511f65
parent 4616 cc3485866b93
child 4620 6122a43d3424
--- a/gameServer/HWProtoLobbyState.hs	Sun Jan 30 20:36:32 2011 +0300
+++ b/gameServer/HWProtoLobbyState.hs	Sun Jan 30 20:38:40 2011 +0300
@@ -130,19 +130,16 @@
         else
         handleCmd_lobby ["JOIN_ROOM", name clRoom]
 
-{-
     ---------------------------
     -- Administrator's stuff --
 
-handleCmd_lobby clID clients rooms ["KICK", kickNick] =
-        [KickClient kickID | isAdministrator client && (not noSuchClient) && kickID /= clID]
-    where
-        client = clients IntMap.! clID
-        maybeClient = Foldable.find (\cl -> kickNick == nick cl) clients
-        noSuchClient = isNothing maybeClient
-        kickID = clientUID $ fromJust maybeClient
+handleCmd_lobby ["KICK", kickNick] = do
+    (ci, _) <- ask
+    cl <- thisClient
+    kickId <- clientByNick kickNick
+    return [KickClient $ fromJust kickId | isAdministrator cl && isJust kickId && fromJust kickId /= ci]
 
-
+{-
 handleCmd_lobby clID clients rooms ["BAN", banNick] =
     if not $ isAdministrator client then
         []