diff --git a/plugins/BadWords.py b/plugins/BadWords.py index 4be6ce6b6..15712158b 100644 --- a/plugins/BadWords.py +++ b/plugins/BadWords.py @@ -80,6 +80,7 @@ def subber(m): return nastyChars[:len(m.group(1))] class BadWords(callbacks.Privmsg): + priority = 1 def __init__(self): callbacks.Privmsg.__init__(self) self.badwords = sets.Set() diff --git a/plugins/FunCommands.py b/plugins/FunCommands.py index 99f4ac89c..aef09f8b0 100644 --- a/plugins/FunCommands.py +++ b/plugins/FunCommands.py @@ -162,6 +162,7 @@ example = utils.wrapLines(""" """) class FunCommands(callbacks.Privmsg): + priority = 98 # Really just to test. dictServer = 'dict.org' def __init__(self): callbacks.Privmsg.__init__(self) diff --git a/src/irclib.py b/src/irclib.py index 52ff5c6af..f1994b866 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -66,6 +66,7 @@ class IrcCallback(IrcCommandDispatcher): "doCommand" -- doPrivmsg, doNick, do433, etc. These will be called on matching messages. """ + priority = 99 def name(self): return self.__class__.__name__ @@ -368,6 +369,7 @@ class Irc(object): def addCallback(self, callback): self.callbacks.append(callback) + utils.sortBy(lambda cb: cb.priority, self.callbacks) def getCallback(self, name): name = name.lower() @@ -409,7 +411,7 @@ class Irc(object): self.outstandingPing = True self.queueMsg(ircmsgs.ping(now)) if msg: - for callback in self.callbacks: + for callback in reviter(self.callbacks): #debug.printf(repr(msg)) try: outFilter = getattr(callback, 'outFilter')