# HG changeset patch # User unc0rr # Date 1296674350 -10800 # Node ID dc6482438674b79b4f215e272338217ae8eb6560 # Parent 99d6797b7ff48b8377b4362fae904ba4e46b6389 - Implement BAN protocol command - Make BanClient handler call KickClient diff -r 99d6797b7ff4 -r dc6482438674 gameServer/Actions.hs --- a/gameServer/Actions.hs Wed Feb 02 22:14:00 2011 +0300 +++ b/gameServer/Actions.hs Wed Feb 02 22:19:10 2011 +0300 @@ -366,7 +366,10 @@ clHost <- client's host currentTime <- io $ getCurrentTime let msg = "Ban for " `B.append` (B.pack . show $ seconds) `B.append` "seconds (" `B.append` msg` B.append` ")" - processAction $ ModifyServerInfo (\s -> s{lastLogins = (clHost, (addUTCTime seconds $ currentTime, msg)) : lastLogins s}) + mapM_ processAction [ + ModifyServerInfo (\s -> s{lastLogins = (clHost, (addUTCTime seconds $ currentTime, msg)) : lastLogins s}) + , KickClient banId + ] processAction (KickRoomClient kickId) = do diff -r 99d6797b7ff4 -r dc6482438674 gameServer/HWProtoLobbyState.hs --- a/gameServer/HWProtoLobbyState.hs Wed Feb 02 22:14:00 2011 +0300 +++ b/gameServer/HWProtoLobbyState.hs Wed Feb 02 22:19:10 2011 +0300 @@ -139,15 +139,12 @@ 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 - [] - else - BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick] - where - client = clients IntMap.! clID - -} + +handleCmd_lobby ["BAN", banNick, reason] = do + (ci, _) <- ask + cl <- thisClient + banId <- clientByNick banNick + return [BanClient 60 reason (fromJust banId) | isAdministrator cl && isJust banId && fromJust banId /= ci] handleCmd_lobby ["SET_SERVER_VAR", "MOTD_NEW", newMessage] = do