510 B.concat ["Ban for ", B.pack . show $ seconds, " (", reason, ")"] |
510 B.concat ["Ban for ", B.pack . show $ seconds, " (", reason, ")"] |
511 processAction $ |
511 processAction $ |
512 AddNick2Bans n msg (addUTCTime seconds currentTime) |
512 AddNick2Bans n msg (addUTCTime seconds currentTime) |
513 |
513 |
514 processAction BanList = do |
514 processAction BanList = do |
|
515 time <- io $ getCurrentTime |
515 ch <- client's sendChan |
516 ch <- client's sendChan |
516 b <- gets (B.pack . unlines . map show . bans . serverInfo) |
517 b <- gets (B.intercalate "\n" . concatMap (ban2Str time) . bans . serverInfo) |
517 processAction $ |
518 processAction $ |
518 AnswerClients [ch] ["BANLIST", b] |
519 AnswerClients [ch] ["BANLIST", b] |
|
520 where |
|
521 ban2Str time (BanByIP b r t) = ["I", b, r, B.pack . show $ t `diffUTCTime` time] |
|
522 ban2Str time (BanByNick b r t) = ["N", b, r, B.pack . show $ t `diffUTCTime` time] |
519 |
523 |
520 processAction (Unban entry) = do |
524 processAction (Unban entry) = do |
521 processAction $ ModifyServerInfo (\s -> s{bans = filter f $ bans s}) |
525 processAction $ ModifyServerInfo (\s -> s{bans = filter (not . f) $ bans s}) |
522 where |
526 where |
523 f (BanByIP bip _ _) = bip == entry |
527 f (BanByIP bip _ _) = bip == entry |
524 f (BanByNick bn _ _) = bn == entry |
528 f (BanByNick bn _ _) = bn == entry |
525 |
529 |
526 processAction (KickRoomClient kickId) = do |
530 processAction (KickRoomClient kickId) = do |