Join all channels in one message when connecting.

This commit is contained in:
Valentin Lorentz 2013-03-27 16:55:45 +01:00
parent ddd8314884
commit 23e84cfff9
3 changed files with 16 additions and 4 deletions

View File

@ -232,9 +232,7 @@ class Owner(callbacks.Plugin):
world.starting = False
def do376(self, irc, msg):
networkGroup = conf.supybot.networks.get(irc.network)
for channel in networkGroup.channels():
irc.queueMsg(networkGroup.channels.join(channel))
irc.queueMsg(conf.supybot.networks.get(irc.network).channels.joins())
do422 = do377 = do376
def doPrivmsg(self, irc, msg):

View File

@ -277,6 +277,20 @@ class SpaceSeparatedSetOfChannels(registry.SpaceSeparatedListOf):
return ircmsgs.join(channel, key)
else:
return ircmsgs.join(channel)
def joins(self):
from . import ircmsgs # Don't put this globally! It's recursive.
channels = []
channels_with_key = []
keys = []
for channel in self():
key = self.key.get(channel)()
if key:
keys.append(key)
channels_with_key.append(channel)
else:
channels.append(channel)
return ircmsgs.join(','.join(channels_with_key + channels),
','.join(keys))
def registerNetwork(name, password='', ssl=False, sasl_username='',
sasl_password=''):

View File

@ -615,7 +615,7 @@ def notice(recipient, s, prefix='', msg=None):
def join(channel, key=None, prefix='', msg=None):
"""Returns a JOIN to a channel"""
if conf.supybot.protocols.irc.strictRfc():
assert isChannel(channel), repr(channel)
assert areChannels(channel), repr(channel)
if msg and not prefix:
prefix = msg.prefix
if key is None: