mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 11:39:25 +01:00
Merge branch 'master' into devel
This commit is contained in:
commit
47a63cb8d6
@ -576,7 +576,7 @@ def handle_events(irc, data):
|
|||||||
return [numeric, command, parsed_args]
|
return [numeric, command, parsed_args]
|
||||||
|
|
||||||
def spawnServer(irc, name, sid=None, uplink=None, desc='PyLink Server'):
|
def spawnServer(irc, name, sid=None, uplink=None, desc='PyLink Server'):
|
||||||
# -> :0AL SERVER test.server 1 0XY :some silly pseudoserver
|
# -> :0AL SID test.server 1 0XY :some silly pseudoserver
|
||||||
uplink = uplink or irc.sid
|
uplink = uplink or irc.sid
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
if sid is None: # No sid given; generate one!
|
if sid is None: # No sid given; generate one!
|
||||||
@ -585,14 +585,14 @@ def spawnServer(irc, name, sid=None, uplink=None, desc='PyLink Server'):
|
|||||||
assert len(sid) == 3, "Incorrect SID length"
|
assert len(sid) == 3, "Incorrect SID length"
|
||||||
if sid in irc.servers:
|
if sid in irc.servers:
|
||||||
raise ValueError('A server with SID %r already exists!' % sid)
|
raise ValueError('A server with SID %r already exists!' % sid)
|
||||||
for server in irc.servers.values() + irc.servers.keys():
|
for server in irc.servers.values():
|
||||||
if name == server.name:
|
if name == server.name:
|
||||||
raise ValueError('A server named %r already exists!' % name)
|
raise ValueError('A server named %r already exists!' % name)
|
||||||
if not utils.isInternalServer(irc, uplink):
|
if not utils.isInternalServer(irc, uplink):
|
||||||
raise ValueError('Server %r is not a PyLink internal PseudoServer!' % uplink)
|
raise ValueError('Server %r is not a PyLink internal PseudoServer!' % uplink)
|
||||||
if not utils.isServerName(name):
|
if not utils.isServerName(name):
|
||||||
raise ValueError('Invalid server name %r' % name)
|
raise ValueError('Invalid server name %r' % name)
|
||||||
_send(irc, uplink, 'SERVER %s 1 %s :%s' % (name, sid, desc))
|
_send(irc, uplink, 'SID %s 1 %s :%s' % (name, sid, desc))
|
||||||
irc.servers[sid] = IrcServer(uplink, name, internal=True)
|
irc.servers[sid] = IrcServer(uplink, name, internal=True)
|
||||||
return sid
|
return sid
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user