mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
Partial fix for bug #877601, I'll do the rest in class.
This commit is contained in:
parent
38e8c33422
commit
8164f5bb1f
@ -329,6 +329,8 @@ class IrcObjectProxy(RichReplyMethods):
|
||||
log.debug('IrcObjectProxy.__init__: %s' % args)
|
||||
self.irc = irc
|
||||
self.msg = msg
|
||||
# The deepcopy here is necessary for Scheduler; it re-runs already
|
||||
# tokenized commands.
|
||||
self.args = copy.deepcopy(args)
|
||||
self.counter = 0
|
||||
self.to = None
|
||||
@ -374,6 +376,15 @@ class IrcObjectProxy(RichReplyMethods):
|
||||
'continuing to call other invalidCommands.' %
|
||||
cb.name())
|
||||
|
||||
def _callCommand(self, name, command, cb):
|
||||
try:
|
||||
cb.callCommand(command, self, self.msg, self.args)
|
||||
except (getopt.GetoptError, ArgumentError):
|
||||
self.reply(formatArgumentError(command, name=name))
|
||||
except CannotNest, e:
|
||||
if not isinstance(self.irc, irclib.Irc):
|
||||
self.error('Command %r cannot be nested.' % name)
|
||||
|
||||
def finalEval(self):
|
||||
assert not self.finalEvaled, 'finalEval called twice.'
|
||||
self.finalEvaled = True
|
||||
@ -410,6 +421,8 @@ class IrcObjectProxy(RichReplyMethods):
|
||||
if cb.name().lower() == name:
|
||||
break
|
||||
else:
|
||||
# This should've been caught earlier, that's why we
|
||||
# assert instead of raising a ValueError or something.
|
||||
assert False, 'Non-disambiguated command.'
|
||||
else:
|
||||
del self.args[0]
|
||||
@ -424,12 +437,7 @@ class IrcObjectProxy(RichReplyMethods):
|
||||
self, self.msg, self.args)
|
||||
t.start()
|
||||
else:
|
||||
cb.callCommand(command, self, self.msg, self.args)
|
||||
except (getopt.GetoptError, ArgumentError):
|
||||
self.reply(formatArgumentError(command, name=name))
|
||||
except CannotNest, e:
|
||||
if not isinstance(self.irc, irclib.Irc):
|
||||
self.error('Command %r cannot be nested.' % name)
|
||||
self._callCommand(name, command, cb)
|
||||
|
||||
def reply(self, s, noLengthCheck=False, prefixName=True,
|
||||
action=False, private=False, notice=False, to=None):
|
||||
|
Loading…
Reference in New Issue
Block a user