gameServer/FloodDetection.hs
changeset 11466 4b5c7a5c49fd
parent 11046 47a8c19ecb60
child 14841 111c4d750c6d
equal deleted inserted replaced
11465:0ae2e4c13bd1 11466:4b5c7a5c49fd
    47     boundaries RoomJoin = (2, (10, 2), (35, 3), (join1, join2))
    47     boundaries RoomJoin = (2, (10, 2), (35, 3), (join1, join2))
    48 
    48 
    49     chat1 = [Warning $ loc "Warning! Chat flood protection activated"]
    49     chat1 = [Warning $ loc "Warning! Chat flood protection activated"]
    50     chat2 = [ByeClient $ loc "Excess flood"]
    50     chat2 = [ByeClient $ loc "Excess flood"]
    51     em1 = [Warning $ loc "Game messages flood detected - 1"]
    51     em1 = [Warning $ loc "Game messages flood detected - 1"]
    52     em2 = [Warning $ loc "Game messages flood detected - 2"]
    52     em2 = [ByeClient $ loc "Excess flood"]
    53     join1 = [Warning $ loc "Warning! Joins flood protection activated"]
    53     join1 = [Warning $ loc "Warning! Joins flood protection activated"]
    54     join2 = [ByeClient $ loc "Excess flood"]
    54     join2 = [ByeClient $ loc "Excess flood"]
    55 
    55 
    56     doCheck ei = do
    56     doCheck ei = do
    57         curTime <- io getCurrentTime
    57         curTime <- io getCurrentTime
    67                 if l1 >= num1 || l2 >= num2 then 
    67                 if l1 >= num1 || l2 >= num2 then 
    68                     ac1
    68                     ac1
    69                     else
    69                     else
    70                     []
    70                     []
    71 
    71 
    72         return $ (ModifyClient . transformField e . const $ (numPerEntry, curTime) : nei) : actions
    72         return $ [ModifyClient . transformField e . const $ (numPerEntry, curTime) : nei
       
    73                 , ModifyClient (\c -> c{pendingActions = actions}) -- append? prepend? just replacing for now
       
    74             ]
    73 
    75 
    74     updateInfo = return [
    76     updateInfo = return [
    75         ModifyClient $ transformField e
    77         ModifyClient $ transformField e
    76             $ \(h:hs) -> first (flip (-) 1) h : hs
    78             $ \(h:hs) -> first (flip (-) 1) h : hs
    77         ]
    79         ]