mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +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)
|
log.debug('IrcObjectProxy.__init__: %s' % args)
|
||||||
self.irc = irc
|
self.irc = irc
|
||||||
self.msg = msg
|
self.msg = msg
|
||||||
|
# The deepcopy here is necessary for Scheduler; it re-runs already
|
||||||
|
# tokenized commands.
|
||||||
self.args = copy.deepcopy(args)
|
self.args = copy.deepcopy(args)
|
||||||
self.counter = 0
|
self.counter = 0
|
||||||
self.to = None
|
self.to = None
|
||||||
@ -374,6 +376,15 @@ class IrcObjectProxy(RichReplyMethods):
|
|||||||
'continuing to call other invalidCommands.' %
|
'continuing to call other invalidCommands.' %
|
||||||
cb.name())
|
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):
|
def finalEval(self):
|
||||||
assert not self.finalEvaled, 'finalEval called twice.'
|
assert not self.finalEvaled, 'finalEval called twice.'
|
||||||
self.finalEvaled = True
|
self.finalEvaled = True
|
||||||
@ -410,6 +421,8 @@ class IrcObjectProxy(RichReplyMethods):
|
|||||||
if cb.name().lower() == name:
|
if cb.name().lower() == name:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
# This should've been caught earlier, that's why we
|
||||||
|
# assert instead of raising a ValueError or something.
|
||||||
assert False, 'Non-disambiguated command.'
|
assert False, 'Non-disambiguated command.'
|
||||||
else:
|
else:
|
||||||
del self.args[0]
|
del self.args[0]
|
||||||
@ -424,12 +437,7 @@ class IrcObjectProxy(RichReplyMethods):
|
|||||||
self, self.msg, self.args)
|
self, self.msg, self.args)
|
||||||
t.start()
|
t.start()
|
||||||
else:
|
else:
|
||||||
cb.callCommand(command, self, self.msg, self.args)
|
self._callCommand(name, command, cb)
|
||||||
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 reply(self, s, noLengthCheck=False, prefixName=True,
|
def reply(self, s, noLengthCheck=False, prefixName=True,
|
||||||
action=False, private=False, notice=False, to=None):
|
action=False, private=False, notice=False, to=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user