mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 09:19:23 +01:00
relay: fake revert mode changes we couldn't bounce (#23)
This allows services to revert mode changes CLAIM was not happy with, instead of causing another mode war during this process.
This commit is contained in:
parent
dcab011673
commit
ed4404bf4b
@ -1884,7 +1884,6 @@ def handle_mode(irc, numeric, command, args):
|
|||||||
for named_modepair in modedelta_modes]))
|
for named_modepair in modedelta_modes]))
|
||||||
|
|
||||||
if not check_claim(irc, target, numeric, chanobj=oldchan):
|
if not check_claim(irc, target, numeric, chanobj=oldchan):
|
||||||
if _claim_should_bounce(irc, target):
|
|
||||||
# Mode change blocked by CLAIM.
|
# Mode change blocked by CLAIM.
|
||||||
reversed_modes = irc.reverse_modes(target, modes, oldobj=oldchan)
|
reversed_modes = irc.reverse_modes(target, modes, oldobj=oldchan)
|
||||||
|
|
||||||
@ -1931,9 +1930,14 @@ def handle_mode(irc, numeric, command, args):
|
|||||||
irc.name, str(modepair), target)
|
irc.name, str(modepair), target)
|
||||||
|
|
||||||
if reversed_modes:
|
if reversed_modes:
|
||||||
log.debug('(%s) relay.handle_mode: Reversing mode changes of %r with %r.',
|
if _claim_should_bounce(irc, target):
|
||||||
irc.name, args['modes'], reversed_modes)
|
log.debug('(%s) relay.handle_mode: Reversing mode changes %r on %s with %r.',
|
||||||
|
irc.name, args['modes'], target, reversed_modes)
|
||||||
irc.mode(irc.sid, target, reversed_modes)
|
irc.mode(irc.sid, target, reversed_modes)
|
||||||
|
else:
|
||||||
|
log.debug('(%s) relay.handle_mode: Fake reversing mode changes %r on %s with %r.',
|
||||||
|
irc.name, args['modes'], target, reversed_modes)
|
||||||
|
irc.apply_modes(target, reversed_modes)
|
||||||
|
|
||||||
if modes:
|
if modes:
|
||||||
iterate_all(irc, _handle_mode_loop, extra_args=(numeric, command, target, modes))
|
iterate_all(irc, _handle_mode_loop, extra_args=(numeric, command, target, modes))
|
||||||
|
Loading…
Reference in New Issue
Block a user