mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-23 17:00:40 +01:00
clientbot: add support for IRCv3.1 account-notify (#290)
This commit is contained in:
parent
0bbe5d3a1a
commit
48c6765411
@ -17,7 +17,7 @@ from pylinkirc.classes import *
|
|||||||
FALLBACK_REALNAME = 'PyLink Relay Mirror Client'
|
FALLBACK_REALNAME = 'PyLink Relay Mirror Client'
|
||||||
|
|
||||||
# IRCv3 capabilities to request when available
|
# 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):
|
class ClientbotWrapperProtocol(IRCCommonProtocol):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -52,6 +52,8 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
|||||||
|
|
||||||
self._use_builtin_005_handling = True
|
self._use_builtin_005_handling = True
|
||||||
|
|
||||||
|
self.hook_map = {'ACCOUNT': 'CLIENT_SERVICES_LOGIN'}
|
||||||
|
|
||||||
def post_connect(self):
|
def post_connect(self):
|
||||||
"""Initializes a connection to a server."""
|
"""Initializes a connection to a server."""
|
||||||
# (Re)initialize counter-based pseudo UID generators
|
# (Re)initialize counter-based pseudo UID generators
|
||||||
@ -770,6 +772,19 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
|||||||
self.send('NICK %s' % self.conf_nick)
|
self.send('NICK %s' % self.conf_nick)
|
||||||
handle_432 = handle_437 = handle_433
|
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):
|
def handle_join(self, source, command, args):
|
||||||
"""
|
"""
|
||||||
Handles incoming JOINs.
|
Handles incoming JOINs.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user