Made enable case-insensitive.

This commit is contained in:
Jeremy Fincher 2004-02-08 23:54:01 +00:00
parent 72adc73330
commit da209e5a36
2 changed files with 14 additions and 7 deletions

View File

@ -226,13 +226,16 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
Re-enables the command <command> for all non-owner users.
"""
command = privmsgs.getArgs(args)
try:
anticapability = ircdb.makeAntiCapability(command)
except ValueError:
irc.error('%r is not a valid command.' % command)
return
if anticapability in conf.supybot.defaultCapabilities():
conf.supybot.defaultCapabilities().remove(anticapability)
command = command.lower()
L = []
for capability in conf.supybot.defaultCapabilities():
if ircdb.isAntiCapability(capability):
nonAntiCapability = ircdb.unAntiCapability(capability)
if nonAntiCapability.lower() == command:
L.append(capability)
if L:
for capability in L:
conf.supybot.defaultCapabilities().remove(capability)
irc.replySuccess()
else:
irc.error('That command wasn\'t disabled.')

View File

@ -75,6 +75,10 @@ class AdminTestCase(PluginTestCase, PluginDocumentation):
def testEnable(self):
self.assertError('enable enable')
def testEnableIsCaseInsensitive(self):
self.assertNotError('disable Foo')
self.assertNotError('enable foo')
def testJoin(self):
m = self.getMsg('join #foo')
self.assertEqual(m.command, 'JOIN')