From 903f86a34271fe38cc49329bd19398552f641e5d Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 23 Aug 2017 19:28:10 -0700 Subject: [PATCH] clientbot: add extended-join support (#290) --- protocols/clientbot.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/protocols/clientbot.py b/protocols/clientbot.py index c3b5df5..28a81a3 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -19,7 +19,7 @@ FALLBACK_REALNAME = 'PyLink Relay Mirror Client' # IRCv3 capabilities to request when available IRCV3_CAPABILITIES = {'multi-prefix', 'sasl', 'away-notify', 'userhost-in-names', 'chghost', 'account-notify', - 'account-tag'} + 'account-tag', 'extended-join'} class ClientbotWrapperProtocol(IRCCommonProtocol): def __init__(self, *args, **kwargs): @@ -843,11 +843,20 @@ class ClientbotWrapperProtocol(IRCCommonProtocol): """ Handles incoming JOINs, as well as JOIN acknowledgements for us. """ + # Classic format: # <- :GL|!~GL@127.0.0.1 JOIN #whatever + # With extended-join: + # <- :GL|!~GL@127.0.0.1 JOIN #whatever accountname :realname channel = args[0] self.channels[channel].users.add(source) self.users[source].channels.add(channel) + if len(args) >= 3: + self._set_account_name(source, args[1]) + # Hmm, because _get_UID only looks at the sender prefix, it doesn't + # have a way to process the realname info from JOIN yet... + self.update_client(source, 'GECOS', args[2]) + # Only fetch modes, TS, and user hosts once we're actually in the channel. # The IRCd will send us a JOIN with our nick!user@host if our JOIN succeeded. if self.pseudoclient and source == self.pseudoclient.uid: