mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 21:19:31 +01:00
Merge branch 'wip/ts6-updates' into devel
This commit is contained in:
commit
b366aa8d61
@ -108,7 +108,7 @@ Support for these IRCds exist, but are not tested as frequently and thoroughly.
|
|||||||
* [IRCd-Hybrid](http://www.ircd-hybrid.org/) (8.2.x / svn trunk) - module `hybrid`
|
* [IRCd-Hybrid](http://www.ircd-hybrid.org/) (8.2.x / svn trunk) - module `hybrid`
|
||||||
- For host changing support and optimal functionality, a `service{}` block / U-line should be added for PyLink on every IRCd across your network.
|
- For host changing support and optimal functionality, a `service{}` block / U-line should be added for PyLink on every IRCd across your network.
|
||||||
- For KLINE support to work, a `shared{}` block should also be added for PyLink on all servers.
|
- For KLINE support to work, a `shared{}` block should also be added for PyLink on all servers.
|
||||||
* [ircd-ratbox](http://www.ratbox.org/) (3.x) - module `ratbox`
|
* [ircd-ratbox](http://www.ratbox.org/) (3.x) - module `ts6`
|
||||||
- Host changing is not supported.
|
- Host changing is not supported.
|
||||||
- On ircd-ratbox, all known IPs of users will be shown in `/whois`, even if the client is a cloaked relay client: if you're paranoid about this, turn off Relay IP forwarding by setting the `relay_no_ips` option in the ratbox network's `server:` block.
|
- On ircd-ratbox, all known IPs of users will be shown in `/whois`, even if the client is a cloaked relay client: if you're paranoid about this, turn off Relay IP forwarding by setting the `relay_no_ips` option in the ratbox network's `server:` block.
|
||||||
- For KLINE support to work, a `shared{}` block should be added for PyLink on all servers.
|
- For KLINE support to work, a `shared{}` block should be added for PyLink on all servers.
|
||||||
|
@ -40,7 +40,6 @@ digraph G {
|
|||||||
"IRCS2SProtocol" -> "p10";
|
"IRCS2SProtocol" -> "p10";
|
||||||
"IRCS2SProtocol" -> "ngircd";
|
"IRCS2SProtocol" -> "ngircd";
|
||||||
"TS6BaseProtocol" -> "ts6" -> "hybrid";
|
"TS6BaseProtocol" -> "ts6" -> "hybrid";
|
||||||
"ts6" -> "ratbox";
|
|
||||||
"TS6BaseProtocol" -> "inspircd";
|
"TS6BaseProtocol" -> "inspircd";
|
||||||
"TS6BaseProtocol" -> "unreal";
|
"TS6BaseProtocol" -> "unreal";
|
||||||
"IRCCommonProtocol" -> "clientbot";
|
"IRCCommonProtocol" -> "clientbot";
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 86 KiB |
@ -15,9 +15,7 @@ class HybridProtocol(TS6Protocol):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.casemapping = 'ascii'
|
self.casemapping = 'ascii'
|
||||||
self.caps = {}
|
|
||||||
self.hook_map = {'EOB': 'ENDBURST', 'TBURST': 'TOPIC', 'SJOIN': 'JOIN'}
|
self.hook_map = {'EOB': 'ENDBURST', 'TBURST': 'TOPIC', 'SJOIN': 'JOIN'}
|
||||||
self.protocol_caps -= {'slash-in-hosts'}
|
|
||||||
|
|
||||||
def post_connect(self):
|
def post_connect(self):
|
||||||
"""Initializes a connection to a server."""
|
"""Initializes a connection to a server."""
|
||||||
@ -175,14 +173,11 @@ class HybridProtocol(TS6Protocol):
|
|||||||
# We only get a list of keywords here. Hybrid obviously assumes that
|
# We only get a list of keywords here. Hybrid obviously assumes that
|
||||||
# we know what modes it supports (indeed, this is a standard list).
|
# we know what modes it supports (indeed, this is a standard list).
|
||||||
# <- CAPAB :UNDLN UNKLN KLN TBURST KNOCK ENCAP DLN IE EX HOPS CHW SVS CLUSTER EOB QS
|
# <- CAPAB :UNDLN UNKLN KLN TBURST KNOCK ENCAP DLN IE EX HOPS CHW SVS CLUSTER EOB QS
|
||||||
self.caps = caps = args[0].split()
|
self._caps = caps = args[0].split()
|
||||||
for required_cap in ('SVS', 'EOB', 'HOPS', 'QS', 'TBURST'):
|
for required_cap in ('SVS', 'EOB', 'HOPS', 'QS', 'TBURST'):
|
||||||
if required_cap not in caps:
|
if required_cap not in caps:
|
||||||
raise ProtocolError('%s not found in TS6 capabilities list; this is required! (got %r)' % (required_cap, caps))
|
raise ProtocolError('%s not found in TS6 capabilities list; this is required! (got %r)' % (required_cap, caps))
|
||||||
|
|
||||||
log.debug('(%s) self.connected set!', self.name)
|
|
||||||
self.connected.set()
|
|
||||||
|
|
||||||
def handle_uid(self, numeric, command, args):
|
def handle_uid(self, numeric, command, args):
|
||||||
"""
|
"""
|
||||||
Handles Hybrid-style UID commands (user introduction). This is INCOMPATIBLE
|
Handles Hybrid-style UID commands (user introduction). This is INCOMPATIBLE
|
||||||
@ -278,7 +273,7 @@ class HybridProtocol(TS6Protocol):
|
|||||||
|
|
||||||
# Propagate the hostmask change as a hook.
|
# Propagate the hostmask change as a hook.
|
||||||
self.call_hooks([numeric, 'CHGHOST',
|
self.call_hooks([numeric, 'CHGHOST',
|
||||||
{'target': target, 'newhost': host}])
|
{'target': target, 'newhost': host}])
|
||||||
|
|
||||||
parsedmodes.remove(modepair)
|
parsedmodes.remove(modepair)
|
||||||
|
|
||||||
|
@ -1,96 +0,0 @@
|
|||||||
"""
|
|
||||||
ratbox.py: ircd-ratbox protocol module for PyLink.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import time
|
|
||||||
|
|
||||||
from pylinkirc import utils, conf
|
|
||||||
from pylinkirc.log import log
|
|
||||||
from pylinkirc.classes import *
|
|
||||||
from pylinkirc.protocols.ts6 import *
|
|
||||||
|
|
||||||
class RatboxProtocol(TS6Protocol):
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
# Don't require EUID for Ratbox
|
|
||||||
self.required_caps.discard('EUID')
|
|
||||||
|
|
||||||
self.hook_map['LOGIN'] = 'CLIENT_SERVICES_LOGIN'
|
|
||||||
self.protocol_caps -= {'slash-in-hosts'}
|
|
||||||
|
|
||||||
def post_connect(self):
|
|
||||||
"""Initializes a connection to a server."""
|
|
||||||
|
|
||||||
super().post_connect()
|
|
||||||
|
|
||||||
# Note: +r, +e, and +I support will be negotiated on link
|
|
||||||
self.cmodes = {'op': 'o', 'secret': 's', 'private': 'p', 'noextmsg': 'n', 'moderated': 'm',
|
|
||||||
'inviteonly': 'i', 'topiclock': 't', 'limit': 'l', 'ban': 'b', 'voice': 'v',
|
|
||||||
'key': 'k', 'sslonly': 'S', 'noknock': 'p',
|
|
||||||
'*A': 'beI',
|
|
||||||
'*B': 'k',
|
|
||||||
'*C': 'l',
|
|
||||||
'*D': 'imnpstrS'}
|
|
||||||
|
|
||||||
self.umodes = {
|
|
||||||
'invisible': 'i', 'callerid': 'g', 'oper': 'o', 'admin': 'a', 'sno_botfloods': 'b',
|
|
||||||
'sno_clientconnections': 'c', 'sno_extclientconnections': 'C', 'sno_debug': 'd',
|
|
||||||
'sno_fullauthblock': 'f', 'sno_skill': 'k', 'locops': 'l',
|
|
||||||
'sno_rejectedclients': 'r', 'snomask': 's', 'sno_badclientconnections': 'u',
|
|
||||||
'wallops': 'w', 'sno_serverconnects': 'x', 'sno_stats': 'y',
|
|
||||||
'operwall': 'z', 'sno_operspy': 'Z', 'deaf': 'D', 'servprotect': 'S',
|
|
||||||
# Now, map all the ABCD type modes:
|
|
||||||
'*A': '', '*B': '', '*C': '', '*D': 'igoabcCdfklrsuwxyzZD'
|
|
||||||
}
|
|
||||||
|
|
||||||
self.extbans_matching.clear()
|
|
||||||
|
|
||||||
def spawn_client(self, nick, ident='null', host='null', realhost=None, modes=set(),
|
|
||||||
server=None, ip='0.0.0.0', realname=None, ts=None, opertype=None,
|
|
||||||
manipulatable=False):
|
|
||||||
"""
|
|
||||||
Spawns a new client with the given options.
|
|
||||||
|
|
||||||
Note: No nick collision / valid nickname checks are done here; it is
|
|
||||||
up to plugins to make sure they don't introduce anything invalid.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# parameters: nickname, hopcount, nickTS, umodes, username, visible hostname, IP address,
|
|
||||||
# UID, gecos
|
|
||||||
|
|
||||||
server = server or self.sid
|
|
||||||
if not self.is_internal_server(server):
|
|
||||||
raise ValueError('Server %r is not a PyLink server!' % server)
|
|
||||||
|
|
||||||
uid = self.uidgen[server].next_uid()
|
|
||||||
|
|
||||||
ts = ts or int(time.time())
|
|
||||||
realname = realname or conf.conf['bot']['realname']
|
|
||||||
raw_modes = self.join_modes(modes)
|
|
||||||
|
|
||||||
orig_realhost = realhost
|
|
||||||
realhost = realhost or host
|
|
||||||
|
|
||||||
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname,
|
|
||||||
realhost=realhost, ip=ip, manipulatable=manipulatable)
|
|
||||||
self.apply_modes(uid, modes)
|
|
||||||
self.servers[server].users.add(uid)
|
|
||||||
|
|
||||||
self._send_with_prefix(server, "UID {nick} {hopcount} {ts} {modes} {ident} {host} {ip} {uid} "
|
|
||||||
":{realname}".format(ts=ts, host=host,
|
|
||||||
nick=nick, ident=ident, uid=uid,
|
|
||||||
modes=raw_modes, ip=ip, realname=realname,
|
|
||||||
hopcount=self.servers[server].hopcount))
|
|
||||||
|
|
||||||
if orig_realhost:
|
|
||||||
# If real host is specified, send it using ENCAP REALHOST
|
|
||||||
self._send_with_prefix(uid, "ENCAP * REALHOST %s" % orig_realhost)
|
|
||||||
|
|
||||||
return u
|
|
||||||
|
|
||||||
def update_client(self, target, field, text):
|
|
||||||
"""update_client() stub for ratbox."""
|
|
||||||
raise NotImplementedError("User data changing is not supported on ircd-ratbox.")
|
|
||||||
|
|
||||||
Class = RatboxProtocol
|
|
169
protocols/ts6.py
169
protocols/ts6.py
@ -12,15 +12,30 @@ from pylinkirc.protocols.ts6_common import *
|
|||||||
|
|
||||||
class TS6Protocol(TS6BaseProtocol):
|
class TS6Protocol(TS6BaseProtocol):
|
||||||
|
|
||||||
SUPPORTED_IRCDS = ('charybdis', 'elemental', 'chatircd')
|
SUPPORTED_IRCDS = ('charybdis', 'elemental', 'chatircd', 'ratbox')
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.protocol_caps |= {'slash-in-hosts'}
|
|
||||||
|
self._ircd = self.serverdata.get('ircd', 'elemental' if self.serverdata.get('use_elemental_modes')
|
||||||
|
else 'charybdis')
|
||||||
|
self._ircd = self._ircd.lower()
|
||||||
|
if self._ircd not in self.SUPPORTED_IRCDS:
|
||||||
|
log.warning("(%s) Unsupported IRCd %r; falling back to 'charybdis' instead", self.name, target_ircd)
|
||||||
|
self._ircd = 'charybdis'
|
||||||
|
|
||||||
|
self._can_chghost = False
|
||||||
|
if self._ircd in ('charybdis', 'elemental', 'chatircd'):
|
||||||
|
# Charybdis and derivatives allow slashes in hosts. Ratbox does not.
|
||||||
|
self.protocol_caps |= {'slash-in-hosts'}
|
||||||
|
self._can_chghost = True
|
||||||
|
|
||||||
self.casemapping = 'rfc1459'
|
self.casemapping = 'rfc1459'
|
||||||
self.hook_map = {'SJOIN': 'JOIN', 'TB': 'TOPIC', 'TMODE': 'MODE', 'BMASK': 'MODE',
|
self.hook_map = {'SJOIN': 'JOIN', 'TB': 'TOPIC', 'TMODE': 'MODE', 'BMASK': 'MODE',
|
||||||
'EUID': 'UID', 'RSFNC': 'SVSNICK', 'ETB': 'TOPIC', 'USERMODE': 'MODE'}
|
'EUID': 'UID', 'RSFNC': 'SVSNICK', 'ETB': 'TOPIC',
|
||||||
|
# ENCAP LOGIN is used on burst for EUID-less servers
|
||||||
|
'USERMODE': 'MODE', 'LOGIN': 'CLIENT_SERVICES_LOGIN'}
|
||||||
|
|
||||||
self.required_caps = {'EUID', 'SAVE', 'TB', 'ENCAP', 'QS', 'CHW'}
|
self.required_caps = {'TB', 'ENCAP', 'QS', 'CHW'}
|
||||||
|
|
||||||
# From ChatIRCd: https://github.com/ChatLounge/ChatIRCd/blob/master/doc/technical/ChatIRCd-extra.txt
|
# From ChatIRCd: https://github.com/ChatLounge/ChatIRCd/blob/master/doc/technical/ChatIRCd-extra.txt
|
||||||
# Our command handler rewrites ENCAP so that this is the exact same syntax as MODE.
|
# Our command handler rewrites ENCAP so that this is the exact same syntax as MODE.
|
||||||
@ -50,19 +65,33 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
# visible hostname, IP address, UID, real hostname, account name, gecos
|
# visible hostname, IP address, UID, real hostname, account name, gecos
|
||||||
ts = ts or int(time.time())
|
ts = ts or int(time.time())
|
||||||
realname = realname or conf.conf['bot']['realname']
|
realname = realname or conf.conf['bot']['realname']
|
||||||
realhost = realhost or host
|
|
||||||
raw_modes = self.join_modes(modes)
|
raw_modes = self.join_modes(modes)
|
||||||
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host, realname=realname,
|
u = self.users[uid] = User(self, nick, ts, uid, server, ident=ident, host=host,
|
||||||
realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype)
|
realname=realname, realhost=realhost or host, ip=ip,
|
||||||
|
manipulatable=manipulatable, opertype=opertype)
|
||||||
|
|
||||||
self.apply_modes(uid, modes)
|
self.apply_modes(uid, modes)
|
||||||
self.servers[server].users.add(uid)
|
self.servers[server].users.add(uid)
|
||||||
|
|
||||||
self._send_with_prefix(server, "EUID {nick} {hopcount} {ts} {modes} {ident} {host} {ip} {uid} "
|
if 'EUID' in self._caps:
|
||||||
"{realhost} * :{realname}".format(ts=ts, host=host,
|
# charybdis-style EUID
|
||||||
nick=nick, ident=ident, uid=uid,
|
self._send_with_prefix(server, "EUID {nick} {hopcount} {ts} {modes} {ident} {host} {ip} {uid} "
|
||||||
modes=raw_modes, ip=ip, realname=realname,
|
"{realhost} * :{realname}".format(ts=ts, host=host,
|
||||||
realhost=realhost, hopcount=self.servers[server].hopcount))
|
nick=nick, ident=ident, uid=uid,
|
||||||
|
modes=raw_modes, ip=ip, realname=realname,
|
||||||
|
realhost=realhost or host,
|
||||||
|
hopcount=self.servers[server].hopcount))
|
||||||
|
else:
|
||||||
|
# Basic ratbox UID
|
||||||
|
self._send_with_prefix(server, "UID {nick} {hopcount} {ts} {modes} {ident} {host} {ip} {uid} "
|
||||||
|
":{realname}".format(ts=ts, host=host,
|
||||||
|
nick=nick, ident=ident, uid=uid,
|
||||||
|
modes=raw_modes, ip=ip, realname=realname,
|
||||||
|
hopcount=self.servers[server].hopcount))
|
||||||
|
|
||||||
|
if realhost:
|
||||||
|
# If real host is specified, send it using ENCAP REALHOST
|
||||||
|
self._send_with_prefix(uid, "ENCAP * REALHOST %s" % realhost)
|
||||||
|
|
||||||
return u
|
return u
|
||||||
|
|
||||||
@ -218,7 +247,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
def knock(self, numeric, target, text):
|
def knock(self, numeric, target, text):
|
||||||
"""Sends a KNOCK from a PyLink client."""
|
"""Sends a KNOCK from a PyLink client."""
|
||||||
if 'KNOCK' not in self.caps:
|
if 'KNOCK' not in self._caps:
|
||||||
log.debug('(%s) knock: Dropping KNOCK to %r since the IRCd '
|
log.debug('(%s) knock: Dropping KNOCK to %r since the IRCd '
|
||||||
'doesn\'t support it.', self.name, target)
|
'doesn\'t support it.', self.name, target)
|
||||||
return
|
return
|
||||||
@ -244,7 +273,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
def update_client(self, target, field, text):
|
def update_client(self, target, field, text):
|
||||||
"""Updates the hostname of any connected client."""
|
"""Updates the hostname of any connected client."""
|
||||||
field = field.upper()
|
field = field.upper()
|
||||||
if field == 'HOST':
|
if field == 'HOST' and self._can_chghost:
|
||||||
self.users[target].host = text
|
self.users[target].host = text
|
||||||
self._send_with_prefix(self.sid, 'CHGHOST %s :%s' % (target, text))
|
self._send_with_prefix(self.sid, 'CHGHOST %s :%s' % (target, text))
|
||||||
if not self.is_internal_client(target):
|
if not self.is_internal_client(target):
|
||||||
@ -254,7 +283,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
{'target': target, 'newhost': text}])
|
{'target': target, 'newhost': text}])
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("Changing field %r of a client is "
|
raise NotImplementedError("Changing field %r of a client is "
|
||||||
"unsupported by this protocol." % field)
|
"unsupported by this IRCd." % field)
|
||||||
|
|
||||||
### Core / handlers
|
### Core / handlers
|
||||||
|
|
||||||
@ -264,63 +293,64 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
f = self.send
|
f = self.send
|
||||||
|
|
||||||
# Find the target IRCd and update the mode dictionaries as applicable.
|
# Base TS6 mode set from ratbox.
|
||||||
target_ircd = self.serverdata.get('ircd', 'elemental' if self.serverdata.get('use_elemental_modes') else 'charybdis')
|
self.cmodes.update({'sslonly': 'S', 'noknock': 'p',
|
||||||
target_ircd = target_ircd.lower()
|
'*A': 'beI',
|
||||||
|
'*B': 'k',
|
||||||
if target_ircd not in self.SUPPORTED_IRCDS:
|
'*C': 'l',
|
||||||
log.warning("(%s) Unsupported IRCd %r; falling back to 'charybdis' instead", self.name, target_ircd)
|
'*D': 'imnpstrS'})
|
||||||
target_ircd = 'charybdis'
|
|
||||||
|
|
||||||
# https://github.com/grawity/irc-docs/blob/master/server/ts6.txt#L80
|
# https://github.com/grawity/irc-docs/blob/master/server/ts6.txt#L80
|
||||||
chary_cmodes = { # TS6 generic modes (note that +p is noknock instead of private):
|
if self._ircd in ('charybdis', 'elemental', 'chatircd'):
|
||||||
'op': 'o', 'voice': 'v', 'ban': 'b', 'key': 'k', 'limit':
|
self.cmodes.update({
|
||||||
'l', 'moderated': 'm', 'noextmsg': 'n', 'noknock': 'p',
|
'quiet': 'q', 'redirect': 'f', 'freetarget': 'F',
|
||||||
'secret': 's', 'topiclock': 't', 'inviteonly': 'i',
|
'joinflood': 'j', 'largebanlist': 'L', 'permanent': 'P',
|
||||||
'private': 'p',
|
'noforwards': 'Q', 'stripcolor': 'c', 'allowinvite':
|
||||||
# charybdis-specific modes:
|
'g', 'opmoderated': 'z', 'noctcp': 'C', 'ssl': 'Z',
|
||||||
'quiet': 'q', 'redirect': 'f', 'freetarget': 'F',
|
# charybdis modes provided by extensions
|
||||||
'joinflood': 'j', 'largebanlist': 'L', 'permanent': 'P',
|
'operonly': 'O', 'adminonly': 'A', 'sslonly': 'S',
|
||||||
'noforwards': 'Q', 'stripcolor': 'c', 'allowinvite':
|
'nonotice': 'T',
|
||||||
'g', 'opmoderated': 'z', 'noctcp': 'C', 'ssl': 'Z',
|
'*A': 'beIq', '*B': 'k', '*C': 'lfj', '*D': 'mnprstFLPQcgzCZOAST'
|
||||||
# charybdis-specific modes provided by EXTENSIONS
|
})
|
||||||
'operonly': 'O', 'adminonly': 'A', 'sslonly': 'S',
|
self.umodes.update({
|
||||||
'nonotice': 'T',
|
'deaf': 'D', 'servprotect': 'S', 'admin': 'a',
|
||||||
# Now, map all the ABCD type modes:
|
'invisible': 'i', 'oper': 'o', 'wallops': 'w',
|
||||||
'*A': 'beIq', '*B': 'k', '*C': 'lfj', '*D': 'mnprstFLPQcgzCOAST'}
|
'snomask': 's', 'noforward': 'Q', 'regdeaf': 'R',
|
||||||
|
'callerid': 'g', 'operwall': 'z', 'locops': 'l',
|
||||||
|
'cloak': 'x', 'override': 'p',
|
||||||
|
'*A': '', '*B': '', '*C': '', '*D': 'DSaiowsQRgzlxp'
|
||||||
|
})
|
||||||
|
|
||||||
|
# Charybdis extbans
|
||||||
|
self.extbans_matching = {'ban_all_registered': '$a', 'ban_inchannel': '$c:', 'ban_account': '$a:',
|
||||||
|
'ban_all_opers': '$o', 'ban_realname': '$r:', 'ban_server': '$s:',
|
||||||
|
'ban_banshare': '$j:', 'ban_extgecos': '$x:', 'ban_all_ssl': '$z'}
|
||||||
|
elif self._ircd == 'ratbox':
|
||||||
|
self.umodes.update({
|
||||||
|
'callerid': 'g', 'admin': 'a', 'sno_botfloods': 'b',
|
||||||
|
'sno_clientconnections': 'c', 'sno_extclientconnections': 'C', 'sno_debug': 'd',
|
||||||
|
'sno_fullauthblock': 'f', 'sno_skill': 'k', 'locops': 'l', 'sno_rejectedclients': 'r',
|
||||||
|
'snomask': 's', 'sno_badclientconnections': 'u', 'sno_serverconnects': 'x',
|
||||||
|
'sno_stats': 'y', 'operwall': 'z', 'sno_operspy': 'Z', 'deaf': 'D', 'servprotect': 'S',
|
||||||
|
'*A': '', '*B': '', '*C': '', '*D': 'igoabcCdfklrsuwxyzZD'
|
||||||
|
})
|
||||||
|
|
||||||
|
# TODO: make these more flexible...
|
||||||
if self.serverdata.get('use_owner'):
|
if self.serverdata.get('use_owner'):
|
||||||
chary_cmodes['owner'] = 'y'
|
self.cmodes['owner'] = 'y'
|
||||||
self.prefixmodes['y'] = '~'
|
self.prefixmodes['y'] = '~'
|
||||||
if self.serverdata.get('use_admin'):
|
if self.serverdata.get('use_admin'):
|
||||||
chary_cmodes['admin'] = 'a'
|
self.cmodes['admin'] = 'a'
|
||||||
self.prefixmodes['a'] = '!' if target_ircd != 'chatircd' else '&'
|
self.prefixmodes['a'] = '!' if self._ircd != 'chatircd' else '&'
|
||||||
if self.serverdata.get('use_halfop'):
|
if self.serverdata.get('use_halfop'):
|
||||||
chary_cmodes['halfop'] = 'h'
|
self.cmodes['halfop'] = 'h'
|
||||||
self.prefixmodes['h'] = '%'
|
self.prefixmodes['h'] = '%'
|
||||||
|
|
||||||
self.cmodes = chary_cmodes
|
|
||||||
|
|
||||||
# Define supported user modes
|
|
||||||
chary_umodes = {'deaf': 'D', 'servprotect': 'S', 'admin': 'a',
|
|
||||||
'invisible': 'i', 'oper': 'o', 'wallops': 'w',
|
|
||||||
'snomask': 's', 'noforward': 'Q', 'regdeaf': 'R',
|
|
||||||
'callerid': 'g', 'operwall': 'z', 'locops': 'l',
|
|
||||||
'cloak': 'x', 'override': 'p',
|
|
||||||
# Now, map all the ABCD type modes:
|
|
||||||
'*A': '', '*B': '', '*C': '', '*D': 'DSaiowsQRgzlxp'}
|
|
||||||
self.umodes = chary_umodes
|
|
||||||
|
|
||||||
# Charybdis extbans
|
|
||||||
self.extbans_matching = {'ban_all_registered': '$a', 'ban_inchannel': '$c:', 'ban_account': '$a:',
|
|
||||||
'ban_all_opers': '$o', 'ban_realname': '$r:', 'ban_server': '$s:',
|
|
||||||
'ban_banshare': '$j:', 'ban_extgecos': '$x:', 'ban_all_ssl': '$z'}
|
|
||||||
|
|
||||||
# Toggles support of shadowircd/elemental-ircd specific channel modes:
|
# Toggles support of shadowircd/elemental-ircd specific channel modes:
|
||||||
# +T (no notice), +u (hidden ban list), +E (no kicks), +J (blocks kickrejoin),
|
# +T (no notice), +u (hidden ban list), +E (no kicks), +J (blocks kickrejoin),
|
||||||
# +K (no repeat messages), +d (no nick changes), and user modes:
|
# +K (no repeat messages), +d (no nick changes), and user modes:
|
||||||
# +B (bot), +C (blocks CTCP), +V (no invites), +I (hides channel list)
|
# +B (bot), +C (blocks CTCP), +V (no invites), +I (hides channel list)
|
||||||
if target_ircd == 'elemental':
|
if self._ircd == 'elemental':
|
||||||
elemental_cmodes = {'hiddenbans': 'u', 'nokick': 'E',
|
elemental_cmodes = {'hiddenbans': 'u', 'nokick': 'E',
|
||||||
'kicknorejoin': 'J', 'repeat': 'K', 'nonick': 'd',
|
'kicknorejoin': 'J', 'repeat': 'K', 'nonick': 'd',
|
||||||
'blockcaps': 'G'}
|
'blockcaps': 'G'}
|
||||||
@ -330,7 +360,8 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
elemental_umodes = {'noctcp': 'C', 'bot': 'B', 'noinvite': 'V', 'hidechans': 'I'}
|
elemental_umodes = {'noctcp': 'C', 'bot': 'B', 'noinvite': 'V', 'hidechans': 'I'}
|
||||||
self.umodes.update(elemental_umodes)
|
self.umodes.update(elemental_umodes)
|
||||||
self.umodes['*D'] += ''.join(elemental_umodes.values())
|
self.umodes['*D'] += ''.join(elemental_umodes.values())
|
||||||
elif target_ircd == 'chatircd':
|
|
||||||
|
elif self._ircd == 'chatircd':
|
||||||
chatircd_cmodes = {'netadminonly': 'N'}
|
chatircd_cmodes = {'netadminonly': 'N'}
|
||||||
self.cmodes.update(chatircd_cmodes)
|
self.cmodes.update(chatircd_cmodes)
|
||||||
self.cmodes['*D'] += ''.join(chatircd_cmodes.values())
|
self.cmodes['*D'] += ''.join(chatircd_cmodes.values())
|
||||||
@ -340,17 +371,18 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
self.umodes['*D'] += ''.join(chatircd_umodes.values())
|
self.umodes['*D'] += ''.join(chatircd_umodes.values())
|
||||||
|
|
||||||
# Add definitions for all the inverted versions of the extbans.
|
# Add definitions for all the inverted versions of the extbans.
|
||||||
for k, v in self.extbans_matching.copy().items():
|
if self.extbans_matching:
|
||||||
if k == 'ban_all_registered':
|
for k, v in self.extbans_matching.copy().items():
|
||||||
newk = 'ban_unregistered'
|
if k == 'ban_all_registered':
|
||||||
else:
|
newk = 'ban_unregistered'
|
||||||
newk = k.replace('_all_', '_').replace('ban_', 'ban_not_')
|
else:
|
||||||
self.extbans_matching[newk] = '$~' + v[1:]
|
newk = k.replace('_all_', '_').replace('ban_', 'ban_not_')
|
||||||
|
self.extbans_matching[newk] = '$~' + v[1:]
|
||||||
|
|
||||||
# https://github.com/grawity/irc-docs/blob/master/server/ts6.txt#L55
|
# https://github.com/grawity/irc-docs/blob/master/server/ts6.txt#L55
|
||||||
f('PASS %s TS 6 %s' % (self.serverdata["sendpass"], self.sid))
|
f('PASS %s TS 6 %s' % (self.serverdata["sendpass"], self.sid))
|
||||||
|
|
||||||
# We request the following capabilities (for charybdis):
|
# We request the following capabilities:
|
||||||
|
|
||||||
# QS: SQUIT doesn't send recursive quits for each users; required
|
# QS: SQUIT doesn't send recursive quits for each users; required
|
||||||
# by charybdis (Source: https://github.com/grawity/irc-docs/blob/master/server/ts-capab.txt)
|
# by charybdis (Source: https://github.com/grawity/irc-docs/blob/master/server/ts-capab.txt)
|
||||||
@ -406,7 +438,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
# We only get a list of keywords here. Charybdis obviously assumes that
|
# We only get a list of keywords here. Charybdis obviously assumes that
|
||||||
# we know what modes it supports (indeed, this is a standard list).
|
# we know what modes it supports (indeed, this is a standard list).
|
||||||
# <- CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN KNOCK MLOCK QS RSFNC SAVE SERVICES TB UNKLN
|
# <- CAPAB :BAN CHW CLUSTER ENCAP EOPMOD EUID EX IE KLN KNOCK MLOCK QS RSFNC SAVE SERVICES TB UNKLN
|
||||||
self.caps = caps = args[0].split()
|
self._caps = caps = args[0].split()
|
||||||
|
|
||||||
for required_cap in self.required_caps:
|
for required_cap in self.required_caps:
|
||||||
if required_cap not in caps:
|
if required_cap not in caps:
|
||||||
@ -575,7 +607,6 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
euid_args.insert(8, '*')
|
euid_args.insert(8, '*')
|
||||||
|
|
||||||
# Copy the visible hostname to the real hostname, as this data isn't sent yet.
|
# Copy the visible hostname to the real hostname, as this data isn't sent yet.
|
||||||
# TODO: handle encap realhost / encap login
|
|
||||||
euid_args.insert(8, args[5])
|
euid_args.insert(8, args[5])
|
||||||
|
|
||||||
return self.handle_euid(numeric, command, euid_args)
|
return self.handle_euid(numeric, command, euid_args)
|
||||||
|
Loading…
Reference in New Issue
Block a user