mirror of
https://github.com/jlu5/PyLink.git
synced 2025-03-01 20:10:44 +01:00
relay: optionally relay home server & login details in /WHOIS
Closes #221. Closes #222.
This commit is contained in:
parent
4e8de60005
commit
357eabe27a
@ -349,3 +349,15 @@ relay:
|
||||
# Whether subservers should be spawned for each relay network (requires
|
||||
# reloading the plugin to change). Defaults to true.
|
||||
spawn_servers: true
|
||||
|
||||
# Determines whether NickServ login info should be shown in the /whois output for
|
||||
# relay users. This works on most IRCds EXCEPT InspIRCd.
|
||||
# Valid options include "all" (show this to everyone), "opers" (show only to
|
||||
# opers), and "none" (disabled). Defaults to none if not specified.
|
||||
whois_show_accounts: all
|
||||
|
||||
# Determines whether the origin server should be shown in the /whois output for
|
||||
# relay users. This works on most IRCds EXCEPT InspIRCd.
|
||||
# Valid options include "all" (show this to everyone), "opers" (show only to
|
||||
# opers), and "none" (disabled). Defaults to none if not specified.
|
||||
whois_show_server: opers
|
||||
|
@ -793,6 +793,16 @@ def handle_relay_whois(irc, source, command, args):
|
||||
text = '%s %s' % (targetuser.nick, text)
|
||||
irc.proto.numeric(server, num, source, text)
|
||||
|
||||
def checkSendKey(infoline):
|
||||
"""
|
||||
Returns whether we should send the given info line in WHOIS. This validates the
|
||||
corresponding configuration option for being either "all" or "opers"."""
|
||||
setting = irc.conf.get('relay', {}).get(infoline, '').lower()
|
||||
if setting == 'all':
|
||||
return True
|
||||
elif setting == 'opers' and irc.isOper(source, allowAuthed=False):
|
||||
return True
|
||||
return False
|
||||
|
||||
# Get the real user for the WHOIS target.
|
||||
origuser = getOrigUser(irc, target)
|
||||
@ -805,6 +815,16 @@ def handle_relay_whois(irc, source, command, args):
|
||||
wreply(320, ":is a remote user connected via PyLink Relay. Home network: %s; "
|
||||
"Home nick: %s" % (netname, realuser.nick))
|
||||
|
||||
if checkSendKey('whois_show_accounts') and realuser.services_account:
|
||||
# Send account information if told to and the target is logged in.
|
||||
wreply(330, "%s :is logged in (on %s) as" % (realuser.services_account, netname))
|
||||
|
||||
if checkSendKey('whois_show_server'):
|
||||
wreply(320, ":is actually connected via the following server:")
|
||||
realserver = realirc.getServer(uid)
|
||||
realserver = realirc.servers[realserver]
|
||||
wreply(312, "%s :%s" % (realserver.name, realserver.desc))
|
||||
|
||||
utils.add_hook(handle_relay_whois, 'PYLINK_CUSTOM_WHOIS')
|
||||
|
||||
def handle_operup(irc, numeric, command, args):
|
||||
|
Loading…
x
Reference in New Issue
Block a user