From 0cbdefcab117c8446fcb9f4e749629cae6f2bf67 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 12 Sep 2015 12:05:53 -0700 Subject: [PATCH] ts6/inspircd: fix TS6SIDGenerator not actually incrementing... It was being replaced on every call... It was only supposed to do that if sidgen hadn't been set yet! --- protocols/inspircd.py | 4 ++-- protocols/ts6.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 466b685..63c0cb0 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -24,6 +24,7 @@ class InspIRCdProtocol(TS6BaseProtocol): self.hook_map = {'FJOIN': 'JOIN', 'RSQUIT': 'SQUIT', 'FMODE': 'MODE', 'FTOPIC': 'TOPIC', 'OPERTYPE': 'MODE', 'FHOST': 'CHGHOST', 'FIDENT': 'CHGIDENT', 'FNAME': 'CHGNAME'} + self.sidgen = utils.TS6SIDGenerator(self.irc.serverdata["sidrange"]) def spawnClient(self, nick, ident='null', host='null', realhost=None, modes=set(), server=None, ip='0.0.0.0', realname=None, ts=None, opertype=None): @@ -272,8 +273,7 @@ class InspIRCdProtocol(TS6BaseProtocol): # "desc" defaults to the configured server description. desc = desc or self.irc.serverdata.get('serverdesc') or self.irc.botdata['serverdesc'] if sid is None: # No sid given; generate one! - self.irc.sidgen = utils.TS6SIDGenerator(self.irc.serverdata["sidrange"]) - sid = self.irc.sidgen.next_sid() + sid = self.sidgen.next_sid() assert len(sid) == 3, "Incorrect SID length" if sid in self.irc.servers: raise ValueError('A server with SID %r already exists!' % sid) diff --git a/protocols/ts6.py b/protocols/ts6.py index ff222c9..6b65807 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -17,6 +17,7 @@ class TS6Protocol(TS6BaseProtocol): super(TS6Protocol, self).__init__(irc) self.casemapping = 'rfc1459' self.hook_map = {'SJOIN': 'JOIN', 'TB': 'TOPIC', 'TMODE': 'MODE', 'BMASK': 'MODE'} + self.sidgen = utils.TS6SIDGenerator(self.irc.serverdata["sidrange"]) def spawnClient(self, nick, ident='null', host='null', realhost=None, modes=set(), server=None, ip='0.0.0.0', realname=None, ts=None, opertype=None): @@ -263,8 +264,7 @@ class TS6Protocol(TS6BaseProtocol): name = name.lower() desc = desc or self.irc.serverdata.get('serverdesc') or self.irc.botdata['serverdesc'] if sid is None: # No sid given; generate one! - self.irc.sidgen = utils.TS6SIDGenerator(self.irc.serverdata["sidrange"]) - sid = self.irc.sidgen.next_sid() + sid = self.sidgen.next_sid() assert len(sid) == 3, "Incorrect SID length" if sid in self.irc.servers: raise ValueError('A server with SID %r already exists!' % sid)