From 8f70582d1b6227b682ffae92ce5620842e130896 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 4 Sep 2015 18:46:21 -0700 Subject: [PATCH] ts6: fixes to spawnServer 1) Use SID, not SERVER - This allows us to actually spawn clients on these servers... 2) Fix check for existing server names (drop the .keys() loop, it raises TypeError and isn't needed) --- protocols/ts6.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/protocols/ts6.py b/protocols/ts6.py index e41d27d..c7b233d 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -601,7 +601,7 @@ def handle_events(irc, data): return [numeric, command, parsed_args] 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 name = name.lower() if sid is None: # No sid given; generate one! @@ -610,14 +610,14 @@ def spawnServer(irc, name, sid=None, uplink=None, desc='PyLink Server'): assert len(sid) == 3, "Incorrect SID length" if sid in irc.servers: 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: raise ValueError('A server named %r already exists!' % name) if not utils.isInternalServer(irc, uplink): raise ValueError('Server %r is not a PyLink internal PseudoServer!' % uplink) if not utils.isServerName(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) return sid