gameServer/Actions.hs
changeset 7748 f160fbc139b1
parent 7735 4c7e282b5732
child 7757 c20e6c80e249
equal deleted inserted replaced
7747:8df97e271e5e 7748:f160fbc139b1
    48     | KickClient ClientIndex
    48     | KickClient ClientIndex
    49     | KickRoomClient ClientIndex
    49     | KickRoomClient ClientIndex
    50     | BanClient NominalDiffTime B.ByteString ClientIndex
    50     | BanClient NominalDiffTime B.ByteString ClientIndex
    51     | BanIP B.ByteString NominalDiffTime B.ByteString
    51     | BanIP B.ByteString NominalDiffTime B.ByteString
    52     | BanList
    52     | BanList
       
    53     | Unban B.ByteString
    53     | ChangeMaster
    54     | ChangeMaster
    54     | RemoveClientTeams ClientIndex
    55     | RemoveClientTeams ClientIndex
    55     | ModifyClient (ClientInfo -> ClientInfo)
    56     | ModifyClient (ClientInfo -> ClientInfo)
    56     | ModifyClient2 ClientIndex (ClientInfo -> ClientInfo)
    57     | ModifyClient2 ClientIndex (ClientInfo -> ClientInfo)
    57     | ModifyRoom (RoomInfo -> RoomInfo)
    58     | ModifyRoom (RoomInfo -> RoomInfo)
   480     ch <- client's sendChan
   481     ch <- client's sendChan
   481     bans <- gets (B.pack . unlines . map show . bans . serverInfo)
   482     bans <- gets (B.pack . unlines . map show . bans . serverInfo)
   482     processAction $
   483     processAction $
   483         AnswerClients [ch] ["BANLIST", bans]
   484         AnswerClients [ch] ["BANLIST", bans]
   484 
   485 
   485 
   486 processAction (Unban entry) = do
       
   487     processAction $ ModifyServerInfo (\s -> s{bans = filter f $ bans s})
       
   488     where
       
   489         f (BanByIP bip _ _) = bip == entry
       
   490         f (BanByNick bn _ _) = bn == entry
   486 
   491 
   487 processAction (KickRoomClient kickId) = do
   492 processAction (KickRoomClient kickId) = do
   488     modify (\s -> s{clientIndex = Just kickId})
   493     modify (\s -> s{clientIndex = Just kickId})
   489     ch <- client's sendChan
   494     ch <- client's sendChan
   490     mapM_ processAction [AnswerClients [ch] ["KICKED"], MoveToLobby "kicked"]
   495     mapM_ processAction [AnswerClients [ch] ["KICKED"], MoveToLobby "kicked"]