From 8c93488146abec7d68d1b1e7dff5dbd6a29702c1 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 31 Oct 2003 18:18:04 +0000 Subject: [PATCH] Fixed Bug #833786 (spurious brackets not handled correctly). --- src/Owner.py | 11 +++++++++-- test/test_callbacks.py | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Owner.py b/src/Owner.py index 3c3fbb0e5..6f2bc6c37 100644 --- a/src/Owner.py +++ b/src/Owner.py @@ -85,7 +85,10 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): def __init__(self): callbacks.Privmsg.__init__(self) setattr(self.__class__, 'exec', self.__class__._exec) - self.defaultPlugins = {'join', 'admin'} + self.defaultPlugins = {'join': 'admin', + 'load': 'owner', + 'reload': 'owner', + 'unload': 'owner'} def _disambiguate(self, tokens): if tokens: @@ -100,7 +103,11 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): callbacks.Privmsg.handled = False s = callbacks.addressed(irc.nick, msg) if s: - tokens = callbacks.tokenize(s) + try: + tokens = callbacks.tokenize(s) + except SyntaxError, e: + irc.queueMsg(callbacks.error(msg, str(e))) + return self._disambiguate(tokens) ambiguousCommands = {} commands = callbacks.getCommands(tokens) diff --git a/test/test_callbacks.py b/test/test_callbacks.py index b832a0213..8e1ef3e40 100644 --- a/test/test_callbacks.py +++ b/test/test_callbacks.py @@ -296,7 +296,10 @@ class PrivmsgTestCase(ChannelPluginTestCase): self.assertEqual(conf.prefixChars, '$') finally: conf.commandsOnStart = original - + + def testSyntaxErrorNotEscaping(self): + self.assertError('load [foo') + self.assertError('load foo]') class PrivmsgCommandAndRegexpTestCase(PluginTestCase):