3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

clientbot: add support for IRCv3 CHGHOST (#290)

This commit is contained in:
James Lu 2017-08-19 23:55:32 -07:00
parent 36e8ddd97e
commit 0bbe5d3a1a

View File

@ -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'}
IRCV3_CAPABILITIES = {'multi-prefix', 'sasl', 'away-notify', 'userhost-in-names', 'chghost'}
class ClientbotWrapperProtocol(IRCCommonProtocol):
def __init__(self, *args, **kwargs):
@ -860,6 +860,24 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
ts = int(args[2])
self.channels[channel].ts = ts
def handle_chghost(self, source, command, args):
"""Handles the IRCv3 CHGHOST command."""
# <- :nick!user@host CHGHOST ident new.host
ident = self.users[source].ident
host = self.users[source].host
self.users[source].ident = newident = args[0]
self.users[source].host = newhost = args[1]
if ident != newident:
self.call_hooks([source, 'CHGIDENT',
{'target': source, 'newident': newident}])
if host != newhost:
self.call_hooks([source, 'CHGHOST',
{'target': source, 'newhost': newhost}])
def handle_nick(self, source, command, args):
"""Handles NICK changes."""
# <- :GL|!~GL@127.0.0.1 NICK :GL_