From 3df0a242327423c5a7d0d48176d0de6749058450 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 26 Nov 2015 22:51:19 -0800 Subject: [PATCH] relay: catch PRIVMSG/NOTICE sent from servers, and relay them via the PyLink client instead of erroring --- plugins/relay.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/relay.py b/plugins/relay.py index 49500a4..738436c 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -707,6 +707,18 @@ def handle_messages(irc, numeric, command, args): target = args['target'] text = args['text'] if utils.isInternalClient(irc, numeric) and utils.isInternalClient(irc, target): + # Drop attempted PMs between internal clients (this shouldn't happen, + # but whatever). + return + elif numeric in irc.servers: + # Sender is a server? This shouldn't be allowed, except for some truly + # special cases... We'll route these through the main PyLink client, + # tagging the message with the sender name. + text = '[from %s] %s' % (irc.servers[numeric].name, text) + numeric = irc.pseudoclient.uid + elif numeric not in irc.users: + # Sender didn't pass the check above, AND isn't a user. + log.debug('(%s) relay: Unknown message sender %s.', numeric) return relay = getRelay((irc.name, target)) remoteusers = relayusers[(irc.name, numeric)]