3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

nefarious: deduplicate outgoing BURST mode prefixes

This commit is contained in:
James Lu 2016-04-27 16:43:09 -07:00
parent 1bd2bd760c
commit dd7b3821e9

View File

@ -484,6 +484,7 @@ class P10Protocol(Protocol):
return num return num
users = sorted(users, key=access_sort) users = sorted(users, key=access_sort)
last_prefixes = ''
for userpair in users: for userpair in users:
# We take <users> as a list of (prefixmodes, uid) pairs. # We take <users> as a list of (prefixmodes, uid) pairs.
assert len(userpair) == 2, "Incorrect format of userpair: %r" % userpair assert len(userpair) == 2, "Incorrect format of userpair: %r" % userpair
@ -494,11 +495,12 @@ class P10Protocol(Protocol):
changedusers.append(user) changedusers.append(user)
log.debug('(%s) sjoin: adding %s:%s to namelist', self.irc.name, user, prefixes) log.debug('(%s) sjoin: adding %s:%s to namelist', self.irc.name, user, prefixes)
if prefixes and prefixes != last_prefixes:
if prefixes:
namelist.append('%s:%s' % (user, prefixes)) namelist.append('%s:%s' % (user, prefixes))
else: else:
namelist.append(user) namelist.append(user)
last_prefixes = prefixes
if prefixes: if prefixes:
for prefix in prefixes: for prefix in prefixes:
changedmodes.append(('+%s' % prefix, user)) changedmodes.append(('+%s' % prefix, user))