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.
This commit is contained in:
Daniel Folkinshteyn 2011-03-13 14:21:46 -04:00
parent 831a2c3b9a
commit c25db0ecdf
2 changed files with 8 additions and 5 deletions

View File

@ -30,6 +30,7 @@
import re import re
import time import time
import copy
import config import config
@ -76,7 +77,7 @@ class Services(callbacks.Plugin):
if self.registryValue('noJoinsUntilIdentified'): if self.registryValue('noJoinsUntilIdentified'):
self.log.info('Holding JOIN to %s until identified.', self.log.info('Holding JOIN to %s until identified.',
msg.args[0]) msg.args[0])
self.waitingJoins.append(msg) self.waitingJoins.append((irc.network, msg,))
return None return None
return msg return msg
@ -314,9 +315,11 @@ class Services(callbacks.Plugin):
for channel in self.channels: for channel in self.channels:
irc.queueMsg(networkGroup.channels.join(channel)) irc.queueMsg(networkGroup.channels.join(channel))
if self.waitingJoins: if self.waitingJoins:
for m in self.waitingJoins: tmp_wj = copy.deepcopy(self.waitingJoins) # can't iterate over list if we're modifying it
irc.sendMsg(m) for netname, m in tmp_wj:
self.waitingJoins = [] if netname == irc.network:
irc.sendMsg(m)
self.waitingJoins.remove((netname, m,))
elif 'not yet authenticated' in s: elif 'not yet authenticated' in s:
# zirc.org has this, it requires an auth code. # zirc.org has this, it requires an auth code.
email = s.split()[-1] email = s.split()[-1]

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change """stick the various versioning attributes in here, so we only have to change
them once.""" them once."""
version = '0.83.4.1+gribble (2010-12-01T16:53:08-0500)' version = '0.83.4.1+gribble (2011-03-13T14:21:46-0400)'