# HG changeset patch # User unc0rr # Date 1392845557 -14400 # Node ID a599593e1dc21e420d77f653245b5f350f6e6e89 # Parent 9a772dc5dfbe331b8d29ec85877aa621cf7bdb53 Don't rewrite server ini file too often diff -r 9a772dc5dfbe -r a599593e1dc2 gameServer/Actions.hs --- 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