Fixed the user list problem.

This commit is contained in:
Jeremy Fincher 2004-08-16 01:29:22 +00:00
parent 60a0810b97
commit e7aa2efcfd

View File

@ -510,7 +510,8 @@ class IrcObjectProxy(RichReplyMethods):
self.commandMethod = command self.commandMethod = command
try: try:
cb.callCommand(command, self, self.msg, self.args) cb.callCommand(command, self, self.msg, self.args)
except (getopt.GetoptError, ArgumentError): except (getopt.GetoptError, ArgumentError), e:
self.log.debug('ArgumentError: %s', utils.exnToString(e))
self.reply(formatArgumentError(command, name=name)) self.reply(formatArgumentError(command, name=name))
except CannotNest, e: except CannotNest, e:
if not isinstance(self.irc, irclib.Irc): if not isinstance(self.irc, irclib.Irc):
@ -533,6 +534,7 @@ class IrcObjectProxy(RichReplyMethods):
name = canonicalName(self.args[0]) name = canonicalName(self.args[0])
cbs = findCallbackForCommand(self, name) cbs = findCallbackForCommand(self, name)
if len(cbs) == 0: if len(cbs) == 0:
# No callbacks have the command. So we do our invalidCommand stuff.
for cb in self.irc.callbacks: for cb in self.irc.callbacks:
if isinstance(cb, PrivmsgRegexp): if isinstance(cb, PrivmsgRegexp):
for (r, m) in cb.res: for (r, m) in cb.res:
@ -555,7 +557,10 @@ class IrcObjectProxy(RichReplyMethods):
# Ok, no regexp-based things matched. # Ok, no regexp-based things matched.
self._callInvalidCommands() self._callInvalidCommands()
else: else:
# At least one callback had the command.
if len(cbs) > 1: if len(cbs) > 1:
# Let's first see if there are any callbacks with the same name
# as the command; they get priority.
for cb in cbs: for cb in cbs:
if canonicalName(cb.name()) == name: if canonicalName(cb.name()) == name:
del self.args[0] del self.args[0]
@ -836,6 +841,7 @@ class Privmsg(irclib.IrcCallback):
given command, use this command to tell the bot which plugin's command given command, use this command to tell the bot which plugin's command
to use.""" % (myName, myName, myName) to use.""" % (myName, myName, myName)
def dispatcher(self, irc, msg, args): def dispatcher(self, irc, msg, args):
self.log.debug('Dispatcher called with args: %s.', args)
def handleBadArgs(): def handleBadArgs():
if self._original: if self._original:
self._original(irc, msg, args) self._original(irc, msg, args)
@ -844,9 +850,7 @@ class Privmsg(irclib.IrcCallback):
cb.help(irc, msg, [self.name()]) cb.help(irc, msg, [self.name()])
if args: if args:
name = canonicalName(args[0]) name = canonicalName(args[0])
if name == canonicalName(self.name()): if self.isCommand(name):
handleBadArgs()
elif self.isCommand(name):
cap = checkCommandCapability(msg, self, name) cap = checkCommandCapability(msg, self, name)
if cap: if cap:
irc.errorNoCapability(cap) irc.errorNoCapability(cap)