mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 20:22:45 +01:00
ts6: add support for ratbox, send EUID only when supported (#543)
This commit is contained in:
parent
1a24bc19af
commit
975d835c92
@ -12,7 +12,7 @@ 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)
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
# ENCAP LOGIN is used on burst for EUID-less servers
|
# ENCAP LOGIN is used on burst for EUID-less servers
|
||||||
'USERMODE': 'MODE', 'LOGIN': 'CLIENT_SERVICES_LOGIN'}
|
'USERMODE': 'MODE', 'LOGIN': 'CLIENT_SERVICES_LOGIN'}
|
||||||
|
|
||||||
self.required_caps = {'EUID', 'SAVE', 'TB', 'ENCAP', 'QS', 'CHW'}
|
self.required_caps = {'SAVE', '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.
|
||||||
@ -65,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
|
||||||
|
|
||||||
@ -593,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