3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

protocols: implement SVSNICK hooks for InspIRCd, Charybdis, UnrealIRCd (#269)

More testing still needs to be done with this on Nefarious, as atheme (what I'm testing against) doesn't use P10 SVSNICK yet.
This commit is contained in:
James Lu 2016-07-11 23:21:08 -07:00
parent bc369bf6a6
commit 21d03e7b69
3 changed files with 20 additions and 2 deletions

View File

@ -770,4 +770,5 @@ class InspIRCdProtocol(TS6BaseProtocol):
self.removeClient(killed)
return {'target': killed, 'text': args[1], 'userdata': data}
Class = InspIRCdProtocol

View File

@ -17,7 +17,7 @@ class TS6Protocol(TS6BaseProtocol):
super().__init__(irc)
self.casemapping = 'rfc1459'
self.hook_map = {'SJOIN': 'JOIN', 'TB': 'TOPIC', 'TMODE': 'MODE', 'BMASK': 'MODE',
'EUID': 'UID'}
'EUID': 'UID', 'RSFNC': 'SVSNICK'}
# Track whether we've received end-of-burst from the uplink.
self.has_eob = False
@ -657,7 +657,7 @@ class TS6Protocol(TS6BaseProtocol):
def handle_su(self, numeric, command, args):
"""
Handles SU, which is used for setting login information
Handles SU, which is used for setting login information.
"""
# <- :00A ENCAP * SU 42XAAAAAC :GLolol
# <- :00A ENCAP * SU 42XAAAAAC
@ -669,4 +669,11 @@ class TS6Protocol(TS6BaseProtocol):
uid = args[0]
self.irc.callHooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': account}])
def handle_rsfnc(self, numeric, command, args):
"""
Handles RSFNC, used for forced nick change attempts.
"""
# <- :00A ENCAP somenet.relay RSFNC 801AAAAAB Guest75038 1468299643 :1468299675
return {'target': args[0], 'newnick': args[1]}
Class = TS6Protocol

View File

@ -440,3 +440,13 @@ class TS6BaseProtocol(IRCS2SProtocol):
if not (self.irc.channels[channel].users or ((self.irc.cmodes.get('permanent'), None) in self.irc.channels[channel].modes)):
del self.irc.channels[channel]
return {'channels': channels, 'text': reason}
def handle_svsnick(self, source, command, args):
"""Handles SVSNICK (forced nickname change attempts)."""
# InspIRCd:
# <- :00A ENCAP 902 SVSNICK 902AAAAAB Guest53593 :1468299404
# This is rewritten to SVSNICK with args ['902AAAAAB', 'Guest53593', '1468299404']
# UnrealIRCd:
# <- :services.midnight.vpn SVSNICK GL Guest87795 1468303726
return {'target': self._getUid(args[0]), 'newnick': args[1]}