_specific_hostmask() should take an already-parsed hostmask

This commit is contained in:
jesopo 2019-12-06 10:40:24 +00:00
parent 8a265da8bf
commit 4252a2c2ce

View file

@ -19,11 +19,11 @@ class Module(ModuleManager.BaseModule):
for account, user_hostmasks in event["server"].get_all_user_settings( for account, user_hostmasks in event["server"].get_all_user_settings(
HOSTMASKS_SETTING): HOSTMASKS_SETTING):
for hostmask in user_hostmasks: for hostmask in user_hostmasks:
self._add_hostmask(event["server"], hostmask, account) self._add_hostmask(event["server"],
utils.irc.hostmask_parse(hostmask), account)
def _add_hostmask(self, server, hostmask, account): def _add_hostmask(self, server, hostmask, account):
server._hostmasks[hostmask] = ( server._hostmasks[hostmask.original] = (hostmask, account)
utils.irc.hostmask_parse(hostmask), account)
def _remove_hostmask(self, server, hostmask): def _remove_hostmask(self, server, hostmask):
if hostmask in server._hostmasks: if hostmask in server._hostmasks:
del server._hostmasks[hostmask] del server._hostmasks[hostmask]
@ -307,8 +307,9 @@ class Module(ModuleManager.BaseModule):
hostmasks.append(hostmask) hostmasks.append(hostmask)
event["user"].set_setting(HOSTMASKS_SETTING, hostmasks) event["user"].set_setting(HOSTMASKS_SETTING, hostmasks)
self._specific_hostmask(event["server"], hostmask, account) hostmask_obj = utils.irc.hostmask_parse(hostmaks)
self._add_hostmask(event["server"], hostmask, account) self._specific_hostmask(event["server"], hostmask_obj, account)
self._add_hostmask(event["server"], hostmask_obj, account)
event["stdout"].write("Added %s to your hostmasks" % hostmask) event["stdout"].write("Added %s to your hostmasks" % hostmask)
elif subcommand == "remove": elif subcommand == "remove":