From c8e4b1f6bb9a14d05ebed4eaf762f7cda9f47cb5 Mon Sep 17 00:00:00 2001 From: jcao219 Date: Sun, 7 Aug 2011 23:36:49 -0500 Subject: [PATCH] make cloak matching case-insensitive on all operating systems --- decorators.py | 8 ++++---- wolfgame.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/decorators.py b/decorators.py index ef564bd..08c6e79 100644 --- a/decorators.py +++ b/decorators.py @@ -29,26 +29,26 @@ def generate(fdict, permissions=True, **kwargs): return f(*largs) if cloak: for pattern in botconfig.DENY.keys(): - if fnmatch.fnmatch(cloak, pattern): + if fnmatch.fnmatch(cloak.lower(), pattern.lower()): for cmdname in s: if cmdname in botconfig.DENY[pattern]: largs[0].notice(largs[1], "You do not have permission to use that command.") return for pattern in botconfig.ALLOW.keys(): - if fnmatch.fnmatch(cloak, pattern): + if fnmatch.fnmatch(cloak.lower(), pattern.lower()): for cmdname in s: if cmdname in botconfig.ALLOW[pattern]: return f(*largs) # no questions if owner_only: if cloak and [ptn for ptn in botconfig.OWNERS - if fnmatch.fnmatch(cloak, ptn)]: + if fnmatch.fnmatch(cloak.lower(), ptn.lower())]: return f(*largs) elif cloak: largs[0].notice(largs[1], "You are not the owner.") return if admin_only: if cloak and [ptn for ptn in botconfig.ADMINS+botconfig.OWNERS - if fnmatch.fnmatch(cloak, ptn)]: + if fnmatch.fnmatch(cloak.lower(), ptn.lower())]: return f(*largs) elif cloak: largs[0].notice(largs[1], "You are not an admin.") diff --git a/wolfgame.py b/wolfgame.py index ae18375..92195bd 100644 --- a/wolfgame.py +++ b/wolfgame.py @@ -2115,7 +2115,7 @@ def on_invite(cli, nick, something, chan): def is_admin(cloak): - return bool([ptn for ptn in botconfig.OWNERS+botconfig.ADMINS if fnmatch.fnmatch(cloak, ptn)]) + return bool([ptn for ptn in botconfig.OWNERS+botconfig.ADMINS if fnmatch.fnmatch(cloak.lower(), ptn.lower())]) @cmd("admins")