IRCUser.get_identified_account() doesn't exist anymore

This commit is contained in:
jesopo 2019-11-22 11:48:29 +00:00
parent 6f67bf0c97
commit 3935bf3a30
4 changed files with 9 additions and 4 deletions

View file

@ -1,5 +1,6 @@
#--depends-on check_mode #--depends-on check_mode
#--depends-on commands #--depends-on commands
#--depends-on permissions
from src import ModuleManager, utils from src import ModuleManager, utils
@ -8,7 +9,7 @@ class Module(ModuleManager.BaseModule):
def _has_channel_access(self, target, user, require_access): def _has_channel_access(self, target, user, require_access):
access = target.get_user_setting(user.get_id(), "access", []) access = target.get_user_setting(user.get_id(), "access", [])
identified_account = user.get_identified_account() identified = self.exports.get_one("is-identified")(user)
return ((require_access in access or "*" in access return ((require_access in access or "*" in access
) and identified_account) ) and identified_account)

View file

@ -56,10 +56,10 @@ class Module(ModuleManager.BaseModule):
mask_split[i] = (mask_part.replace("$n", user.nickname) mask_split[i] = (mask_part.replace("$n", user.nickname)
.replace("$u", user.username) .replace("$u", user.username)
.replace("$h", user.hostname) .replace("$h", user.hostname)
.replace("$a", user.get_identified_account() or "")) .replace("$a", user.account or ""))
return "$".join(mask_split) return "$".join(mask_split)
def _get_hostmask(self, channel, user): def _get_hostmask(self, channel, user):
if not user.get_identified_account() == None: if not user.account == None:
account_format = channel.get_setting("ban-format-account", None) account_format = channel.get_setting("ban-format-account", None)
if not account_format == None: if not account_format == None:
return self._format_hostmask(user, account_format) return self._format_hostmask(user, account_format)

View file

@ -16,7 +16,7 @@ class Module(ModuleManager.BaseModule):
@utils.kwarg("help", "Show what I think your account name is") @utils.kwarg("help", "Show what I think your account name is")
def account(self, event): def account(self, event):
event["stdout"].write("%s: %s" % (event["user"].nickname, event["stdout"].write("%s: %s" % (event["user"].nickname,
event["user"].get_identified_account())) self.exports.get_one("account-name")(event["user"])))
@utils.hook("received.command.channelid", channel_only=True) @utils.hook("received.command.channelid", channel_only=True)
def channel_id(self, event): def channel_id(self, event):

View file

@ -6,6 +6,10 @@ HOSTMASKS_SETTING = "hostmask-account"
NO_PERMISSION = "You do not have permission to do that" NO_PERMISSION = "You do not have permission to do that"
class Module(ModuleManager.BaseModule): class Module(ModuleManager.BaseModule):
def on_load(self):
self.exports.add("is-identified", self._is_identified)
self.exports.add("account-name", self._account_name)
@utils.hook("new.server") @utils.hook("new.server")
def new_server(self, event): def new_server(self, event):
hostmasks = {} hostmasks = {}