mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-04 08:34:11 +01:00
AutoMode: Add 'auto*' capabilities to override the configuration values (which apply to capabilities also used elsewhere).
This commit is contained in:
parent
3c7f9d09c5
commit
19066b62a3
@ -54,10 +54,19 @@ class AutoMode(callbacks.Plugin):
|
|||||||
fallthrough = self.registryValue('fallthrough', channel)
|
fallthrough = self.registryValue('fallthrough', channel)
|
||||||
def do(type):
|
def do(type):
|
||||||
cap = ircdb.makeChannelCapability(channel, type)
|
cap = ircdb.makeChannelCapability(channel, type)
|
||||||
|
cap_auto = ircdb.makeChannelCapability(channel, 'auto'+type)
|
||||||
try:
|
try:
|
||||||
if ircdb.checkCapability(msg.prefix, cap,
|
apply_mode = ircdb.checkCapability(msg.prefix, cap,
|
||||||
ignoreOwner=not self.registryValue('owner')):
|
ignoreOwner=not self.registryValue('owner'))
|
||||||
if self.registryValue(type, channel):
|
except KeyError:
|
||||||
|
apply_mode = False
|
||||||
|
try:
|
||||||
|
override = ircdb.checkCapability(msg.prefix, cap_auto,
|
||||||
|
ignoreOwner=not self.registryValue('owner'))
|
||||||
|
except KeyError:
|
||||||
|
override = False
|
||||||
|
if apply_mode or override:
|
||||||
|
if override or self.registryValue(type, channel):
|
||||||
self.log.info('Scheduling auto-%s of %s in %s.',
|
self.log.info('Scheduling auto-%s of %s in %s.',
|
||||||
type, msg.prefix, channel)
|
type, msg.prefix, channel)
|
||||||
def dismiss():
|
def dismiss():
|
||||||
@ -74,8 +83,6 @@ class AutoMode(callbacks.Plugin):
|
|||||||
' is not enabled in %s, refusing to fall '
|
' is not enabled in %s, refusing to fall '
|
||||||
'through.', msg.prefix, cap, type, channel)
|
'through.', msg.prefix, cap, type, channel)
|
||||||
raise Continue
|
raise Continue
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
def schedule_msg(msg, dismiss):
|
def schedule_msg(msg, dismiss):
|
||||||
def f():
|
def f():
|
||||||
if not dismiss():
|
if not dismiss():
|
||||||
|
Loading…
Reference in New Issue
Block a user