gameServer/Actions.hs
changeset 8189 328f429c3ecc
parent 8158 5da1c26d5b10
child 8227 3a2ce574aa3b
equal deleted inserted replaced
8187:fa725fe25708 8189:328f429c3ecc
   439     dbq <- gets (dbQueries . serverInfo)
   439     dbq <- gets (dbQueries . serverInfo)
   440     io $ writeChan dbq ClearCache
   440     io $ writeChan dbq ClearCache
   441     return ()
   441     return ()
   442 
   442 
   443 
   443 
   444 processAction (ProcessAccountInfo info) =
   444 processAction (ProcessAccountInfo info) = do
   445     case info of
   445     case info of
   446         HasAccount passwd isAdmin -> do
   446         HasAccount passwd isAdmin -> do
   447             chan <- client's sendChan
   447             b <- isBanned
   448             mapM_ processAction [AnswerClients [chan] ["ASKPASSWORD"], ModifyClient (\c -> c{webPassword = passwd, isAdministrator = isAdmin})]
   448             when (not b) $ do
   449         Guest ->
   449                 chan <- client's sendChan
   450             processAction JoinLobby
   450                 mapM_ processAction [AnswerClients [chan] ["ASKPASSWORD"], ModifyClient (\c -> c{webPassword = passwd, isAdministrator = isAdmin})]
       
   451         Guest -> do
       
   452             b <- isBanned
       
   453             when (not b) $
       
   454                 processAction JoinLobby
   451         Admin -> do
   455         Admin -> do
   452             mapM_ processAction [ModifyClient (\cl -> cl{isAdministrator = True}), JoinLobby]
   456             mapM_ processAction [ModifyClient (\cl -> cl{isAdministrator = True}), JoinLobby]
   453             chan <- client's sendChan
   457             chan <- client's sendChan
   454             processAction $ AnswerClients [chan] ["ADMIN_ACCESS"]
   458             processAction $ AnswerClients [chan] ["ADMIN_ACCESS"]
       
   459     where
       
   460     isBanned = do
       
   461         processAction CheckBanned
       
   462         liftM B.null $ client's nick
   455 
   463 
   456 
   464 
   457 processAction JoinLobby = do
   465 processAction JoinLobby = do
   458     chan <- client's sendChan
   466     chan <- client's sendChan
   459     clientNick <- client's nick
   467     clientNick <- client's nick