diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 9bf228c..f5e559f 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -770,4 +770,5 @@ class InspIRCdProtocol(TS6BaseProtocol): self.removeClient(killed) return {'target': killed, 'text': args[1], 'userdata': data} + Class = InspIRCdProtocol diff --git a/protocols/ts6.py b/protocols/ts6.py index 571f77c..e748477 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -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 diff --git a/protocols/ts6_common.py b/protocols/ts6_common.py index 22ed160..5a826b7 100644 --- a/protocols/ts6_common.py +++ b/protocols/ts6_common.py @@ -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]}