From 79a1ac90068ecf5e9134817f1f8b192dc6bd45a6 Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 14 Jul 2015 18:20:10 -0700 Subject: [PATCH] pr/insp: fix sjoinServer not updating the internal modes list --- protocols/inspircd.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 2aefdfa..f4d4ccb 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -65,7 +65,7 @@ def joinClient(irc, client, channel): modes=utils.joinModes(irc.channels[channel].modes))) irc.channels[channel].users.add(client) -def sjoinServer(irc, server, channel, users, ts=None, modes=None): +def sjoinServer(irc, server, channel, users, ts=None): channel = channel.lower() server = server or irc.sid assert users, "sjoinServer: No users sent?" @@ -75,15 +75,25 @@ def sjoinServer(irc, server, channel, users, ts=None, modes=None): ts = irc.channels[channel].ts log.debug("sending SJOIN to %s%s with ts %s (that's %r)", channel, irc.name, ts, time.strftime("%c", time.localtime(ts))) + ''' TODO: handle this properly! if modes is None: modes = irc.channels[channel].modes + else: + utils.applyModes(irc, channel, modes) + ''' + modes = irc.channels[channel].modes uids = [] + changedmodes = [] namelist = [] # We take as a list of (prefixmodes, uid) pairs. for userpair in users: assert len(userpair) == 2, "Incorrect format of userpair: %r" % userpair + prefixes, user = userpair namelist.append(','.join(userpair)) - uids.append(userpair[1]) + uids.append(user) + for m in prefixes: + changedmodes.append(('+%s' % m, user)) + utils.applyModes(irc, channel, changedmodes) namelist = ' '.join(namelist) _sendFromServer(irc, server, "FJOIN {channel} {ts} {modes} :{users}".format( ts=ts, users=namelist, channel=channel,