gameServer/Actions.hs
changeset 10148 a599593e1dc2
parent 10095 003fc694c0c3
child 10195 d1c23bb73346
--- a/gameServer/Actions.hs	Thu Feb 20 00:28:49 2014 +0400
+++ b/gameServer/Actions.hs	Thu Feb 20 01:32:37 2014 +0400
@@ -608,11 +608,11 @@
     clNick <- client's nick
     clHost <- client's host
     si <- gets serverInfo
-    let validBans = filter (checkNotExpired clTime) $ bans si
+    let (validBans, expiredBans) = L.partition (checkNotExpired clTime) $ bans si
     let ban = L.find (checkBan byIP clHost clNick) $ validBans
     mapM_ processAction $
-        ModifyServerInfo (\s -> s{bans = validBans})
-        : [ByeClient (getBanReason $ fromJust ban) | isJust ban]
+        [ModifyServerInfo (\s -> s{bans = validBans}) | not $ null expiredBans]
+        ++ [ByeClient (getBanReason $ fromJust ban) | isJust ban]
     where
         checkNotExpired testTime (BanByIP _ _ time) = testTime `diffUTCTime` time <= 0
         checkNotExpired testTime (BanByNick _ _ time) = testTime `diffUTCTime` time <= 0