From 5d5bffe9d222d782c2ccb7146325f84d483be465 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 7 Feb 2004 22:43:45 +0000 Subject: [PATCH] Made channels to be stored in the registry, as well as slightly refactored do376. --- plugins/Relay.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/Relay.py b/plugins/Relay.py index d338e85e0..5a90da3ea 100644 --- a/plugins/Relay.py +++ b/plugins/Relay.py @@ -116,8 +116,9 @@ conf.registerChannelValue(conf.supybot.plugins.Relay, 'color', conf.registerChannelValue(conf.supybot.plugins.Relay, 'topicSync', registry.Boolean(True, """Determines whether the bot will synchronize topics between networks in the channels it relays.""")) - -conf.registerGroup(conf.supybot.plugins.Relay, 'networks') +conf.registerGlobalValue(conf.supybot.plugins.Relay, 'channels', + conf.SpaceSeparatedListOfChannels([], """Determines which channels the bot + will relay in.""")) class Relay(callbacks.Privmsg): noIgnore = True @@ -128,7 +129,7 @@ class Relay(callbacks.Privmsg): self.started = False self.ircstates = ircstates self.lastmsg = lastmsg - self.channels = channels + self.channels = self.registryValue('channels') self._whois = {} self.abbreviations = abbreviations @@ -142,11 +143,12 @@ class Relay(callbacks.Privmsg): callbacks.Privmsg.__call__(self, irc, msg) def do376(self, irc, msg): -# channels = [] -# networks = conf.supybot.plugins.Relay.networks -# networked = [irc.network for irc in world.ircs] - if self.channels: - irc.queueMsg(ircmsgs.joins(self.channels)) + L = [] + for channel in self.channels: + if channel not in irc.state.channels: + L.append(channel) + if L: + irc.queueMsg(ircmsgs.joins(L)) do377 = do422 = do376 def _getRealIrc(self, irc):