mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-11 20:52:42 +01:00
parent
663bfe462c
commit
ad32ce20da
@ -115,10 +115,11 @@ class HybridProtocol(TS6Protocol):
|
|||||||
realhost=realhost, ip=ip, manipulatable=manipulatable)
|
realhost=realhost, ip=ip, manipulatable=manipulatable)
|
||||||
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, "UID {nick} 1 {ts} {modes} {ident} {host} {ip} {uid} "
|
self._send_with_prefix(server, "UID {nick} {hopcount} {ts} {modes} {ident} {host} {ip} {uid} "
|
||||||
"* :{realname}".format(ts=ts, host=host,
|
"* :{realname}".format(ts=ts, host=host,
|
||||||
nick=nick, ident=ident, uid=uid,
|
nick=nick, ident=ident, uid=uid,
|
||||||
modes=raw_modes, ip=ip, realname=realname))
|
modes=raw_modes, ip=ip, realname=realname,
|
||||||
|
hopcount=self.servers[server].hopcount))
|
||||||
return u
|
return u
|
||||||
|
|
||||||
def update_client(self, target, field, text):
|
def update_client(self, target, field, text):
|
||||||
|
@ -56,17 +56,17 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
realname = realname or conf.conf['bot']['realname']
|
realname = realname or conf.conf['bot']['realname']
|
||||||
realhost = realhost or host
|
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, realname=realname,
|
||||||
realhost=realhost, ip=ip, manipulatable=manipulatable, opertype=opertype)
|
realhost=realhost, 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, "UID {uid} {ts} {nick} {realhost} {host} {ident} {ip}"
|
self._send_with_prefix(server, "UID {uid} {ts} {nick} {realhost} {host} {ident} {ip}"
|
||||||
" {ts} {modes} + :{realname}".format(ts=ts, host=host,
|
" {ts} {modes} + :{realname}".format(ts=ts, host=host,
|
||||||
nick=nick, ident=ident, uid=uid,
|
nick=nick, ident=ident, uid=uid,
|
||||||
modes=raw_modes, ip=ip, realname=realname,
|
modes=raw_modes, ip=ip, realname=realname,
|
||||||
realhost=realhost))
|
realhost=realhost))
|
||||||
if ('o', None) in modes or ('+o', None) in modes:
|
if ('o', None) in modes or ('+o', None) in modes:
|
||||||
self._oper_up(uid, opertype)
|
self._oper_up(uid, opertype)
|
||||||
return u
|
return u
|
||||||
@ -355,8 +355,9 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
raise ValueError('Server %r is not a PyLink server!' % uplink)
|
raise ValueError('Server %r is not a PyLink server!' % uplink)
|
||||||
if not self.is_server_name(name):
|
if not self.is_server_name(name):
|
||||||
raise ValueError('Invalid server name %r' % name)
|
raise ValueError('Invalid server name %r' % name)
|
||||||
self._send_with_prefix(uplink, 'SERVER %s * 1 %s :%s' % (name, sid, desc))
|
|
||||||
self.servers[sid] = Server(self, uplink, name, internal=True, desc=desc)
|
self.servers[sid] = Server(self, uplink, name, internal=True, desc=desc)
|
||||||
|
self._send_with_prefix(uplink, 'SERVER %s * %s %s :%s' % (name, self.servers[sid].hopcount, sid, desc))
|
||||||
|
|
||||||
def endburstf():
|
def endburstf():
|
||||||
# Delay ENDBURST by X seconds if requested.
|
# Delay ENDBURST by X seconds if requested.
|
||||||
|
@ -97,7 +97,8 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
# Grab our server token; this is used instead of server name to denote where the client is.
|
# Grab our server token; this is used instead of server name to denote where the client is.
|
||||||
server_token = server.rsplit('@')[-1]
|
server_token = server.rsplit('@')[-1]
|
||||||
# <- :ngircd.midnight.local NICK GL 1 ~gl localhost 1 +io :realname
|
# <- :ngircd.midnight.local NICK GL 1 ~gl localhost 1 +io :realname
|
||||||
self._send_with_prefix(server, 'NICK %s 1 %s %s %s %s :%s' % (nick, ident, host, server_token, self.join_modes(modes), realname))
|
self._send_with_prefix(server, 'NICK %s %s %s %s %s %s :%s' % (nick, self.servers[server].hopcount,
|
||||||
|
ident, host, server_token, self.join_modes(modes), realname))
|
||||||
return userobj
|
return userobj
|
||||||
|
|
||||||
def spawn_server(self, name, sid=None, uplink=None, desc=None, endburst_delay=0):
|
def spawn_server(self, name, sid=None, uplink=None, desc=None, endburst_delay=0):
|
||||||
@ -130,8 +131,8 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
|||||||
# We need to store a server token to introduce clients on the right server. Since this is just
|
# We need to store a server token to introduce clients on the right server. Since this is just
|
||||||
# a number, we can simply use the counter in our PSID generator for this.
|
# a number, we can simply use the counter in our PSID generator for this.
|
||||||
server_token = sid.rsplit('@')[-1]
|
server_token = sid.rsplit('@')[-1]
|
||||||
self._send_with_prefix(uplink, 'SERVER %s 1 %s :%s' % (name, server_token, desc))
|
|
||||||
self.servers[sid] = Server(self, uplink, name, internal=True, desc=desc)
|
self.servers[sid] = Server(self, uplink, name, internal=True, desc=desc)
|
||||||
|
self._send_with_prefix(uplink, 'SERVER %s %s %s :%s' % (name, self.servers[sid].hopcount, server_token, desc))
|
||||||
return sid
|
return sid
|
||||||
|
|
||||||
def away(self, source, text):
|
def away(self, source, text):
|
||||||
|
@ -319,10 +319,10 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
else:
|
else:
|
||||||
b64ip = 'AAAAAA'
|
b64ip = 'AAAAAA'
|
||||||
|
|
||||||
self._send_with_prefix(server, "N {nick} 1 {ts} {ident} {host} {modes} {ip} {uid} "
|
self._send_with_prefix(server, "N {nick} {hopcount} {ts} {ident} {host} {modes} {ip} {uid} "
|
||||||
":{realname}".format(ts=ts, host=host, nick=nick, ident=ident, uid=uid,
|
":{realname}".format(ts=ts, host=host, nick=nick, ident=ident, uid=uid,
|
||||||
modes=raw_modes, ip=b64ip, realname=realname,
|
modes=raw_modes, ip=b64ip, realname=realname,
|
||||||
realhost=realhost))
|
realhost=realhost, hopcount=self.servers[server].hopcount))
|
||||||
return u
|
return u
|
||||||
|
|
||||||
def away(self, source, text):
|
def away(self, source, text):
|
||||||
@ -696,10 +696,10 @@ class P10Protocol(IRCS2SProtocol):
|
|||||||
if not self.is_server_name(name):
|
if not self.is_server_name(name):
|
||||||
raise ValueError('Invalid server name %r' % name)
|
raise ValueError('Invalid server name %r' % name)
|
||||||
|
|
||||||
self._send_with_prefix(uplink, 'SERVER %s 1 %s %s P10 %s]]] +h6 :%s' % \
|
|
||||||
(name, self.start_ts, int(time.time()), sid, desc))
|
|
||||||
|
|
||||||
self.servers[sid] = Server(self, uplink, name, internal=True, desc=desc)
|
self.servers[sid] = Server(self, uplink, name, internal=True, desc=desc)
|
||||||
|
self._send_with_prefix(uplink, 'SERVER %s %s %s %s P10 %s]]] +h6 :%s' % \
|
||||||
|
(name, self.servers[sid].hopcount, self.start_ts, int(time.time()), sid, desc))
|
||||||
|
|
||||||
return sid
|
return sid
|
||||||
|
|
||||||
def squit(self, source, target, text='No reason given'):
|
def squit(self, source, target, text='No reason given'):
|
||||||
|
@ -77,10 +77,11 @@ class RatboxProtocol(TS6Protocol):
|
|||||||
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, "UID {nick} 1 {ts} {modes} {ident} {host} {ip} {uid} "
|
self._send_with_prefix(server, "UID {nick} {hopcount} {ts} {modes} {ident} {host} {ip} {uid} "
|
||||||
":{realname}".format(ts=ts, host=host,
|
":{realname}".format(ts=ts, host=host,
|
||||||
nick=nick, ident=ident, uid=uid,
|
nick=nick, ident=ident, uid=uid,
|
||||||
modes=raw_modes, ip=ip, realname=realname))
|
modes=raw_modes, ip=ip, realname=realname,
|
||||||
|
hopcount=self.servers[server].hopcount))
|
||||||
|
|
||||||
if orig_realhost:
|
if orig_realhost:
|
||||||
# If real host is specified, send it using ENCAP REALHOST
|
# If real host is specified, send it using ENCAP REALHOST
|
||||||
|
@ -58,11 +58,11 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
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} 1 {ts} {modes} {ident} {host} {ip} {uid} "
|
self._send_with_prefix(server, "EUID {nick} {hopcount} {ts} {modes} {ident} {host} {ip} {uid} "
|
||||||
"{realhost} * :{realname}".format(ts=ts, host=host,
|
"{realhost} * :{realname}".format(ts=ts, host=host,
|
||||||
nick=nick, ident=ident, uid=uid,
|
nick=nick, ident=ident, uid=uid,
|
||||||
modes=raw_modes, ip=ip, realname=realname,
|
modes=raw_modes, ip=ip, realname=realname,
|
||||||
realhost=realhost))
|
realhost=realhost, hopcount=self.servers[server].hopcount))
|
||||||
|
|
||||||
return u
|
return u
|
||||||
|
|
||||||
|
@ -169,6 +169,7 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
|||||||
uplink = uplink or self.sid
|
uplink = uplink or self.sid
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
desc = desc or self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
desc = desc or self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
||||||
|
|
||||||
if sid is None: # No sid given; generate one!
|
if sid is None: # No sid given; generate one!
|
||||||
sid = self.sidgen.next_sid()
|
sid = self.sidgen.next_sid()
|
||||||
assert len(sid) == 3, "Incorrect SID length"
|
assert len(sid) == 3, "Incorrect SID length"
|
||||||
@ -181,8 +182,9 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
|||||||
raise ValueError('Server %r is not a PyLink server!' % uplink)
|
raise ValueError('Server %r is not a PyLink server!' % uplink)
|
||||||
if not self.is_server_name(name):
|
if not self.is_server_name(name):
|
||||||
raise ValueError('Invalid server name %r' % name)
|
raise ValueError('Invalid server name %r' % name)
|
||||||
self._send_with_prefix(uplink, 'SID %s 1 %s :%s' % (name, sid, desc))
|
|
||||||
self.servers[sid] = Server(self, uplink, name, internal=True, desc=desc)
|
self.servers[sid] = Server(self, uplink, name, internal=True, desc=desc)
|
||||||
|
self._send_with_prefix(uplink, 'SID %s %s %s :%s' % (name, self.servers[sid].hopcount, sid, desc))
|
||||||
return sid
|
return sid
|
||||||
|
|
||||||
def away(self, source, text):
|
def away(self, source, text):
|
||||||
|
@ -93,11 +93,12 @@ class UnrealProtocol(TS6BaseProtocol):
|
|||||||
encoded_ip = encoded_ip.strip().decode()
|
encoded_ip = encoded_ip.strip().decode()
|
||||||
|
|
||||||
# <- :001 UID GL 0 1441306929 gl localhost 0018S7901 0 +iowx * midnight-1C620195 fwAAAQ== :realname
|
# <- :001 UID GL 0 1441306929 gl localhost 0018S7901 0 +iowx * midnight-1C620195 fwAAAQ== :realname
|
||||||
self._send_with_prefix(server, "UID {nick} 0 {ts} {ident} {realhost} {uid} 0 {modes} "
|
self._send_with_prefix(server, "UID {nick} {hopcount} {ts} {ident} {realhost} {uid} 0 {modes} "
|
||||||
"{host} * {ip} :{realname}".format(ts=ts, host=host,
|
"{host} * {ip} :{realname}".format(ts=ts, host=host,
|
||||||
nick=nick, ident=ident, uid=uid,
|
nick=nick, ident=ident, uid=uid,
|
||||||
modes=raw_modes, realname=realname,
|
modes=raw_modes, realname=realname,
|
||||||
realhost=realhost, ip=encoded_ip))
|
realhost=realhost, ip=encoded_ip,
|
||||||
|
hopcount=self.servers[server].hopcount))
|
||||||
|
|
||||||
return u
|
return u
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user