mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-23 10:44:09 +01:00
protocols: remove the endburst_delay option from spawn_server
Interestingly, this was never documented in the protocol module spec...
This commit is contained in:
parent
a425f873b5
commit
ea84497359
@ -129,7 +129,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
||||
|
||||
return u
|
||||
|
||||
def spawn_server(self, name, sid=None, uplink=None, desc=None, endburst_delay=0, internal=True):
|
||||
def spawn_server(self, name, sid=None, uplink=None, desc=None, internal=True):
|
||||
"""
|
||||
STUB: Pretends to spawn a new server with a subset of the given options.
|
||||
"""
|
||||
|
@ -331,33 +331,38 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
self._send_with_prefix(source, 'AWAY')
|
||||
self.users[source].away = text
|
||||
|
||||
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):
|
||||
"""
|
||||
Spawns a server off a PyLink server. desc (server description)
|
||||
defaults to the one in the config. uplink defaults to the main PyLink
|
||||
server, and sid (the server ID) is automatically generated if not
|
||||
given.
|
||||
|
||||
If endburst_delay is set greater than zero, the sending of ENDBURST
|
||||
will be delayed by the amount given. This can be used to prevent
|
||||
pseudoserver bursts from triggering IRCd join-flood preventions,
|
||||
and prevent connections from filling up the snomasks too much.
|
||||
Endburst delay can be tweaked by setting the _endburst_delay variable
|
||||
to a positive value before calling spawn_server(). This can be used to
|
||||
prevent PyLink bursts from filling up snomasks and triggering InspIRCd +j.
|
||||
"""
|
||||
# -> :0AL SERVER test.server * 1 0AM :some silly pseudoserver
|
||||
uplink = uplink or self.sid
|
||||
name = name.lower()
|
||||
|
||||
# "desc" defaults to the configured server description.
|
||||
desc = desc or self.serverdata.get('serverdesc') or conf.conf['bot']['serverdesc']
|
||||
|
||||
if sid is None: # No sid given; generate one!
|
||||
sid = self.sidgen.next_sid()
|
||||
|
||||
assert len(sid) == 3, "Incorrect SID length"
|
||||
if sid in self.servers:
|
||||
raise ValueError('A server with SID %r already exists!' % sid)
|
||||
|
||||
for server in self.servers.values():
|
||||
if name == server.name:
|
||||
raise ValueError('A server named %r already exists!' % name)
|
||||
|
||||
if not self.is_internal_server(uplink):
|
||||
raise ValueError('Server %r is not a PyLink server!' % uplink)
|
||||
|
||||
if not self.is_server_name(name):
|
||||
raise ValueError('Invalid server name %r' % name)
|
||||
|
||||
|
@ -101,15 +101,13 @@ class NgIRCdProtocol(IRCS2SProtocol):
|
||||
ident, host, server_token, self.join_modes(modes), realname))
|
||||
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):
|
||||
"""
|
||||
Spawns a server off a PyLink server.
|
||||
|
||||
* desc (server description) defaults to the one in the config.
|
||||
* uplink defaults to the main PyLink server.
|
||||
* SID is set equal to the server name for ngIRCd, as server UIDs are not used.
|
||||
|
||||
Endburst delay is not used on ngIRCd.
|
||||
"""
|
||||
uplink = uplink or self.sid
|
||||
assert uplink in self.servers, "Unknown uplink %r?" % uplink
|
||||
|
@ -698,14 +698,12 @@ class P10Protocol(IRCS2SProtocol):
|
||||
|
||||
self.updateTS(server, channel, ts, changedmodes)
|
||||
|
||||
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):
|
||||
"""
|
||||
Spawns a server off a PyLink server. desc (server description)
|
||||
defaults to the one in the config. uplink defaults to the main PyLink
|
||||
server, and sid (the server ID) is automatically generated if not
|
||||
given.
|
||||
|
||||
Note: the endburst_delay is not implemented for P10 and will be ignored.
|
||||
"""
|
||||
# <- SERVER nefarious.midnight.vpn 1 1460673022 1460673239 J10 ABP]] +h6 :Nefarious2 test server
|
||||
uplink = uplink or self.sid
|
||||
|
@ -159,15 +159,12 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
||||
# Update the NICK TS.
|
||||
self.users[numeric].ts = int(time.time())
|
||||
|
||||
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):
|
||||
"""
|
||||
Spawns a server off a PyLink server. desc (server description)
|
||||
defaults to the one in the config. uplink defaults to the main PyLink
|
||||
server, and sid (the server ID) is automatically generated if not
|
||||
given.
|
||||
|
||||
Note: TS6 doesn't use a specific ENDBURST command, so the endburst_delay
|
||||
option will be ignored if given.
|
||||
"""
|
||||
# -> :0AL SID test.server 1 0XY :some silly pseudoserver
|
||||
uplink = uplink or self.sid
|
||||
|
Loading…
Reference in New Issue
Block a user