mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-11 20:52:42 +01:00
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.
This commit is contained in:
parent
b081270aa1
commit
3d27e4a347
@ -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
|
||||
# shadowircd/elemental-ircd/chatircd. These default 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
|
||||
# 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.log import log
|
||||
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 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
'*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 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user