From 25ca2f8399ef0c3a57e7ef7f0fdb2f893b15d88b Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 16 Apr 2016 17:06:48 -0700 Subject: [PATCH] nefarious: fix BURST prefix handling When one userpair is given with some mode prefixes, it implicitly applies to all other following UIDs, until another userpair is given with a prefix. For example: UID1,UID3:o,UID4,UID5 would assume that UID1 has no prefixes, but UID3-5 all have op when joining. This was not properly accounted for previously. --- protocols/nefarious.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/protocols/nefarious.py b/protocols/nefarious.py index 4c4837a..abad8d1 100644 --- a/protocols/nefarious.py +++ b/protocols/nefarious.py @@ -630,13 +630,17 @@ class P10Protocol(Protocol): namelist = [] log.debug('(%s) handle_sjoin: got userlist %r for %r', self.irc.name, userlist, channel) + + prefixes = '' for userpair in userlist: - # This is given in the form UID1,UID2:prefixes + # This is given in the form UID1,UID2:prefixes. However, when one userpair is given + # with a certain prefix, it implicitly applies to all other following UIDs, until + # another userpair is given with a prefix. For example: UID1,UID3:o,UID4,UID5 would + # assume that UID1 has no prefixes, but UID3-5 all have op when joining. try: user, prefixes = userpair.split(':') except ValueError: user = userpair - prefixes = '' log.debug('(%s) handle_burst: got mode prefixes %r for user %r', self.irc.name, prefixes, user) # Don't crash when we get an invalid UID.