diff --git a/protocols/unreal.py b/protocols/unreal.py index c7a31bf..ae1f871 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -296,8 +296,8 @@ class UnrealProtocol(TS6BaseProtocol): ts = self.irc.start_ts self.irc.prefixmodes = {'q': '~', 'a': '&', 'o': '@', 'h': '%', 'v': '+'} - # Track usages of legacy nicks. - self.legacy_nickcount = 1 + # Track usages of legacy (Unreal 3.2) nicks. + self.legacy_uidgen = utils.PUIDGenerator('U32user') self.irc.umodes.update({'deaf': 'd', 'invisible': 'i', 'hidechans': 'p', 'protected': 'q', 'registered': 'r', @@ -605,8 +605,7 @@ class UnrealProtocol(TS6BaseProtocol): servername = new_args[5].lower() # Get the name of the users' server. # Fake a UID and put it where it belongs in the new-style UID command. - fake_uid = '%s@%s' % (args[0], self.legacy_nickcount) - self.legacy_nickcount += 1 + fake_uid = self.legacy_uidgen.next_uid(prefix=args[0]) new_args[5] = fake_uid # Insert a fake cloaked host (just make it equal the real host, I don't care) diff --git a/utils.py b/utils.py index 0c7e5f6..0fd765b 100644 --- a/utils.py +++ b/utils.py @@ -73,11 +73,11 @@ class PUIDGenerator(): self.prefix = prefix self.counter = 0 - def next_uid(self): + def next_uid(self, prefix=''): """ Generates the next PUID. """ - uid = '%s@%s' % (self.prefix, self.counter) + uid = '%s@%s' % (prefix or self.prefix, self.counter) self.counter += 1 return uid next_sid = next_uid