3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +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)
# 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) \
or (not irc.connected.is_set()):
continue
user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
real_target = prefix + real_target
log.debug('(%s) relay.handle_messages: sending message to %s from %s on behalf of %s',
irc.name, real_target, user, numeric)
if notice:
remoteirc.proto.notice(user, real_target, text)
else:
remoteirc.proto.message(user, real_target, text)
if user: # If the user doesn't exist, drop the message.
real_target = prefix + real_target
log.debug('(%s) relay.handle_messages: sending message to %s from %s on behalf of %s',
irc.name, real_target, user, numeric)
if notice:
remoteirc.proto.notice(user, real_target, text)
else:
remoteirc.proto.message(user, real_target, text)
else:
# Get the real user that the PM was meant for