# HG changeset patch # User unc0rr # Date 1352314938 -14400 # Node ID 8113afd3858f1164cc5a08bb3a789dca5f54e9ae # Parent cd007c1780e712a7b80a0275e1ad2871418cd63c More strictness on room bans diff -r cd007c1780e7 -r 8113afd3858f gameServer/CoreTypes.hs --- a/gameServer/CoreTypes.hs Wed Nov 07 13:24:01 2012 -0500 +++ b/gameServer/CoreTypes.hs Wed Nov 07 23:02:18 2012 +0400 @@ -100,7 +100,7 @@ readyPlayers :: !Int, isRestrictedJoins :: Bool, isRestrictedTeams :: Bool, - roomBansList :: [B.ByteString], + roomBansList :: ![B.ByteString], mapParams :: Map.Map B.ByteString B.ByteString, params :: Map.Map B.ByteString [B.ByteString] } diff -r cd007c1780e7 -r 8113afd3858f gameServer/HWProtoInRoomState.hs --- a/gameServer/HWProtoInRoomState.hs Wed Nov 07 13:24:01 2012 -0500 +++ b/gameServer/HWProtoInRoomState.hs Wed Nov 07 23:02:18 2012 +0400 @@ -8,6 +8,7 @@ import qualified Data.ByteString.Char8 as B import Control.Monad import Control.Monad.Reader +import Control.DeepSeq -------------------------------------- import CoreTypes import Actions @@ -300,11 +301,18 @@ engineMsg cl = toEngineMsg $ B.concat ["b", nick cl, "(team): ", msg, "\x20\x20"] handleCmd_inRoom ["BAN", banNick] = do - (_, rnc) <- ask + (thisClientId, rnc) <- ask maybeClientId <- clientByNick banNick + master <- liftM isMaster thisClient let banId = fromJust maybeClientId - master <- liftM isMaster thisClient - return [ModifyRoom (\r -> r{roomBansList = (host $ rnc `client` banId) : roomBansList r}) | master && isJust maybeClientId] + let sameRoom = clientRoom rnc thisClientId == clientRoom rnc banId + if master && isJust maybeClientId && (banId /= thisClientId) && sameRoom then + return [ + ModifyRoom (\r -> r{roomBansList = let h = host $ rnc `client` banId in h `deepseq` h : roomBansList r}) + , KickRoomClient banId + ] + else + return [] handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17)