diff --git a/plugins/Alias.py b/plugins/Alias.py index b7f345d9b..ca369fed6 100644 --- a/plugins/Alias.py +++ b/plugins/Alias.py @@ -144,6 +144,8 @@ def makeNewAlias(name, alias): return True return False everythingReplace(tokens) + Owner = irc.getCallback('Owner') + Owner.disambiguate(irc, tokens) self.Proxy(irc.irc, msg, tokens) f = types.FunctionType(f.func_code, f.func_globals, name, closure=f.func_closure) diff --git a/src/Owner.py b/src/Owner.py index ec455104b..974696556 100644 --- a/src/Owner.py +++ b/src/Owner.py @@ -88,7 +88,9 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): setattr(self.__class__, 'exec', self.__class__._exec) self.defaultPlugins = {} - def _disambiguate(self, irc, tokens, ambiguousCommands): + def disambiguate(self, irc, tokens, ambiguousCommands=None): + if ambiguousCommands is None: + ambiguousCommands = {} if tokens: command = callbacks.canonicalName(tokens[0]) if command in self.defaultPlugins: @@ -104,7 +106,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): ambiguousCommands[command] = names for elt in tokens: if isinstance(elt, list): - self._disambiguate(irc, elt, ambiguousCommands) + self.disambiguate(irc, elt, ambiguousCommands) def doPrivmsg(self, irc, msg): callbacks.Privmsg.handled = False @@ -118,7 +120,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): irc.queueMsg(callbacks.error(msg, str(e))) return ambiguousCommands = {} - self._disambiguate(irc, tokens, ambiguousCommands) + self.disambiguate(irc, tokens, ambiguousCommands) if ambiguousCommands: if len(ambiguousCommands) == 1: # Common case. (command, names) = ambiguousCommands.popitem() diff --git a/src/callbacks.py b/src/callbacks.py index 99394b697..f4cf3dd8d 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -231,7 +231,7 @@ def tokenize(s): _lastTokenized = None _lastTokenizedResult = None raise SyntaxError, str(e) - #debug.msg('tokenize took %s seconds.' % (time.time() - start), 'verbose') + debug.msg('tokenize took %s seconds.' % (time.time() - start), 'verbose') return copy.deepcopy(_lastTokenizeResult) def getCommands(tokens): @@ -328,7 +328,8 @@ class IrcObjectProxy: self._callInvalidCommands() else: try: - assert len(cbs) == 1 + assert len(cbs) == 1, \ + 'Got command that wasn\'t disambiguated: %s' % name del self.args[0] cb = cbs[0] anticap = ircdb.makeAntiCapability(name)