# HG changeset patch # User unc0rr # Date 1350072466 -14400 # Node ID f160fbc139b1b13e83fc315f3f612d5778e3f436 # Parent 8df97e271e5ef59b0b5d9043eb018ececf16ba2a UNBAN implementation diff -r 8df97e271e5e -r f160fbc139b1 gameServer/Actions.hs --- a/gameServer/Actions.hs Fri Oct 12 11:02:43 2012 +0200 +++ b/gameServer/Actions.hs Sat Oct 13 00:07:46 2012 +0400 @@ -50,6 +50,7 @@ | BanClient NominalDiffTime B.ByteString ClientIndex | BanIP B.ByteString NominalDiffTime B.ByteString | BanList + | Unban B.ByteString | ChangeMaster | RemoveClientTeams ClientIndex | ModifyClient (ClientInfo -> ClientInfo) @@ -482,7 +483,11 @@ processAction $ AnswerClients [ch] ["BANLIST", bans] - +processAction (Unban entry) = do + processAction $ ModifyServerInfo (\s -> s{bans = filter f $ bans s}) + where + f (BanByIP bip _ _) = bip == entry + f (BanByNick bn _ _) = bn == entry processAction (KickRoomClient kickId) = do modify (\s -> s{clientIndex = Just kickId}) diff -r 8df97e271e5e -r f160fbc139b1 gameServer/HWProtoLobbyState.hs --- a/gameServer/HWProtoLobbyState.hs Fri Oct 12 11:02:43 2012 +0200 +++ b/gameServer/HWProtoLobbyState.hs Sat Oct 13 00:07:46 2012 +0400 @@ -166,6 +166,12 @@ return [BanList | isAdministrator cl] +handleCmd_lobby ["UNBAN", entry] = do + (ci, _) <- ask + cl <- thisClient + return [Unban entry | isAdministrator cl] + + handleCmd_lobby ["SET_SERVER_VAR", "MOTD_NEW", newMessage] = do cl <- thisClient return [ModifyServerInfo (\si -> si{serverMessage = newMessage}) | isAdministrator cl]