Add IRCUser.identified_account for ACCOUNT/extended-join

This commit is contained in:
jesopo 2018-09-04 09:18:14 +01:00
parent c5a3ce4987
commit 345bc18366
2 changed files with 9 additions and 0 deletions

View file

@ -225,6 +225,12 @@ class LineHandler(object):
if not event["server"].has_user(nickname): if not event["server"].has_user(nickname):
user.username = username user.username = username
user.hostname = hostname user.hostname = hostname
if account:
user.identified_account = account
if realname:
user.realname = realname
channel.add_user(user) channel.add_user(user)
user.join_channel(channel) user.join_channel(channel)
self.events.on("received").on("join").call(channel=channel, self.events.on("received").on("join").call(channel=channel,
@ -465,9 +471,11 @@ class LineHandler(object):
user = event["server"].get_user("nickname") user = event["server"].get_user("nickname")
if not event["args"][0] == "*": if not event["args"][0] == "*":
user.identified_account = event["tags"]["account"]
self.events.on("received.account.login").call(user=user, self.events.on("received.account.login").call(user=user,
server=event["server"], account=event["tags"]["account"]) server=event["server"], account=event["tags"]["account"])
else: else:
user.identified_account = None
self.events.on("received.account.logout").call(user=user, self.events.on("received.account.logout").call(user=user,
server=event["server"]) server=event["server"])

View file

@ -11,6 +11,7 @@ class User(object):
self.server = server self.server = server
self.bot = bot self.bot = bot
self.channels = set([]) self.channels = set([])
self.identified_account = None
self.buffer = IRCBuffer.Buffer(bot) self.buffer = IRCBuffer.Buffer(bot)
def __repr__(self): def __repr__(self):