From e5249c859da97f628264a6e87de9f83c93b4bbb4 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 8 Nov 2003 00:10:38 +0000 Subject: [PATCH] Updated to use Configurable. --- plugins/Enforcer.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/plugins/Enforcer.py b/plugins/Enforcer.py index 66e45ea42..3580b2505 100644 --- a/plugins/Enforcer.py +++ b/plugins/Enforcer.py @@ -59,14 +59,21 @@ def configure(onStart, afterConnect, advanced): # Enforcer: Enforces capabilities on JOIN, MODE, KICK, etc. ### _chanCap = ircdb.makeChannelCapability -class Enforcer(callbacks.Privmsg, plugins.Toggleable): - toggles = plugins.ToggleDictionary({'auto-op': False, - 'auto-voice': False, - 'auto-halfop': False}) +class Enforcer(callbacks.Privmsg, plugins.Configurable): + configurables = plugins.ConfigurableDictionary( + [('auto-op', plugins.ConfigurableTypes.bool, False, + """Determines whether the bot will automatically op people with + the .op capability when they join the channel."""), + ('auto-voice', plugins.ConfigurableTypes.bool, False, + """Determines whether the bot will automatically voice people with + the .voice capability when they join the channel."""), + ('auto-halfop', plugins.ConfigurableTypes.bool, False, + """Determines whether the bot will automatically halfop people with + the .halfop capability when they join the channel."""),] + ) started = False def __init__(self): callbacks.Privmsg.__init__(self) - plugins.Toggleable.__init__(self) def start(self, irc, msg, args): """[ ] @@ -103,13 +110,13 @@ class Enforcer(callbacks.Privmsg, plugins.Toggleable): irc.queueMsg(ircmsgs.ban(channel, ircutils.banmask(msg.prefix))) irc.queueMsg(ircmsgs.kick(channel, msg.nick)) elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'op')): - if self.toggles.get('auto-op', channel): + if self.configurables.get('auto-op', channel): irc.queueMsg(ircmsgs.op(channel, msg.nick)) elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'halfop')): - if self.toggles.get('auto-halfop', channel): + if self.configurables.get('auto-halfop', channel): irc.queueMsg(ircmsgs.halfop(channel, msg.nick)) elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'voice')): - if self.toggles.get('auto-voice', channel): + if self.configurables.get('auto-voice', channel): irc.queueMsg(ircmsgs.voice(channel, msg.nick)) def doTopic(self, irc, msg):