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

relay: block networks not on the claim list from merging in modes when relinking

This can cause channels to be inadvertently set modes that it shouldn't be on a relink (e.g. modes set by services DEFCON), since relay ignores modes from defined u-lines instead of bouncing them.
This commit is contained in:
James Lu 2018-05-20 23:33:39 -07:00
parent 1fb2a90580
commit c9c937e7a7

View File

@ -710,6 +710,8 @@ def relay_joins(irc, channel, users, ts, targetirc=None, **kwargs):
log.debug('(%s) relay: resetting too low TS value of %s on %s to %s', irc.name, ts, users, current_ts)
ts = current_ts
claim_passed = check_claim(irc, channel, irc.uplink)
def _relay_joins_loop(irc, remoteirc, channel, users, ts, burst=True):
queued_users = []
@ -768,6 +770,9 @@ def relay_joins(irc, channel, users, ts, targetirc=None, **kwargs):
# SJOIN will be used if either the amount of users to join is > 1, or there are modes
# to be set on the joining user.
if burst or len(queued_users) > 1 or queued_users[0][0]:
# Check CLAIM on the bursting network to see if they should be allowed to burst
# modes towards other links.
if claim_passed:
modes = get_supported_cmodes(irc, remoteirc, channel, irc.channels[channel].modes)
# Subtract any mode delta modes from this burst
@ -802,6 +807,8 @@ def relay_joins(irc, channel, users, ts, targetirc=None, **kwargs):
log.debug('(%s) relay.relay_joins: removing %r on %s/%s (modedelta)', irc.name,
str(modedelta_mode), remoteirc.name, remotechan)
modes.remove(modedelta_mode)
else:
modes = set()
if rsid:
remoteirc.sjoin(rsid, remotechan, queued_users, ts=ts, modes=modes)