From 6dca55deeb15b156f292a79d58de5009555b2d8d Mon Sep 17 00:00:00 2001 From: Daniel Folkinshteyn Date: Sun, 13 Mar 2011 14:21:46 -0400 Subject: [PATCH] Services: fix problem with some channels being mixed up between networks on startup, when noJoinsUntilIdentified is true. When noJoinsUntilIdentified config is true, the bot holds join messages in a 'waitingJoins' list, and processes them once nickserv identification comes through. The problem was that when the bot is configured to join multiple networks, join messages from different networks would get appended to the same list, without any differentiation by which message belongs to which network. Thus, if there are messages waiting for multiple networks, it would often be the case that whichever network got identification done first, would 'pick up' other network's join messages. This fix stores the network name along with the join messages in the list, and has each network pick out only its own join messages. --- plugins/Services/plugin.py | 11 +++++++---- src/version.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/Services/plugin.py b/plugins/Services/plugin.py index 1acd35626..09f197d06 100644 --- a/plugins/Services/plugin.py +++ b/plugins/Services/plugin.py @@ -30,6 +30,7 @@ import re import time +import copy import config @@ -78,7 +79,7 @@ class Services(callbacks.Plugin): if self.registryValue('noJoinsUntilIdentified'): self.log.info('Holding JOIN to %s until identified.', msg.args[0]) - self.waitingJoins.append(msg) + self.waitingJoins.append((irc.network, msg,)) return None return msg @@ -316,9 +317,11 @@ class Services(callbacks.Plugin): for channel in self.channels: irc.queueMsg(networkGroup.channels.join(channel)) if self.waitingJoins: - for m in self.waitingJoins: - irc.sendMsg(m) - self.waitingJoins = [] + tmp_wj = copy.deepcopy(self.waitingJoins) # can't iterate over list if we're modifying it + for netname, m in tmp_wj: + if netname == irc.network: + irc.sendMsg(m) + self.waitingJoins.remove((netname, m,)) elif 'not yet authenticated' in s: # zirc.org has this, it requires an auth code. email = s.split()[-1] diff --git a/src/version.py b/src/version.py index 3a9278f01..9c662f635 100644 --- a/src/version.py +++ b/src/version.py @@ -1,3 +1,3 @@ """stick the various versioning attributes in here, so we only have to change them once.""" -version = '0.83.4.1+limnoria (2011-08-10T11:48:07+0200)' +version = '0.83.4.1+limnoria (2011-08-10T12:00:42+0200)'