gameServer/Actions.hs
changeset 14684 bc267f6b29d7
parent 14380 8ad85859dd3f
child 14685 669eb45bda72
equal deleted inserted replaced
14683:932ff7683653 14684:bc267f6b29d7
   666         checkNotExpired testTime (BanByNick _ _ time) = testTime `diffUTCTime` time <= 0
   666         checkNotExpired testTime (BanByNick _ _ time) = testTime `diffUTCTime` time <= 0
   667         checkBan True ip _ (BanByIP bip _ _) = isMatch bip ip
   667         checkBan True ip _ (BanByIP bip _ _) = isMatch bip ip
   668         checkBan False _ n (BanByNick bn _ _) = isMatch bn n
   668         checkBan False _ n (BanByNick bn _ _) = isMatch bn n
   669         checkBan _ _ _ _ = False
   669         checkBan _ _ _ _ = False
   670         isMatch :: B.ByteString -> B.ByteString -> Bool
   670         isMatch :: B.ByteString -> B.ByteString -> Bool
   671         isMatch rexp src = (==) (Just True) $ mrexp rexp >>= flip matchM src
   671         isMatch rexp src = case B.uncons rexp of 
       
   672             Nothing -> False
       
   673             Just ('^', rexp') -> (==) (Just True) $ mrexp rexp' >>= flip matchM src
       
   674             Just _ -> rexp == src
   672         mrexp :: B.ByteString -> Maybe TDFAB.Regex
   675         mrexp :: B.ByteString -> Maybe TDFAB.Regex
   673         mrexp = makeRegexOptsM TDFA.defaultCompOpt{TDFA.caseSensitive = False} TDFA.defaultExecOpt
   676         mrexp = makeRegexOptsM TDFA.defaultCompOpt{TDFA.caseSensitive = False} TDFA.defaultExecOpt
   674         getBanReason (BanByIP _ msg _) = msg
   677         getBanReason (BanByIP _ msg _) = msg
   675         getBanReason (BanByNick _ msg _) = msg
   678         getBanReason (BanByNick _ msg _) = msg
   676 
   679