From 4d4dbb77646f8f63efdbbe6470d39903fdd94c13 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 1 Sep 2016 12:56:34 -0700 Subject: [PATCH] Revert "clientbot: return existing PUIDs in spawnClient if nick exists" This reverts commit 113fbf9eb8d401d75b21507b5d0cca53b2454f7a. Incomplete fix: would confuse virtual service bots and external users if they had the same nick. --- protocols/clientbot.py | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/protocols/clientbot.py b/protocols/clientbot.py index 0177457..18f65fd 100644 --- a/protocols/clientbot.py +++ b/protocols/clientbot.py @@ -84,22 +84,18 @@ class ClientbotWrapperProtocol(Protocol): """ server = server or self.irc.sid + uid = self.uidgen.next_uid() - # First, check if the pseudouser we want already exists. If so, return their UID. - uid = self.irc.nickToUid(nick) - if uid: - log.debug('(%s) spawnClient stub called, returning existing PUID %s for %s', - self.irc.name, uid, nick) - return self.irc.users[uid] - else: - uid = self.uidgen.next_uid() - ts = ts or int(time.time()) - log.debug('(%s) spawnClient stub called, saving nick %s as PUID %s', self.irc.name, nick, uid) - u = self.irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname, - manipulatable=manipulatable, realhost=realhost, ip=ip) - self.irc.servers[server].users.add(uid) - self.irc.applyModes(uid, modes) - return u + ts = ts or int(time.time()) + + log.debug('(%s) spawnClient stub called, saving nick %s as PUID %s', self.irc.name, nick, uid) + u = self.irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname, + manipulatable=manipulatable, realhost=realhost, ip=ip) + self.irc.servers[server].users.add(uid) + + self.irc.applyModes(uid, modes) + + return u def spawnServer(self, name, sid=None, uplink=None, desc=None, endburst_delay=0, internal=True): """ @@ -580,6 +576,7 @@ class ClientbotWrapperProtocol(Protocol): oldnick = self.irc.serverdata['pylink_nick'] self.irc.serverdata['pylink_nick'] = self.conf_nick = args[0] log.debug('(%s) Pre-auth FNC: Forcing configured nick to %s from %s', self.irc.name, args[0], oldnick) + return oldnick = self.irc.users[source].nick self.irc.users[source].nick = args[0]