3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

nefarious: fix usermode changes internally applying on the wrong target

A regression from fca23c7d55 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.
This commit is contained in:
James Lu 2016-07-27 16:37:23 -07:00
parent 97d09c5015
commit af21063834

View File

@ -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."""