mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
Simplify handling of per-network waitingJoins
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
1e1b39783b
commit
c90fafebe7
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import copy
|
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
@ -62,7 +61,7 @@ class Services(callbacks.Plugin):
|
|||||||
self.channels = []
|
self.channels = []
|
||||||
self.sentGhost = None
|
self.sentGhost = None
|
||||||
self.identified = False
|
self.identified = False
|
||||||
self.waitingJoins = []
|
self.waitingJoins = {}
|
||||||
|
|
||||||
def disabled(self, irc):
|
def disabled(self, irc):
|
||||||
disabled = self.registryValue('disabledNetworks')
|
disabled = self.registryValue('disabledNetworks')
|
||||||
@ -77,7 +76,8 @@ 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((irc.network, msg,))
|
self.waitingJoins.setdefault(irc.network, [])
|
||||||
|
self.waitingJoins[irc.network].append(msg)
|
||||||
return None
|
return None
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
@ -314,15 +314,10 @@ class Services(callbacks.Plugin):
|
|||||||
self.checkPrivileges(irc, channel)
|
self.checkPrivileges(irc, channel)
|
||||||
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:
|
waitingJoins = self.waitingJoins.pop(irc.network, None)
|
||||||
tmp_wj = copy.deepcopy(self.waitingJoins) # can't iterate over list if we're modifying it
|
if waitingJoins:
|
||||||
for netname, m in tmp_wj:
|
for m in waitingJoins:
|
||||||
if netname == irc.network:
|
irc.sendMsg(m)
|
||||||
irc.sendMsg(m)
|
|
||||||
try:
|
|
||||||
self.waitingJoins.remove((netname, m,))
|
|
||||||
except ValueError:
|
|
||||||
pass # weird stuff happen sometimes
|
|
||||||
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]
|
||||||
|
Loading…
Reference in New Issue
Block a user