mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +01:00
ts6: implement line wrapping in SJOIN ban bursts (#253)
This commit is contained in:
parent
702ba84956
commit
487a07671b
@ -108,7 +108,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
|
|
||||||
# Get all the ban modes in a separate list. These are bursted using a separate BMASK
|
# Get all the ban modes in a separate list. These are bursted using a separate BMASK
|
||||||
# command.
|
# command.
|
||||||
banmodes = {k: set() for k in self.irc.cmodes['*A']}
|
banmodes = {k: [] for k in self.irc.cmodes['*A']}
|
||||||
regularmodes = []
|
regularmodes = []
|
||||||
log.debug('(%s) Unfiltered SJOIN modes: %s', self.irc.name, modes)
|
log.debug('(%s) Unfiltered SJOIN modes: %s', self.irc.name, modes)
|
||||||
for mode in modes:
|
for mode in modes:
|
||||||
@ -119,7 +119,7 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
# Don't reset modes that are already set.
|
# Don't reset modes that are already set.
|
||||||
continue
|
continue
|
||||||
|
|
||||||
banmodes[modechar].add(mode[1])
|
banmodes[modechar].append(mode[1])
|
||||||
else:
|
else:
|
||||||
regularmodes.append(mode)
|
regularmodes.append(mode)
|
||||||
log.debug('(%s) Filtered SJOIN modes to be regular modes: %s, banmodes: %s', self.irc.name, regularmodes, banmodes)
|
log.debug('(%s) Filtered SJOIN modes to be regular modes: %s, banmodes: %s', self.irc.name, regularmodes, banmodes)
|
||||||
@ -158,11 +158,11 @@ class TS6Protocol(TS6BaseProtocol):
|
|||||||
# line)
|
# line)
|
||||||
if bans:
|
if bans:
|
||||||
log.debug('(%s) sjoin: bursting mode %s with bans %s, ts:%s', self.irc.name, bmode, bans, ts)
|
log.debug('(%s) sjoin: bursting mode %s with bans %s, ts:%s', self.irc.name, bmode, bans, ts)
|
||||||
bans = list(bans) # Convert into list for splicing
|
msgprefix = ':{sid} BMASK {ts} {channel} {bmode} :'.format(sid=server, ts=ts,
|
||||||
while bans[:12]:
|
channel=channel, bmode=bmode)
|
||||||
self._send(server, "BMASK {ts} {channel} {bmode} :{bans}".format(ts=ts,
|
# Actually, we cut off at 17 arguments/line, since the prefix and command name don't count.
|
||||||
channel=channel, bmode=bmode, bans=' '.join(bans[:12])))
|
for msg in utils.wrapArguments(msgprefix, bans, S2S_BUFSIZE, max_args_per_line=17):
|
||||||
bans = bans[12:]
|
self.irc.send(msg)
|
||||||
|
|
||||||
self.updateTS(server, channel, ts, changedmodes)
|
self.updateTS(server, channel, ts, changedmodes)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user