3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-18 08:02:51 +01:00

relay: make oper status/IP hiding configurable

Closes #108.
This commit is contained in:
James Lu 2015-09-19 10:17:25 -07:00
parent c3e8420aa0
commit 6ee2ec8a2d
2 changed files with 33 additions and 2 deletions

View File

@ -20,6 +20,22 @@ login:
user: admin user: admin
password: changeme password: changeme
relay:
# This block defines various options for the Relay plugin. You don't need this
# if you aren't using it.
# Determines whether remote opers will have user mode +H (hideoper) set on them.
# This has the benefit of lowering the oper count in /lusers and /stats (P|p),
# but only on IRCds that supported the mode.
# It defaults to true if not set.
hideoper: true
# Determines whether real IPs should be sent across the relay. You should
# generally have a consensus with your linked networks whether this should
# be turned on. You will see other networks' user IP addresses, and they
# will see yours.
show_ips: false
servers: servers:
yournet: yournet:
# Server IP, port, and passwords # Server IP, port, and passwords

View File

@ -203,14 +203,29 @@ def getRemoteUser(irc, remoteirc, user, spawnIfMissing=True):
# Set hideoper on remote opers, to prevent inflating # Set hideoper on remote opers, to prevent inflating
# /lusers and various /stats # /lusers and various /stats
hideoper_mode = remoteirc.umodes.get('hideoper') hideoper_mode = remoteirc.umodes.get('hideoper')
if hideoper_mode: try:
use_hideoper = irc.conf['relay']['hideoper']
except KeyError:
use_hideoper = True
if hideoper_mode and use_hideoper:
modes.append((hideoper_mode, None)) modes.append((hideoper_mode, None))
rsid = getRemoteSid(remoteirc, irc) rsid = getRemoteSid(remoteirc, irc)
try:
showRealIP = irc.conf['relay']['show_ips']
except KeyError:
showRealIP = False
if showRealIP:
ip = userobj.ip
realhost = userobj.realhost
else:
realhost = None
ip = '0.0.0.0'
try: try:
u = remoteirc.proto.spawnClient(nick, ident=ident, u = remoteirc.proto.spawnClient(nick, ident=ident,
host=host, realname=realname, host=host, realname=realname,
modes=modes, ts=userobj.ts, modes=modes, ts=userobj.ts,
opertype=opertype, server=rsid).uid opertype=opertype, server=rsid,
ip=ip, realhost=realhost).uid
except ValueError: except ValueError:
log.exception('(%s) Failed to spawn relay user %s on %s.', irc.name, log.exception('(%s) Failed to spawn relay user %s on %s.', irc.name,
nick, remoteirc.name) nick, remoteirc.name)