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,11 +80,12 @@ 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 = []
while users[:10]:
uids = []
namelist = [] namelist = []
# We take <users> as a list of (prefixmodes, uid) pairs. # We take <users> as a list of (prefixmodes, uid) pairs.
for userpair in users: for userpair in users[:10]:
assert len(userpair) == 2, "Incorrect format of userpair: %r" % userpair assert len(userpair) == 2, "Incorrect format of userpair: %r" % userpair
prefixes, user = userpair prefixes, user = userpair
prefixchars = '' prefixchars = ''
@ -100,12 +101,13 @@ def sjoinServer(irc, server, channel, users, ts=None):
irc.users[user].channels.add(channel) irc.users[user].channels.add(channel)
except KeyError: # Not initialized yet? except KeyError: # Not initialized yet?
log.debug("(%s) sjoinServer: KeyError trying to add %r to %r's channel list?", irc.name, channel, user) log.debug("(%s) sjoinServer: KeyError trying to add %r to %r's channel list?", irc.name, channel, user)
utils.applyModes(irc, channel, changedmodes) users = users[10:]
namelist = ' '.join(namelist) namelist = ' '.join(namelist)
_send(irc, server, "SJOIN {ts} {channel} {modes} :{users}".format( _send(irc, server, "SJOIN {ts} {channel} {modes} :{users}".format(
ts=ts, users=namelist, channel=channel, ts=ts, users=namelist, channel=channel,
modes=utils.joinModes(modes))) modes=utils.joinModes(modes)))
irc.channels[channel].users.update(uids) irc.channels[channel].users.update(uids)
utils.applyModes(irc, channel, changedmodes)
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)