3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 13:09:23 +01:00

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
This commit is contained in:
James Lu 2017-12-21 01:56:04 -08:00
parent f64976b1ed
commit d01b9aaa23

View File

@ -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))