support "$$" as "$" in ban-format

This commit is contained in:
jesopo 2019-09-24 15:27:35 +01:00
parent 5b82193f3b
commit 7549c0f998

View file

@ -56,10 +56,13 @@ class Module(ModuleManager.BaseModule):
event["args_split"][1:]) event["args_split"][1:])
def _format_hostmask(self, user, s): def _format_hostmask(self, user, s):
return (s.replace("$n", user.nickname) mask_split = s.split("$$")
.replace("$u", user.username) for i, mask_part in enumerate(mask_split):
.replace("$h", user.hostname) mask_split[i] = (s.replace("$n", user.nickname)
.replace("$a", user.get_identified_account())) .replace("$u", user.username)
.replace("$h", user.hostname)
.replace("$a", user.get_identified_account()))
return "$".join(mask_split)
def _get_hostmask(self, channel, user): def _get_hostmask(self, channel, user):
format = channel.get_setting("ban-format", "*!$u@$h") format = channel.get_setting("ban-format", "*!$u@$h")
hostmask_split = [ hostmask_split = [