From 0937ba22ca51610401aa5110cb716ca8200f2a3a Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 1 Jul 2004 17:55:10 +0000 Subject: [PATCH] Added a channel-specific enforce value. --- plugins/Enforcer.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/Enforcer.py b/plugins/Enforcer.py index b62f3071e..579d6a6f6 100644 --- a/plugins/Enforcer.py +++ b/plugins/Enforcer.py @@ -68,6 +68,10 @@ class ValidNickOrEmptyString(registry.String): self.value = v conf.registerPlugin('Enforcer') +conf.registerChannelValue(conf.supybot.plugins.Enforcer, 'enforce', + registry.Boolean(True, """Determines whether the bot will enforce + capabilities on this channel. Basically, if False, it 'turns off' the + plugin for this channel.""")) conf.registerChannelValue(conf.supybot.plugins.Enforcer, 'autoOp', registry.Boolean(False, """Determines whether the bot will automatically op people with the ,op capability when they join the channel.""")) @@ -274,13 +278,16 @@ class Enforcer(callbacks.Privmsg): self._cycle(irc, channel) def __call__(self, irc, msg): - chanserv = self.registryValue('ChanServ', irc.network) - if chanserv: - if ircutils.isUserHostmask(msg.prefix): - if msg.nick != chanserv: - callbacks.Privmsg.__call__(self, irc, msg) - else: - callbacks.Privmsg.__call__(self, irc, msg) + channel = msg.args[0] + if ircutils.isChannel(channel) and \ + self.registryValue('enforce', channel): + chanserv = self.registryValue('ChanServ', irc.network) + if chanserv: + if ircutils.isUserHostmask(msg.prefix): + if msg.nick != chanserv: + callbacks.Privmsg.__call__(self, irc, msg) + else: + callbacks.Privmsg.__call__(self, irc, msg) Class = Enforcer