From 38235b16674e22648ec9dfaf60ed7e32b42c2c8a Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 21 Dec 2019 21:41:09 +0000 Subject: [PATCH] switch channel_op ban masks to use utils.parse.parse_token_replace --- modules/channel_op.py | 13 ++++++------- 1 file 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)