mirror of https://github.com/Mikaela/Limnoria.git
Fixed bug with commandsOnStart not being called unless they were already canonical names.
This commit is contained in:
parent
8d9eb27a2f
commit
094bdee30b
|
@ -640,7 +640,7 @@ class Privmsg(irclib.IrcCallback):
|
||||||
fakeIrc = ConfigIrcProxy(irc)
|
fakeIrc = ConfigIrcProxy(irc)
|
||||||
for args in conf.commandsOnStart:
|
for args in conf.commandsOnStart:
|
||||||
args = args[:]
|
args = args[:]
|
||||||
command = args.pop(0)
|
command = canonicalName(args.pop(0))
|
||||||
if self.isCommand(command):
|
if self.isCommand(command):
|
||||||
#debug.printf('%s: %r' % (command, args))
|
#debug.printf('%s: %r' % (command, args))
|
||||||
method = getattr(self, command)
|
method = getattr(self, command)
|
||||||
|
|
|
@ -260,6 +260,17 @@ class PrivmsgTestCase(ChannelPluginTestCase):
|
||||||
self.assertError('first blah')
|
self.assertError('first blah')
|
||||||
self.assertResponse('third foo bar baz', 'foo bar baz')
|
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):
|
class PrivmsgCommandAndRegexpTestCase(PluginTestCase):
|
||||||
plugins = ('Utilities',) # Gotta put something.
|
plugins = ('Utilities',) # Gotta put something.
|
||||||
|
@ -269,7 +280,7 @@ class PrivmsgCommandAndRegexpTestCase(PluginTestCase):
|
||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
def testNoEscapingArgumentError(self):
|
def testNoEscapingArgumentError(self):
|
||||||
self.irc.addCallback(self.PCAR())
|
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:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
|
Loading…
Reference in New Issue