aboutsummaryrefslogtreecommitdiff
path: root/src/core_modules/check_mode.py
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-24 16:26:53 +0000
committerGravatar jesopo2020-01-24 16:26:53 +0000
commitf51b06aae198231841ccbd2e2c19de3524856348 (patch)
tree1d2cf882f5e13d1c17918a563cd12fda3d21b0d7 /src/core_modules/check_mode.py
parentimplement "important" command spec pieces, esp. for channel perms (diff)
signature
check "channel" coming from command_spec.py parsing (check_mode, channel_access)
Diffstat (limited to 'src/core_modules/check_mode.py')
-rw-r--r--src/core_modules/check_mode.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core_modules/check_mode.py b/src/core_modules/check_mode.py
index e5430229..6b246118 100644
--- a/src/core_modules/check_mode.py
+++ b/src/core_modules/check_mode.py
@@ -13,10 +13,10 @@ LOWHIGH = {
"Set which channel mode is considered to be 'high' access", example="o"))
class Module(ModuleManager.BaseModule):
def _check_command(self, event, channel, require_mode):
- if event["is_channel"] and require_mode:
+ print(channel)
+ if channel and require_mode:
if require_mode in LOWHIGH:
- require_mode = event["target"].get_setting(
- "mode-%s" % require_mode,
+ require_mode = channel.get_setting("mode-%s" % require_mode,
LOWHIGH[require_mode])
elif require_mode == "admin":
previous = None
@@ -27,9 +27,7 @@ class Module(ModuleManager.BaseModule):
previous = mode
elif require_mode == "highest":
require_mode = event["server"].prefix_modes[0][0]
-
- if not event["target"].mode_or_above(event["user"],
- require_mode):
+ if not channel.mode_or_above(event["user"], require_mode):
return (utils.consts.PERMISSION_ERROR,
"You do not have permission to do this")
else:
@@ -39,7 +37,9 @@ class Module(ModuleManager.BaseModule):
def preprocess_command(self, event):
require_mode = event["hook"].get_kwarg("require_mode")
if not require_mode == None:
- return self._check_command(event, event["target"], require_mode)
+ channel = event["kwargs"].get("channel",
+ event["target"] if event["is_channel"] else None)
+ return self._check_command(event, channel, require_mode)
@utils.hook("check.command.channel-mode")
def check_command(self, event):