3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 11:39:25 +01:00

relay: restore ability to message @#channels across the relay (#91)

This commit is contained in:
James Lu 2015-08-15 00:11:48 -07:00
parent 4382b22138
commit 5daf38d880

View File

@ -313,6 +313,14 @@ def handle_privmsg(irc, numeric, command, args):
return return
relay = findRelay((irc.name, target)) relay = findRelay((irc.name, target))
remoteusers = relayusers[(irc.name, numeric)] remoteusers = relayusers[(irc.name, numeric)]
# HACK: Don't break on sending to @#channel or similar.
try:
prefix, target = target.split('#', 1)
except ValueError:
prefix = ''
else:
target = '#' + target
log.debug('(%s) relay privmsg: prefix is %r, target is %r', irc.name, prefix, target)
if utils.isChannel(target) and relay and numeric not in irc.channels[target].users: if utils.isChannel(target) and relay and numeric not in irc.channels[target].users:
# The sender must be in the target channel to send messages over the relay; # The sender must be in the target channel to send messages over the relay;
# it's the only way we can make sure they have a spawned client on ALL # it's the only way we can make sure they have a spawned client on ALL
@ -324,10 +332,6 @@ def handle_privmsg(irc, numeric, command, args):
if utils.isChannel(target): if utils.isChannel(target):
for netname, user in relayusers[(irc.name, numeric)].items(): for netname, user in relayusers[(irc.name, numeric)].items():
remoteirc = utils.networkobjects[netname] remoteirc = utils.networkobjects[netname]
# HACK: Don't break on sending to @#channel or similar.
prefix, target = target.split('#', 1)
target = '#' + target
log.debug('(%s) relay privmsg: prefix is %r, target is %r', irc.name, prefix, target)
real_target = findRemoteChan(irc, remoteirc, target) real_target = findRemoteChan(irc, remoteirc, target)
if not real_target: if not real_target:
continue continue