From d01b9aaa23da0751f6b76026f23b843bf9c4cd33 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 21 Dec 2017 01:56:04 -0800 Subject: [PATCH] relay: improve fallback KNOCK notices - Show the network that the /knock originated from (it is *not* obvious when we have a user with no relay client) - Specifically hint that users with no relay client cannot be invited directly because there is no client to actually /invite! - Prefer sending the notice to %#channel when halfops are available, as they usually have the power to /invite --- plugins/relay.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index df2aeca..477694c 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -1984,8 +1984,13 @@ def handle_knock(irc, source, command, args): # Fallback to a simple notice directed to ops if use_fallback: - remoteirc.notice(remoteirc.pseudoclient.uid, '@' + remotechan, - "Knock from %s: %s" % (irc.get_friendly_name(source), text)) + nick = irc.get_friendly_name(source) + log.debug('(%s) relay: using fallback KNOCK routine for %s on %s/%s', + irc.name, nick, remoteirc.name, remotechan) + prefix = '%' if 'h' in remoteirc.prefixmodes else '@' + remoteirc.notice(remoteirc.pseudoclient.uid, prefix + remotechan, + "Knock from %s@%s (*not* invitable from this network): %s" % + (nick, irc.name, text)) iterate_all(irc, _handle_knock_loop, extra_args=(source, command, args))