use literal bans by default
authoralfadur
Tue, 05 Feb 2019 22:40:35 +0300
changeset 14705 bc267f6b29d7
parent 14704 932ff7683653
child 14706 669eb45bda72
use literal bans by default
gameServer/Actions.hs
--- a/gameServer/Actions.hs	Tue Feb 05 17:46:43 2019 +0300
+++ b/gameServer/Actions.hs	Tue Feb 05 22:40:35 2019 +0300
@@ -668,7 +668,10 @@
         checkBan False _ n (BanByNick bn _ _) = isMatch bn n
         checkBan _ _ _ _ = False
         isMatch :: B.ByteString -> B.ByteString -> Bool
-        isMatch rexp src = (==) (Just True) $ mrexp rexp >>= flip matchM src
+        isMatch rexp src = case B.uncons rexp of 
+            Nothing -> False
+            Just ('^', rexp') -> (==) (Just True) $ mrexp rexp' >>= flip matchM src
+            Just _ -> rexp == src
         mrexp :: B.ByteString -> Maybe TDFAB.Regex
         mrexp = makeRegexOptsM TDFA.defaultCompOpt{TDFA.caseSensitive = False} TDFA.defaultExecOpt
         getBanReason (BanByIP _ msg _) = msg