Fixed supybot.channels to use an IrcSet instead of a list.

This commit is contained in:
Jeremy Fincher 2004-02-11 06:27:35 +00:00
parent 3b899fd5c0
commit 1264f21f23
3 changed files with 7 additions and 6 deletions

View File

@ -67,7 +67,7 @@ def configure(advanced):
conf.registerPlugin('Parter')
conf.registerGlobalValue(conf.supybot.plugins.Parter, 'channels',
conf.SpaceSeparatedListOfChannels([], """Determines what channels the bot
conf.SpaceSeparatedSetOfChannels([], """Determines what channels the bot
will automatically part whenever it joins them."""))
class Parter(callbacks.Privmsg):

View File

@ -63,7 +63,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
self.joins = {}
def do376(self, irc, msg):
channels = conf.supybot.channels()
channels = list(conf.supybot.channels())
utils.sortBy(lambda s: ',' not in s, channels)
keys = []
chans = []
@ -132,7 +132,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
if conf.supybot.alwaysJoinOnInvite() or \
ircdb.checkCapability(msg.prefix, 'admin'):
irc.queueMsg(ircmsgs.join(channel))
conf.supybot.channels().append(channel)
conf.supybot.channels().add(channel)
def join(self, irc, msg, args):
"""<channel>[,<key>] [<channel>[,<key>] ...]
@ -157,7 +157,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
if not ircutils.isChannel(channel):
irc.error('%r is not a valid channel.' % channel)
return
conf.supybot.channels().append(original)
conf.supybot.channels().add(original)
irc.queueMsg(ircmsgs.joins(channels, keys))
for channel in channels:
self.joins[channel] = (irc, msg)

View File

@ -108,13 +108,14 @@ what server the bot connects to."""))
supybot.register('password', registry.String('', """Determines the password to
be sent to the server if it requires one."""))
class SpaceSeparatedListOfChannels(registry.SeparatedListOf):
class SpaceSeparatedSetOfChannels(registry.SeparatedListOf):
List = ircutils.IrcSet
Value = ValidChannel
def splitter(self, s):
return s.split()
joiner = ' '.join
supybot.register('channels', SpaceSeparatedListOfChannels(['#supybot'], """
supybot.register('channels', SpaceSeparatedSetOfChannels(['#supybot'], """
Determines what channels the bot will join when it connects to the server."""))
class ValidPrefixChars(registry.String):