Fixed the user list problem mo betta.

This commit is contained in:
Jeremy Fincher 2004-08-16 13:22:08 +00:00
parent 1a6754a307
commit 7b2cbd950f
2 changed files with 8 additions and 9 deletions

View File

@ -261,7 +261,10 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
names = [cb.name() for cb in cbs] names = [cb.name() for cb in cbs]
srcs = [name for name in names if name in self._srcPlugins] srcs = [name for name in names if name in self._srcPlugins]
if len(srcs) == 1: if len(srcs) == 1:
tokens.insert(0, srcs[0]) if callbacks.canonicalName(name) != command:
# We don't insert the dispatcher name here because
# it's handled later. Man, this stuff is a mess.
tokens.insert(0, srcs[0])
elif command not in map(callbacks.canonicalName, names): elif command not in map(callbacks.canonicalName, names):
ambiguousCommands[command] = names ambiguousCommands[command] = names
for elt in tokens: for elt in tokens:

View File

@ -510,8 +510,7 @@ 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), e: except (getopt.GetoptError, ArgumentError):
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):
@ -534,7 +533,6 @@ 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:
@ -557,10 +555,7 @@ 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]
@ -841,7 +836,6 @@ 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)
@ -850,7 +844,9 @@ 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 self.isCommand(name): if name == canonicalName(self.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)