From f620b5b4e85c9edf07d0069ce67db3dd7f944e06 Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 5 Apr 2016 18:34:54 -0700 Subject: [PATCH] protocols: initialize sidgen/uidgen in ts6_common --- protocols/inspircd.py | 2 -- protocols/ts6.py | 2 -- protocols/ts6_common.py | 10 ++++++++++ protocols/unreal.py | 2 -- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index fcac284..1245dbb 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -29,8 +29,6 @@ class InspIRCdProtocol(TS6BaseProtocol): self.hook_map = {'FJOIN': 'JOIN', 'RSQUIT': 'SQUIT', 'FMODE': 'MODE', 'FTOPIC': 'TOPIC', 'OPERTYPE': 'MODE', 'FHOST': 'CHGHOST', 'FIDENT': 'CHGIDENT', 'FNAME': 'CHGNAME', 'SVSTOPIC': 'TOPIC'} - self.sidgen = utils.TS6SIDGenerator(self.irc) - self.uidgen = {} self.min_proto_ver = 1202 self.proto_ver = 1202 diff --git a/protocols/ts6.py b/protocols/ts6.py index de7f2bd..ff55d64 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -22,8 +22,6 @@ class TS6Protocol(TS6BaseProtocol): self.casemapping = 'rfc1459' self.hook_map = {'SJOIN': 'JOIN', 'TB': 'TOPIC', 'TMODE': 'MODE', 'BMASK': 'MODE', 'EUID': 'UID'} - self.sidgen = utils.TS6SIDGenerator(self.irc) - self.uidgen = {} # Track whether we've received end-of-burst from the uplink. self.has_eob = False diff --git a/protocols/ts6_common.py b/protocols/ts6_common.py index 6845b92..d541429 100644 --- a/protocols/ts6_common.py +++ b/protocols/ts6_common.py @@ -14,6 +14,16 @@ from log import log from classes import * class TS6BaseProtocol(Protocol): + + def __init__(self, irc): + super().__init__(irc) + + # Dictionary of UID generators (one for each server) that the protocol module will fill in. + self.uidgen = {} + + # SID generator for TS6. + self.sidgen = utils.TS6SIDGenerator(irc) + def _send(self, source, msg): """Sends a TS6-style raw command from a source numeric to the self.irc connection given.""" self.irc.send(':%s %s' % (source, msg)) diff --git a/protocols/unreal.py b/protocols/unreal.py index 6513f68..e34a612 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -29,8 +29,6 @@ class UnrealProtocol(TS6BaseProtocol): 'SVS2MODE': 'MODE', 'SJOIN': 'JOIN', 'SETHOST': 'CHGHOST', 'SETIDENT': 'CHGIDENT', 'SETNAME': 'CHGNAME', 'EOS': 'ENDBURST'} - self.uidgen = {} - self.sidgen = utils.TS6SIDGenerator(self.irc) self.caps = {} self.irc.prefixmodes = {'q': '~', 'a': '&', 'o': '@', 'h': '%', 'v': '+'}