3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-26 04:32:51 +01:00

relay: hack to support sending to @#channel, etc.

This commit is contained in:
James Lu 2015-07-20 13:45:15 -07:00
parent b1e409ff3e
commit 2bc0a65128

View File

@ -273,10 +273,19 @@ def handle_privmsg(irc, numeric, command, args):
return return
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.
try:
prefix, target = target.split('#', 1)
except ValueError:
prefix = ''
else:
target = '#' + target
if utils.isChannel(target): if utils.isChannel(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
real_target = prefix + real_target
else: else:
remoteuser = getLocalUser(irc, target) remoteuser = getLocalUser(irc, target)
if remoteuser is None: if remoteuser is None: