From 56773baf96963d5a1fd76df38761a912bab3a592 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 1 Oct 2012 05:25:28 -0400 Subject: [PATCH] Queue-clearing on kick. --- irkerd | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/irkerd b/irkerd index 638c1cc..1b85e00 100755 --- a/irkerd +++ b/irkerd @@ -137,10 +137,18 @@ class Connection: def handle_disconnect(self): "Server disconnected us for flooding or some other reason." self.connection = None - def handle_kick(self, channel): + def handle_kick(self, outof): "We've been kicked." - self.channels_joined.remove(channel) - # FIXME: Clear messages for this channel from the queue. + self.status = "handshaking" + self.channels_joined.remove(outof) + qcopy = [] + while not self.queue.empty(): + (channel, message) = self.queue.get() + if channel != outof: + qcopy.append((channel, message)) + for (channel, message) in qcopy: + self.queue.put((channel, message)) + self.status = "ready" def enqueue(self, channel, message): "Enque a message for transmission." self.queue.put((channel, message)) -- 2.26.2