--- a/gameServer/Actions.hs Sun Aug 05 15:00:59 2012 -0400
+++ b/gameServer/Actions.hs Sun Aug 05 23:03:49 2012 +0400
@@ -423,11 +423,22 @@
processAction JoinLobby = do
chan <- client's sendChan
clientNick <- client's nick
- (lobbyNicks, clientsChans) <- liftM (unzip . Prelude.map (nick &&& sendChan) . Prelude.filter logonPassed) $! allClientsS
- mapM_ processAction $
- AnswerClients clientsChans ["LOBBY:JOINED", clientNick]
- : AnswerClients [chan] ("LOBBY:JOINED" : clientNick : lobbyNicks)
- : [ModifyClient (\cl -> cl{logonPassed = True}), SendServerMessage]
+ isAuthenticated <- liftM (not . B.null) $ client's webPassword
+ isAdmin <- client's isAdministrator
+ loggedInClients <- liftM (Prelude.filter logonPassed) $! allClientsS
+ let (lobbyNicks, clientsChans) = unzip . L.map (nick &&& sendChan) $ loggedInClients
+ let authenticatedNicks = L.map nick . L.filter (not . B.null . webPassword) $ loggedInClients
+ let adminsNicks = L.map nick . L.filter isAdministrator $ loggedInClients
+ let clFlags = B.concat . L.concat $ [["u" | isAuthenticated], ["a" | isAdmin]]
+ mapM_ processAction . concat $ [
+ [AnswerClients clientsChans ["LOBBY:JOINED", clientNick]]
+ , [AnswerClients [chan] ("LOBBY:JOINED" : clientNick : lobbyNicks)]
+ , [AnswerClients [chan] ("CLIENT_FLAGS" : "+u" : authenticatedNicks) | not $ null authenticatedNicks]
+ , [AnswerClients [chan] ("CLIENT_FLAGS" : "+a" : adminsNicks) | not $ null adminsNicks]
+ , [AnswerClients (chan : clientsChans) ["CLIENT_FLAGS", B.concat["+" , clFlags], clientNick] | not $ B.null clFlags]
+ , [ModifyClient (\cl -> cl{logonPassed = True})]
+ , [SendServerMessage]
+ ]
processAction (KickClient kickId) = do