From 597685d77c6d9a9885756a1bdb3dc0677d9d9d25 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 30 Mar 2018 11:14:56 -0700 Subject: [PATCH] relay_clientbot: fix @#channel messages not being treated as channel-specific This is a lighter version of the more comprehensive fix in 2.0[1], which depends on reworked STATUSMSG handling in relay. [1]: https://github.com/GLolol/PyLink/commit/57334183 --- plugins/relay_clientbot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/relay_clientbot.py b/plugins/relay_clientbot.py index ca632fa..f1acebf 100644 --- a/plugins/relay_clientbot.py +++ b/plugins/relay_clientbot.py @@ -59,7 +59,13 @@ def cb_relay_core(irc, source, command, args): real_command = 'ACTION' - elif not utils.isChannel(args['target']): + # We only handle # channels - this skips utils.isChannel() so that + # @#channel messages aren't incorrectly interpreted as non-channel + # specific. + # A more thorough fix for this bug exists in 2.0[1] but depends on + # somewhat invasive changes to how relay handles STATUSMSG entirely. + # [1]: https://github.com/GLolol/PyLink/commit/57334183 + elif '#' not in args['target']: # Target is a user; handle this accordingly. if relay_conf.get('allow_clientbot_pms'): real_command = 'PNOTICE' if args.get('is_notice') else 'PM' @@ -111,7 +117,7 @@ def cb_relay_core(irc, source, command, args): # Figure out where the message is destined to. target = args.get('channel') or args.get('target') - if target is None or not (utils.isChannel(target) or private): + if target is None or not ('#' in target or private): # Non-channel specific message (e.g. QUIT or NICK). If this isn't a PM, figure out # all channels that the sender shares over the relay, and relay them to those # channels.