aboutsummaryrefslogtreecommitdiff
path: root/modules/channel_op.py
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-22 14:01:37 +0000
committerGravatar jesopo2020-01-22 14:01:37 +0000
commit897c6df794718b48676ca9d3f54c164a1897d313 (patch)
treee3bbfb1e98d36ea3ea25daf6689e211199f5c6f9 /modules/channel_op.py
parenttypo; 'resaon' -> 'reason' (diff)
signature
track all channel list modes, not just ban and maybe quiet
Diffstat (limited to 'modules/channel_op.py')
-rw-r--r--modules/channel_op.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/modules/channel_op.py b/modules/channel_op.py
index 447e1dc7..b5aee48c 100644
--- a/modules/channel_op.py
+++ b/modules/channel_op.py
@@ -398,10 +398,8 @@ class Module(ModuleManager.BaseModule):
@utils.hook("new.channel")
def new_channel_lists(self, event):
- event["channel"].mode_lists = {"b": []}
- quiet = self._quiet_method(event["server"])
- if quiet and not quiet[0] == "b":
- event["channel"].mode_lists[quiet[0]] = []
+ event["channel"].mode_lists = {
+ m: [] for m in event["server"].channel_list_modes}
# RPL_BANLIST
@utils.hook("received.367")
@@ -434,12 +432,17 @@ class Module(ModuleManager.BaseModule):
temp_key = "~%s" % mode
channel.mode_lists[mode] = channel.mode_lists.pop(temp_key, [])
+ @utils.hook("received.mode.channel")
+ def channel_mode_lists(self, event):
+ for mode, arg in event["modes"]:
+ if mode[1] in event["server"].channel_list_modes:
+ if mode[0] == "+":
+ event["channel"].mode_lists[mode[1]].add(arg)
+ else:
+ event["channel"].mode_lists[mode[1]].discard(arg)
+
@utils.hook("self.join")
def self_join(self, event):
- list_modes = ["b"]
-
- quiet = self._quiet_method(event["server"])
- if quiet and not quiet[0] == "b":
- list_modes.append(quiet[0])
+ event["channel"].send_mode("+%s" %
+ "".join(event["server"].channel_list_modes))
- event["channel"].send_mode("+%s" % "".join(list_modes))