3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-24 11:14:07 +01:00

clientbot: track numeric 900 (RPL_LOGGEDIN) and set our own account name

This is mostly for completeness.
This commit is contained in:
James Lu 2017-08-23 19:19:53 -07:00
parent c9f10796ee
commit abdc67e0c1

View File

@ -527,13 +527,28 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
elif sasl_mech == 'EXTERNAL': elif sasl_mech == 'EXTERNAL':
self.send('AUTHENTICATE +') self.send('AUTHENTICATE +')
def handle_900(self, source, command, args):
"""
Handles SASL RPL_LOGGEDIN numerics.
"""
# <- :charybdis.midnight.vpn 900 ice ice!pylink@localhost ice :You are now logged in as ice
# <- :server 900 <nick> <nick>!<ident>@<host> <account> :You are now logged in as <user>
self.pseudoclient.services_account = args[2]
log.info('(%s) SASL authentication successful: now logged in as %s', self.name, args[2])
# Note: we don't send a hook here yet; is doing so for the bot this early in login
# really necessary?
def handle_904(self, source, command, args): def handle_904(self, source, command, args):
""" """
Handles SASL authentication status reports. Handles SASL authentication status reports.
""" """
logfunc = log.info if command == '903' else log.warning # <- :charybdis.midnight.vpn 903 ice :SASL authentication successful
logfunc = log.debug if command == '903' else log.warning
logfunc('(%s) %s', self.name, args[-1]) logfunc('(%s) %s', self.name, args[-1])
if not self.has_eob: if not self.has_eob:
# End the pre-login CAP stuff regardless of whether SASL was successful.
self._do_cap_end() self._do_cap_end()
handle_903 = handle_902 = handle_905 = handle_906 = handle_907 = handle_904 handle_903 = handle_902 = handle_905 = handle_906 = handle_907 = handle_904