From af210638342651dcb86c83319231dbb5ed4de98d Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 27 Jul 2016 16:37:23 -0700 Subject: [PATCH] nefarious: fix usermode changes internally applying on the wrong target A regression from fca23c7d5594ba098324c0236bd5f6f62488e93b overwrote the target UID with a nick before passing it into applyModes(), which raises an "unknown mode target" warning and causes the mode change to be dropped. --- protocols/nefarious.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocols/nefarious.py b/protocols/nefarious.py index 5548341..546da3d 100644 --- a/protocols/nefarious.py +++ b/protocols/nefarious.py @@ -413,10 +413,11 @@ class P10Protocol(IRCS2SProtocol): if numeric not in self.irc.servers and (not cobj.isOp(numeric)) and (not cobj.isHalfop(numeric)): numeric = self.irc.getServer(numeric) + real_target = target else: assert target in self.irc.users, "Unknown mode target %s" % target # P10 uses nicks in user MODE targets, NOT UIDs. ~GL - target = self.irc.users[target].nick + real_target = self.irc.users[target].nick send_ts = False self.irc.applyModes(target, modes) @@ -424,7 +425,7 @@ class P10Protocol(IRCS2SProtocol): while modes[:12]: joinedmodes = self.irc.joinModes([m for m in modes[:12]]) modes = modes[12:] - self._send(numeric, 'M %s %s%s' % (target, joinedmodes, ' %s' % ts if send_ts else '')) + self._send(numeric, 'M %s %s%s' % (real_target, joinedmodes, ' %s' % ts if send_ts else '')) def nick(self, numeric, newnick): """Changes the nick of a PyLink client."""