Added priority stuff for RFE #799899

This commit is contained in:
Jeremy Fincher 2003-09-05 19:28:04 +00:00
parent 0f843dd651
commit 0719bdec92
3 changed files with 5 additions and 1 deletions

View File

@ -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()

View File

@ -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)

View File

@ -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')