gameServer/Actions.hs
changeset 8154 0ea76ea45e6a
parent 7972 0dffb91eeb82
child 8155 0bccee1d31da
equal deleted inserted replaced
8153:e97e00427204 8154:0ea76ea45e6a
    50     | ByeClient B.ByteString
    50     | ByeClient B.ByteString
    51     | KickClient ClientIndex
    51     | KickClient ClientIndex
    52     | KickRoomClient ClientIndex
    52     | KickRoomClient ClientIndex
    53     | BanClient NominalDiffTime B.ByteString ClientIndex
    53     | BanClient NominalDiffTime B.ByteString ClientIndex
    54     | BanIP B.ByteString NominalDiffTime B.ByteString
    54     | BanIP B.ByteString NominalDiffTime B.ByteString
       
    55     | BanNick B.ByteString NominalDiffTime B.ByteString
    55     | BanList
    56     | BanList
    56     | Unban B.ByteString
    57     | Unban B.ByteString
    57     | ChangeMaster
    58     | ChangeMaster
    58     | RemoveClientTeams ClientIndex
    59     | RemoveClientTeams ClientIndex
    59     | ModifyClient (ClientInfo -> ClientInfo)
    60     | ModifyClient (ClientInfo -> ClientInfo)
   498     currentTime <- io getCurrentTime
   499     currentTime <- io getCurrentTime
   499     let msg = B.concat ["Ban for ", B.pack . show $ seconds, " (", reason, ")"]
   500     let msg = B.concat ["Ban for ", B.pack . show $ seconds, " (", reason, ")"]
   500     processAction $
   501     processAction $
   501         AddIP2Bans ip msg (addUTCTime seconds currentTime)
   502         AddIP2Bans ip msg (addUTCTime seconds currentTime)
   502 
   503 
       
   504 processAction (BanNick n seconds reason) = do
       
   505     currentTime <- io getCurrentTime
       
   506     let msg = 
       
   507             if seconds > 60 * 60 * 24 * 365 then
       
   508                 B.concat ["Permanent ban (", reason, ")"]
       
   509                 else
       
   510                 B.concat ["Ban for ", B.pack . show $ seconds, " (", reason, ")"]
       
   511     processAction $
       
   512         AddNick2Bans n msg (addUTCTime seconds currentTime)
       
   513 
   503 processAction BanList = do
   514 processAction BanList = do
   504     ch <- client's sendChan
   515     ch <- client's sendChan
   505     b <- gets (B.pack . unlines . map show . bans . serverInfo)
   516     b <- gets (B.pack . unlines . map show . bans . serverInfo)
   506     processAction $
   517     processAction $
   507         AnswerClients [ch] ["BANLIST", b]
   518         AnswerClients [ch] ["BANLIST", b]