diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 73cf0c7..33fe3a0 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -17,7 +17,7 @@ from pylinkirc.classes import * FALLBACK_REALNAME = 'PyLink Relay Mirror Client' # IRCv3 capabilities to request when available -IRCV3_CAPABILITIES = {'multi-prefix', 'sasl', 'away-notify', 'userhost-in-names', 'chghost'} +IRCV3_CAPABILITIES = {'multi-prefix', 'sasl', 'away-notify', 'userhost-in-names', 'chghost', 'account-notify'} class ClientbotWrapperProtocol(IRCCommonProtocol): def __init__(self, *args, **kwargs): @@ -52,6 +52,8 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): self._use_builtin_005_handling = True + self.hook_map = {'ACCOUNT': 'CLIENT_SERVICES_LOGIN'} + def post_connect(self): """Initializes a connection to a server.""" # (Re)initialize counter-based pseudo UID generators @@ -770,6 +772,19 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): self.send('NICK %s' % self.conf_nick) handle_432 = handle_437 = handle_433 + def handle_account(self, source, command, args): + """ + Handles IRCv3 account-notify messages. + """ + # <- :nick!user@host ACCOUNT accountname + # <- :nick!user@host ACCOUNT * + + account = args[0] + if account == '*': # Logout + account = '' + + return {'text': account} + def handle_join(self, source, command, args): """ Handles incoming JOINs.