Added toggles for auto-{op,voice,halfop}

This commit is contained in:
Jeremy Fincher 2003-10-29 00:04:30 +00:00
parent 372d22e6c8
commit acd36c80d4

View File

@ -40,6 +40,7 @@ import conf
import debug import debug
import ircdb import ircdb
import ircmsgs import ircmsgs
import plugins
import privmsgs import privmsgs
import ircutils import ircutils
import callbacks import callbacks
@ -58,7 +59,10 @@ def configure(onStart, afterConnect, advanced):
# Enforcer: Enforces capabilities on JOIN, MODE, KICK, etc. # Enforcer: Enforces capabilities on JOIN, MODE, KICK, etc.
### ###
_chanCap = ircdb.makeChannelCapability _chanCap = ircdb.makeChannelCapability
class Enforcer(callbacks.Privmsg): class Enforcer(callbacks.Privmsg, plugins.Toggleable):
toggles = plugins.ToggleDictionary({'auto-op': False,
'auto-voice': False,
'auto-halfop': False})
started = False started = False
def start(self, irc, msg, args): def start(self, irc, msg, args):
"""[<CHANSERV> <revenge>] """[<CHANSERV> <revenge>]
@ -95,10 +99,13 @@ class Enforcer(callbacks.Privmsg):
irc.queueMsg(ircmsgs.ban(channel, ircutils.banmask(msg.prefix))) irc.queueMsg(ircmsgs.ban(channel, ircutils.banmask(msg.prefix)))
irc.queueMsg(ircmsgs.kick(channel, msg.nick)) irc.queueMsg(ircmsgs.kick(channel, msg.nick))
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'op')): elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'op')):
if self.toggles.get('auto-op', channel):
irc.queueMsg(ircmsgs.op(channel, msg.nick)) irc.queueMsg(ircmsgs.op(channel, msg.nick))
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'halfop')): elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'halfop')):
if self.toggles.get('auto-halfop', channel):
irc.queueMsg(ircmsgs.halfop(channel, msg.nick)) irc.queueMsg(ircmsgs.halfop(channel, msg.nick))
elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'voice')): elif ircdb.checkCapability(msg.prefix, _chanCap(channel, 'voice')):
if self.toggles.get('auto-voice', channel):
irc.queueMsg(ircmsgs.voice(channel, msg.nick)) irc.queueMsg(ircmsgs.voice(channel, msg.nick))
def doTopic(self, irc, msg): def doTopic(self, irc, msg):