Permalink
Browse files

ts6: add support for ChatIRCd

This depreates the "use_elemental_modes" setting on ts6 networks, and replaces it with an "ircd" option targetting charybdis, elemental-ircd, or chatircd
Closes #339.
  • Loading branch information...
jlu5 committed Jul 13, 2017
1 parent b081270 commit 3d27e4a3471ed3b433061a0cd67aa36ec70ec3e0
Showing with 30 additions and 13 deletions.
  1. +11 −12 example-conf.yml
  2. +19 −1 protocols/ts6.py
@@ -239,21 +239,20 @@ servers:
# Note: /'s in nicks are automatically converted to |'s for TS6
# networks (charybdis, etc.), since they don't allow "/" in nicks.
separator: "|"
#separator: "|"
# The following options are specific to TS6 servers:
# Toggles owner (+y), admin (+a), and halfop (+h) support for
# shadowircd/elemental-ircd.
# This defaults to off for the best compatibility.
use_owner: false
use_admin: false
use_halfop: false
# Toggles support of shadowircd/elemental-ircd specific channel modes:
# +T (no notice), +u (hidden ban list), +E (no kicks), +J (blocks kickrejoin),
# +K (no repeat messages), +d (no nick changes), and user modes:
# +B (bot), +C (blocks CTCP), +D (deaf), +V (no invites), +I (hides WHOIS channel list)
use_elemental_modes: false
# shadowircd/elemental-ircd/chatircd. These default to off for the best compatibility.
#use_owner: false
#use_admin: false
#use_halfop: false
# Sets the IRCd (channel/user mode set) to target - currently supported values include
# 'chatircd', 'charybdis', and 'elemental' (elemental-ircd). This option defaults to
# 'charybdis' if not set, and replaces the "use_elemental_modes" option from PyLink 1.2
# and earlier.
#ircd: charybdis
unrealnet:
ip: 1.2.3.4
@@ -11,6 +11,8 @@
from pylinkirc.protocols.ts6_common import *
class TS6Protocol(TS6BaseProtocol):
SUPPORTED_IRCDS = ('charybdis', 'elemental', 'chatircd')
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.protocol_caps |= {'slash-in-hosts'}
@@ -287,11 +289,19 @@ def post_connect(self):
'*A': '', '*B': '', '*C': '', '*D': 'DSaiowsQRgzlxp'}
self.umodes = chary_umodes
# Find the target IRCd and update the mode dictionaries as applicable.
target_ircd = self.serverdata.get('ircd', 'elemental' if self.serverdata.get('use_elemental_modes') else 'charybdis')
target_ircd = target_ircd.lower()
if target_ircd not in self.SUPPORTED_IRCDS:
log.warning("(%s) Unsupported IRCd %r; falling back to 'charybdis' instead", self.name, target_ircd)
target_ircd = 'charybdis'
# Toggles support of shadowircd/elemental-ircd specific channel modes:
# +T (no notice), +u (hidden ban list), +E (no kicks), +J (blocks kickrejoin),
# +K (no repeat messages), +d (no nick changes), and user modes:
# +B (bot), +C (blocks CTCP), +V (no invites), +I (hides channel list)
if self.serverdata.get('use_elemental_modes'):
if target_ircd == 'elemental':
elemental_cmodes = {'hiddenbans': 'u', 'nokick': 'E',
'kicknorejoin': 'J', 'repeat': 'K', 'nonick': 'd',
'blockcaps': 'G'}
@@ -301,6 +311,14 @@ def post_connect(self):
elemental_umodes = {'noctcp': 'C', 'bot': 'B', 'noinvite': 'V', 'hidechans': 'I'}
self.umodes.update(elemental_umodes)
self.umodes['*D'] += ''.join(elemental_umodes.values())
elif target_ircd == 'chatircd':
chatircd_cmodes = {'netadminonly': 'N'}
self.cmodes.update(chatircd_cmodes)
self.cmodes['*D'] += ''.join(chatircd_cmodes.values())
chatircd_umodes = {'netadmin': 'n', 'bot': 'B', 'callerid_sslonly': 't'}
self.umodes.update(chatircd_umodes)
self.umodes['*D'] += ''.join(chatircd_umodes.values())
# https://github.com/grawity/irc-docs/blob/master/server/ts6.txt#L55
f('PASS %s TS 6 %s' % (self.serverdata["sendpass"], self.sid))

0 comments on commit 3d27e4a

Please sign in to comment.