3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

relay: don't error if the privmsg source on a remote network is missing

This can happen when someone speaks while a network is initializing, for example.
This commit is contained in:
James Lu 2016-05-01 14:38:51 -07:00
parent bb8a548e74
commit f6a9f0729a

View File

@ -918,19 +918,20 @@ def handle_messages(irc, numeric, command, args):
real_target = getRemoteChan(irc, remoteirc, target) real_target = getRemoteChan(irc, remoteirc, target)
# Don't relay anything back to the source net, or to disconnected networks # Don't relay anything back to the source net, or to disconnected networks
# and networks without a relay for this channel # and networks without a relay for this channel.
if irc.name == name or (not remoteirc.connected.is_set()) or (not real_target) \ if irc.name == name or (not remoteirc.connected.is_set()) or (not real_target) \
or (not irc.connected.is_set()): or (not irc.connected.is_set()):
continue continue
user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False) user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
real_target = prefix + real_target if user: # If the user doesn't exist, drop the message.
log.debug('(%s) relay.handle_messages: sending message to %s from %s on behalf of %s', real_target = prefix + real_target
irc.name, real_target, user, numeric) log.debug('(%s) relay.handle_messages: sending message to %s from %s on behalf of %s',
if notice: irc.name, real_target, user, numeric)
remoteirc.proto.notice(user, real_target, text) if notice:
else: remoteirc.proto.notice(user, real_target, text)
remoteirc.proto.message(user, real_target, text) else:
remoteirc.proto.message(user, real_target, text)
else: else:
# Get the real user that the PM was meant for # Get the real user that the PM was meant for