gameServer/Actions.hs
changeset 14690 669eb45bda72
parent 14689 bc267f6b29d7
child 14907 2dcc64515346
equal deleted inserted replaced
14689:bc267f6b29d7 14690:669eb45bda72
   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 = case B.uncons rexp of 
   671         isMatch rexp src = (==) (Just True) $ mrexp rexp >>= flip matchM src
   672             Nothing -> False
       
   673             Just ('^', rexp') -> (==) (Just True) $ mrexp rexp' >>= flip matchM src
       
   674             Just _ -> rexp == src
       
   675         mrexp :: B.ByteString -> Maybe TDFAB.Regex
   672         mrexp :: B.ByteString -> Maybe TDFAB.Regex
   676         mrexp = makeRegexOptsM TDFA.defaultCompOpt{TDFA.caseSensitive = False} TDFA.defaultExecOpt
   673         mrexp = makeRegexOptsM TDFA.defaultCompOpt{TDFA.caseSensitive = False} TDFA.defaultExecOpt
   677         getBanReason (BanByIP _ msg _) = msg
   674         getBanReason (BanByIP _ msg _) = msg
   678         getBanReason (BanByNick _ msg _) = msg
   675         getBanReason (BanByNick _ msg _) = msg
   679 
   676