We should return whether or not we were able to queue the message.

This commit is contained in:
Jeremy Fincher 2004-09-28 07:17:53 +00:00
parent 3dec784447
commit e616f6973d

View File

@ -173,6 +173,7 @@ class IrcMsgQueue(object):
not conf.supybot.protocols.irc.queueDuplicateMessages(): not conf.supybot.protocols.irc.queueDuplicateMessages():
s = str(msg).strip() s = str(msg).strip()
log.warning('Not adding message %r to queue, already added.', s) log.warning('Not adding message %r to queue, already added.', s)
return False
else: else:
self.msgs.add(msg) self.msgs.add(msg)
if msg.command in _high: if msg.command in _high:
@ -181,6 +182,7 @@ class IrcMsgQueue(object):
self.lowpriority.enqueue(msg) self.lowpriority.enqueue(msg)
else: else:
self.normal.enqueue(msg) self.normal.enqueue(msg)
return True
def dequeue(self): def dequeue(self):
"""Dequeues a given message.""" """Dequeues a given message."""
@ -659,9 +661,10 @@ class Irc(IrcCommandDispatcher):
def queueMsg(self, msg): def queueMsg(self, msg):
"""Queues a message to be sent to the server.""" """Queues a message to be sent to the server."""
if not self.zombie: if not self.zombie:
self.queue.enqueue(msg) return self.queue.enqueue(msg)
else: else:
log.warning('Refusing to queue %r; %s is a zombie.', self, msg) log.warning('Refusing to queue %r; %s is a zombie.', self, msg)
return False
def sendMsg(self, msg): def sendMsg(self, msg):
"""Queues a message to be sent to the server *immediately*""" """Queues a message to be sent to the server *immediately*"""