diff options
| author | 2020-01-22 15:00:59 +0000 | |
|---|---|---|
| committer | 2020-01-22 15:00:59 +0000 | |
| commit | ade5cbb1f37d06fe77d21f344d030904cc19034d (patch) | |
| tree | 57fb5183321d14b0bbe321d5046a910c49e00ca0 /modules | |
| parent | effectively ignore ENDOF when there were no items (diff) | |
| signature | ||
add an optional mask pattern arg to !clear
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/channel_op.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/channel_op.py b/modules/channel_op.py index 1e0f28ea..d18d18f9 100644 --- a/modules/channel_op.py +++ b/modules/channel_op.py @@ -454,14 +454,19 @@ class Module(ModuleManager.BaseModule): @utils.kwarg("require_mode", "o") @utils.kwarg("require_access", "clear") @utils.kwarg("help", "Clear a given channel list mode (e.g. +b)") - @utils.kwarg("usage", "+<mode>") + @utils.kwarg("usage", "+<mode> [mask]") def clear(self, event): type = event["args_split"][0] if type[0] == "+" and type[1:]: mode = type[1] if mode in event["target"].mode_lists: - chunks = self._chunk( - event["server"], list(event["target"].mode_lists[mode])) + mode_list = event["target"].mode_lists[mode] + if len(event["args_split"]) > 1: + hostmask = utils.irc.hostmask_parse(event["args_split"][1]) + mode_list = list(utils.irc.hostmask_match_many( + mode_list, hostmask)) + + chunks = self._chunk(event["server"], list(mode_list)) for chunk in chunks: event["target"].send_mode("-%s" % mode*len(chunk), chunk) else: |
