3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-11 20:52:42 +01:00

clientbot: store external server names raw instead of using server name mangling

This commit is contained in:
James Lu 2017-07-02 21:59:40 -07:00
parent ee5a884328
commit 51d8d3b3b8

View File

@ -56,7 +56,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
"""Initializes a connection to a server."""
# (Re)initialize counter-based pseudo UID generators
self.uidgen = utils.PUIDGenerator('PUID')
self.sidgen = utils.PUIDGenerator('PSID')
self.sidgen = utils.PUIDGenerator('ClientbotInternalSID')
self.has_eob = False
ts = self.start_ts
@ -123,7 +123,13 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
STUB: Pretends to spawn a new server with a subset of the given options.
"""
name = name.lower()
sid = self.sidgen.next_sid(prefix=name)
if internal:
# Use a custom pseudo-SID format for internal servers to prevent any server name clashes
sid = self.sidgen.next_sid(prefix=name)
else:
# For others servers, just use the server name as the SID.
sid = name
self.servers[sid] = Server(uplink, name, internal=internal)
return sid