3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-24 19:24:13 +01:00

relay_cb: bandaid fix to prevent STATUSMSG messages from being interpreted as non-channel specific

This commit is contained in:
James Lu 2018-03-10 19:54:33 -08:00
parent b6bac994c6
commit 5733418380

View File

@ -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 = ''