pass username/hostname to get_user() so new.user events have that information

This commit is contained in:
jesopo 2019-09-27 12:54:20 +01:00
parent 54d874ddee
commit c04ed5875d
2 changed files with 8 additions and 9 deletions

View file

@ -44,9 +44,8 @@ def handle_353(event):
if event["server"].has_capability_str("userhost-in-names"): if event["server"].has_capability_str("userhost-in-names"):
hostmask = utils.irc.parse_hostmask(nickname) hostmask = utils.irc.parse_hostmask(nickname)
nickname = hostmask.nickname nickname = hostmask.nickname
user = event["server"].get_user(hostmask.nickname) user = event["server"].get_user(hostmask.nickname,
user.username = hostmask.username username=hostmask.username, hostname=hostmask.hostname)
user.hostname = hostmask.hostname
else: else:
user = event["server"].get_user(nickname) user = event["server"].get_user(nickname)
user.join_channel(channel) user.join_channel(channel)
@ -68,10 +67,10 @@ def join(events, event):
account = event["line"].args[1] account = event["line"].args[1]
realname = event["line"].args[2] realname = event["line"].args[2]
user = event["server"].get_user(event["line"].source.nickname) user = event["server"].get_user(event["line"].source.nickname,
username=event["line"].source.username,
hostname=event["line"].source.hostname)
user.username = event["line"].source.username
user.hostname = event["line"].source.hostname
if account: if account:
user.identified_account = account user.identified_account = account
user.identified_account_id = event["server"].get_user(account).get_id() user.identified_account_id = event["server"].get_user(account).get_id()

View file

@ -34,9 +34,9 @@ def message(events, event):
if from_self: if from_self:
user = event["server"].get_user(event["server"].nickname) user = event["server"].get_user(event["server"].nickname)
else: else:
user = event["server"].get_user(event["line"].source.nickname) user = event["server"].get_user(event["line"].source.nickname,
user.username = event["line"].source.username username=event["line"].source.username,
user.hostname = event["line"].source.hostname hostname=event["line"].source.hostname)
# strip prefix_symbols from the start of target, for when people use # strip prefix_symbols from the start of target, for when people use
# e.g. 'PRIVMSG +#channel :hi' which would send a message to only # e.g. 'PRIVMSG +#channel :hi' which would send a message to only