From 57334183806d2295e251531f235d6e170d539879 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 10 Mar 2018 19:54:33 -0800 Subject: [PATCH] relay_cb: bandaid fix to prevent STATUSMSG messages from being interpreted as non-channel specific --- plugins/relay_clientbot.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/relay_clientbot.py b/plugins/relay_clientbot.py index e6b7088..a102677 100644 --- a/plugins/relay_clientbot.py +++ b/plugins/relay_clientbot.py @@ -60,7 +60,7 @@ def cb_relay_core(irc, source, command, args): real_command = 'ACTION' - elif not irc.is_channel(args['target']): + elif not irc.is_channel(args['target'].lstrip(''.join(irc.prefixmodes.values()))): # Target is a user; handle this accordingly. if relay_conf.get('allow_clientbot_pms'): real_command = 'PNOTICE' if args.get('is_notice') else 'PM' @@ -113,8 +113,12 @@ def cb_relay_core(irc, source, command, args): netname = sourcenet # Figure out where the message is destined to. - target = args.get('channel') or args.get('target') - if target is None or not (irc.is_channel(target) or private): + stripped_target = target = args.get('channel') or args.get('target') + if target is not None: + # HACK: cheap fix to prevent @#channel messages from interpreted as non-channel specific + stripped_target = target.lstrip(''.join(irc.prefixmodes.values())) + + if target is None or not (irc.is_channel(stripped_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. @@ -127,7 +131,7 @@ def cb_relay_core(irc, source, command, args): else: # Pluralize the channel so that we can iterate over it. targets = [target] - args['channel'] = target + args['channel'] = stripped_target log.debug('(%s) relay_cb_core: Relaying event %s to channels: %s', irc.name, real_command, targets) identhost = ''