diff options
| author | 2019-12-21 21:41:09 +0000 | |
|---|---|---|
| committer | 2019-12-21 21:41:09 +0000 | |
| commit | 38235b16674e22648ec9dfaf60ed7e32b42c2c8a (patch) | |
| tree | 2e3f9cd4eeaed5eae7be3a0bf8ecad13f635ee71 /modules | |
| parent | simplify token replace, catch one-char end-of-string tokens (diff) | |
| signature | ||
switch channel_op ban masks to use utils.parse.parse_token_replace
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/channel_op.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/channel_op.py b/modules/channel_op.py index 60149f0c..98f170bb 100644 --- a/modules/channel_op.py +++ b/modules/channel_op.py @@ -51,13 +51,12 @@ class Module(ModuleManager.BaseModule): event["args_split"][1:]) def _format_hostmask(self, user, s): - mask_split = s.split("$$") - for i, mask_part in enumerate(mask_split): - mask_split[i] = (mask_part.replace("$n", user.nickname) - .replace("$u", user.username) - .replace("$h", user.hostname) - .replace("$a", user.account or "")) - return "$".join(mask_split) + vars = {} + vars["n"] = vars["nickname"] = user.nickname + vars["u"] = vars["username"] = user.username + vars["h"] = vars["hostname"] = user.hostname + vars["a"] = vars["account"] = user.account or "" + return utils.parse.format_token_replace(s, vars) def _get_hostmask(self, channel, user): if not user.account == None: account_format = channel.get_setting("ban-format-account", None) |
