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

relay: also ignore clientbot networks in modedelta

TODO: abstract all these checks out!
This commit is contained in:
James Lu 2017-12-14 13:26:43 -08:00
parent 923795719f
commit f908e407d4

View File

@ -756,6 +756,10 @@ def relay_joins(irc, channel, users, ts, targetirc=None, **kwargs):
log.warning('(%s) Refusing to set modedelta mode %r on %s because it is a list or prefix mode',
irc.name, modechar, channel)
continue
elif not remoteirc.has_cap('can-spawn-clients'):
log.debug('(%s) relay.handle_mode: Not enforcing modedelta modes on bot-only network %s',
irc.name, remoteirc.name)
continue
modedelta_mode = ('+%s' % modechar, mode[1])
if adding:
@ -1695,6 +1699,11 @@ def handle_mode(irc, numeric, command, args):
log.debug('(%s) relay.handle_mode: Not enforcing invalid modedelta mode %s on %s (list or prefix mode)',
irc.name, str(modepair), target)
continue
elif not irc.has_cap('can-spawn-clients'):
log.debug('(%s) relay.handle_mode: Not enforcing modedelta modes on bot-only network',
irc.name)
continue
modes.remove(modepair)
if relay_entry[0] != irc.name:
@ -2577,6 +2586,10 @@ def modedelta(irc, source, args):
log.warning('(%s) Refusing to set modedelta mode %r on %s because it is a list or prefix mode',
irc.name, mchar, remotechan)
continue
elif not remoteirc.has_cap('can-spawn-clients'):
log.debug('(%s) relay.handle_mode: Not enforcing modedelta modes on bot-only network %s',
irc.name, remoteirc.name)
continue
remote_modes.append(('%s%s' % (modeprefix, mchar), modepair[1]))
if remote_modes:
log.debug('(%s) Sending modedelta modes %s to %s/%s', irc.name, remote_modes, remotenet, remotechan)