Added disabledNetworks, to disable the plugin on certain networks.

This commit is contained in:
Jeremy Fincher 2004-10-03 08:58:26 +00:00
parent 64d60ff8db
commit 1aaad10276

View File

@ -82,9 +82,18 @@ conf.registerPlugin('Services')
class ValidNickSet(conf.ValidNicks): class ValidNickSet(conf.ValidNicks):
List = ircutils.IrcSet List = ircutils.IrcSet
conf.registerGlobalValue(conf.supybot.plugins.Services, 'nicks', conf.registerGlobalValue(conf.supybot.plugins.Services, 'nicks',
ValidNickSet([], """Determines what nicks the bot will use with ValidNickSet([], """Determines what nicks the bot will use with
services.""")) services."""))
class Networks(registry.SpaceSeparatedSetOfStrings):
List = ircutils.IrcSet
conf.registerGlobalValue(conf.supybot.plugins.Services, 'disabledNetworks',
Networks(['QuakeNet'], """Determines what networks this plugin will be
disabled on."""))
conf.registerGlobalValue(conf.supybot.plugins.Services, conf.registerGlobalValue(conf.supybot.plugins.Services,
'noJoinsUntilIdentified', 'noJoinsUntilIdentified',
registry.Boolean(False, """Determines whether the bot will not join any registry.Boolean(False, """Determines whether the bot will not join any
@ -208,6 +217,10 @@ class Services(privmsgs.CapabilityCheckingPrivmsg):
self.sentGhost = True self.sentGhost = True
def __call__(self, irc, msg): def __call__(self, irc, msg):
disabled = self.registryValue('disabledNetworks')
if irc.network in disabled or \
irc.state.supported.get('NETWORK', '') in disabled:
return
self.__parent.__call__(irc, msg) self.__parent.__call__(irc, msg)
nick = self._getNick() nick = self._getNick()
if nick not in self.registryValue('nicks'): if nick not in self.registryValue('nicks'):