From 6f617cb068f6c0afe99b6a9cfa9823b0985e3df2 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 2 May 2019 16:11:21 -0700 Subject: [PATCH] inspircd: allow choosing the target IRCd via "target_version" option --- protocols/inspircd.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index c3b2e61..f8a7142 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -13,6 +13,8 @@ from pylinkirc.protocols.ts6_common import * class InspIRCdProtocol(TS6BaseProtocol): S2S_BUFSIZE = 0 # InspIRCd allows infinitely long S2S messages, so set bufsize to infinite + SUPPORTED_IRCDS = ['insp20', 'insp3'] + DEFAULT_IRCD = SUPPORTED_IRCDS[0] MIN_PROTO_VER = 1202 # anything below is error MAX_PROTO_VER = 1205 # anything above warns (not officially supported) @@ -33,7 +35,14 @@ class InspIRCdProtocol(TS6BaseProtocol): 'FIDENT': 'CHGIDENT', 'FNAME': 'CHGNAME', 'SVSTOPIC': 'TOPIC', 'SAKICK': 'KICK'} - self.proto_ver = 1202 + ircd_target = self.serverdata.get('target_version', 'insp20').lower() + if ircd_target == 'insp20': + self.proto_ver = 1202 + elif ircd_target == 'insp3': + self.proto_ver = 1205 + else: + raise ProtocolError("Unsupported target_version %r: supported values include %s" % (ircd_target, self.SUPPORTED_IRCDS)) + log.debug('(%s) inspircd: using protocol version %s for target_version %r', self.name, self.proto_ver, ircd_target) # Track the modules supported by the uplink. self._modsupport = set()