mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Simplify handling of per-network waitingJoins
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
761435ba1a
commit
d1bc7922ee
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import copy
|
|
||||||
|
|
||||||
import config
|
import config
|
||||||
|
|
||||||
@ -64,7 +63,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')
|
||||||
@ -79,7 +78,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
|
||||||
|
|
||||||
@ -320,15 +320,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