Fixed bug in handling of outFilters returning None

This commit is contained in:
Jeremy Fincher 2003-03-27 20:59:05 +00:00
parent 954951e2d2
commit 41aa44ee78

View File

@ -278,11 +278,10 @@ class Irc(object):
for (i, cb) in enumerate(self.callbacks): for (i, cb) in enumerate(self.callbacks):
if cb.name() == name: if cb.name() == name:
toRemove.append(i) toRemove.append(i)
if toRemove: for i in reviter(range(len(self.callbacks))):
for i in reviter(range(len(self.callbacks))): if toRemove and toRemove[-1] == i:
if toRemove and toRemove[-1] == i: toRemove.pop()
toRemove.pop() ret.append(self.callbacks.pop(i))
ret.append(self.callbacks.pop(i))
return ret return ret
def queueMsg(self, msg): def queueMsg(self, msg):
@ -312,6 +311,10 @@ class Irc(object):
for callback in self.callbacks: for callback in self.callbacks:
#debug.printf(repr(msg)) #debug.printf(repr(msg))
msg = callback.outFilter(self, msg) msg = callback.outFilter(self, msg)
if msg is None:
s = 'outFilter %s returned None' % callbacks.name()
debug.debugMsg(s)
return None
self.state.addMsg(self,ircmsgs.IrcMsg(msg=msg, prefix=self.prefix)) self.state.addMsg(self,ircmsgs.IrcMsg(msg=msg, prefix=self.prefix))
s = '%s %s' % (time.strftime(conf.timestampFormat), msg) s = '%s %s' % (time.strftime(conf.timestampFormat), msg)
debug.debugMsg(s, 'low') debug.debugMsg(s, 'low')