Fixed bug with commandsOnStart not being called unless they were already canonical names.

This commit is contained in:
Jeremy Fincher 2003-10-24 18:53:34 +00:00
parent 8d9eb27a2f
commit 094bdee30b
2 changed files with 13 additions and 2 deletions

View File

@ -640,7 +640,7 @@ class Privmsg(irclib.IrcCallback):
fakeIrc = ConfigIrcProxy(irc)
for args in conf.commandsOnStart:
args = args[:]
command = args.pop(0)
command = canonicalName(args.pop(0))
if self.isCommand(command):
#debug.printf('%s: %r' % (command, args))
method = getattr(self, command)

View File

@ -260,6 +260,17 @@ class PrivmsgTestCase(ChannelPluginTestCase):
self.assertError('first blah')
self.assertResponse('third foo bar baz', 'foo bar baz')
def testConfigureHandlesNonCanonicalCommands(self):
try:
original = conf.commandsOnStart
tokens = callbacks.tokenize('Admin setprefixchar $')
conf.commandsOnStart = [tokens]
self.assertNotError('load Admin')
self.assertEqual(conf.prefixChars, '$')
finally:
conf.commandsOnStart = original
class PrivmsgCommandAndRegexpTestCase(PluginTestCase):
plugins = ('Utilities',) # Gotta put something.
@ -269,7 +280,7 @@ class PrivmsgCommandAndRegexpTestCase(PluginTestCase):
raise callbacks.ArgumentError
def testNoEscapingArgumentError(self):
self.irc.addCallback(self.PCAR())
self.assertResponse('test', 'test <foo>')
self.assertResponse('test', 'PCAR test <foo>')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: