3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 23:09:23 +01:00

ts6: fix users not joining channels properly due to command cutoff

https://github.com/grawity/irc-docs/blob/master/server/ts6.txt#L5-L6 states that there can only be 15 parameters max per command, GLOBALLY. Ugh.

No warnings? No clue whatsoever that the SJOIN is dropped? This wasted a lot of time.

COME ON.
This commit is contained in:
James Lu 2015-07-21 19:29:15 -07:00
parent 3b79adf4e5
commit bad1132789

View File

@ -80,32 +80,34 @@ def sjoinServer(irc, server, channel, users, ts=None):
log.debug("sending SJOIN to %s%s with ts %s (that's %r)", channel, irc.name, ts, log.debug("sending SJOIN to %s%s with ts %s (that's %r)", channel, irc.name, ts,
time.strftime("%c", time.localtime(ts))) time.strftime("%c", time.localtime(ts)))
modes = [m for m in irc.channels[channel].modes if m[0] not in irc.cmodes['*A']] modes = [m for m in irc.channels[channel].modes if m[0] not in irc.cmodes['*A']]
uids = []
changedmodes = [] changedmodes = []
namelist = [] while users[:10]:
# We take <users> as a list of (prefixmodes, uid) pairs. uids = []
for userpair in users: namelist = []
assert len(userpair) == 2, "Incorrect format of userpair: %r" % userpair # We take <users> as a list of (prefixmodes, uid) pairs.
prefixes, user = userpair for userpair in users[:10]:
prefixchars = '' assert len(userpair) == 2, "Incorrect format of userpair: %r" % userpair
for prefix in prefixes: prefixes, user = userpair
pr = irc.prefixmodes.get(prefix) prefixchars = ''
if pr: for prefix in prefixes:
prefixchars += pr pr = irc.prefixmodes.get(prefix)
namelist.append(prefixchars+user) if pr:
uids.append(user) prefixchars += pr
for m in prefixes: namelist.append(prefixchars+user)
changedmodes.append(('+%s' % m, user)) uids.append(user)
try: for m in prefixes:
irc.users[user].channels.add(channel) changedmodes.append(('+%s' % m, user))
except KeyError: # Not initialized yet? try:
log.debug("(%s) sjoinServer: KeyError trying to add %r to %r's channel list?", irc.name, channel, user) irc.users[user].channels.add(channel)
except KeyError: # Not initialized yet?
log.debug("(%s) sjoinServer: KeyError trying to add %r to %r's channel list?", irc.name, channel, user)
users = users[10:]
namelist = ' '.join(namelist)
_send(irc, server, "SJOIN {ts} {channel} {modes} :{users}".format(
ts=ts, users=namelist, channel=channel,
modes=utils.joinModes(modes)))
irc.channels[channel].users.update(uids)
utils.applyModes(irc, channel, changedmodes) utils.applyModes(irc, channel, changedmodes)
namelist = ' '.join(namelist)
_send(irc, server, "SJOIN {ts} {channel} {modes} :{users}".format(
ts=ts, users=namelist, channel=channel,
modes=utils.joinModes(modes)))
irc.channels[channel].users.update(uids)
def _sendModes(irc, numeric, target, modes, ts=None): def _sendModes(irc, numeric, target, modes, ts=None):
utils.applyModes(irc, target, modes) utils.applyModes(irc, target, modes)