AutoMode: Fix alternative capabilities handling.

This commit is contained in:
Valentin Lorentz 2013-12-27 15:04:50 +00:00
parent 233571e4b5
commit df375e075a
2 changed files with 14 additions and 5 deletions

View File

@ -48,6 +48,10 @@ conf.registerChannelValue(AutoMode, 'enable',
conf.registerGlobalValue(AutoMode, 'owner',
registry.Boolean(True, _("""Determines whether this plugin will automode
owners even if they don't have op/halfop/voice/whatever capability.""")))
conf.registerChannelValue(AutoMode, 'alternativeCapabilities',
registry.Boolean(False, _("""Determines whether the bot will
check for 'alternative capabilities' (ie. autoop, autohalfop,
autovoice) in addition to/instead of classic ones.""")))
conf.registerChannelValue(AutoMode, 'fallthrough',
registry.Boolean(False, _("""Determines whether the bot will "fall
through" to halfop/voicing when auto-opping is turned off but

View File

@ -57,13 +57,18 @@ class AutoMode(callbacks.Plugin):
cap_auto = ircdb.makeChannelCapability(channel, 'auto'+type)
try:
apply_mode = ircdb.checkCapability(msg.prefix, cap,
ignoreOwner=not self.registryValue('owner'))
ignoreOwner=not self.registryValue('owner'),
ignoreChannelOp=True, ignoreDefaultAllow=True)
except KeyError:
apply_mode = False
try:
override = ircdb.checkCapability(msg.prefix, cap_auto,
ignoreOwner=not self.registryValue('owner'))
except KeyError:
if self.registryValue('alternativeCapabilities', channel):
try:
override = ircdb.checkCapability(msg.prefix, cap_auto,
ignoreOwner=not self.registryValue('owner'),
ignoreChannelOp=True, ignoreDefaultAllow=True)
except KeyError:
override = False
else:
override = False
if apply_mode or override:
if override or self.registryValue(type, channel):