From dea6fbce0f747f88a116c289f531dda9835e7377 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 3 Sep 2018 12:31:00 +0100 Subject: [PATCH] Support account-tag and account-notify --- IRCLineHandler.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/IRCLineHandler.py b/IRCLineHandler.py index 429bced3..c8438c3f 100644 --- a/IRCLineHandler.py +++ b/IRCLineHandler.py @@ -7,7 +7,8 @@ RE_CHANMODES = re.compile( RE_CHANTYPES = re.compile(r"\bCHANTYPES=(\W+)(?:\b|$)") RE_MODES = re.compile(r"[-+]\w+") -CAPABILITIES = {"message-tags", "multi-prefix", "chghost", "invite-notify"} +CAPABILITIES = {"message-tags", "multi-prefix", "chghost", "invite-notify", + "account-tag", "account-notify"} class LineHandler(object): def __init__(self, bot, events): @@ -40,6 +41,7 @@ class LineHandler(object): events.on("raw").on("PRIVMSG").hook(self.privmsg) events.on("raw").on("NOTICE").hook(self.notice) events.on("raw").on("CHGHOST").hook(self.chghost) + events.on("raw").on("ACCOUNT").hook(self.account) events.on("raw").on("CAP").hook(self.cap) events.on("raw").on("authenticate").hook(self.authenticate) @@ -400,6 +402,18 @@ class LineHandler(object): user.username = username user.hostname = hostname + def account(self, event): + nickname, username, hostname = Utils.seperate_hostmask( + event["prefix"]) + user = event["server"].get_user("nickname") + + if not event["args"][0] == "*": + self.events.on("received.account.login").call(user=user, + server=event["server"], account=account) + else: + self.events.on("received.account.logout").call(user=user, + server=event["server"]) + # response to a WHO command for user information def handle_352(self, event): user = event["server"].get_user(event["args"][5])