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

coreplugin: optionally respect umode +H (hideoper) (#214)

This commit is contained in:
James Lu 2016-05-20 20:48:41 -07:00
parent 3856ee435c
commit 4cfc262bfb
2 changed files with 19 additions and 9 deletions

View File

@ -111,9 +111,15 @@ def handle_whois(irc, source, command, args):
f(server, 312, source, "%s %s :%s" % (nick, irc.servers[server].name, f(server, 312, source, "%s %s :%s" % (nick, irc.servers[server].name,
irc.servers[server].desc)) irc.servers[server].desc))
# 313: sends a string denoting the target's operator privilege, # 313: sends a string denoting the target's operator privilege if applicable.
# only if they have umode +o.
if ('o', None) in user.modes: if ('o', None) in user.modes:
# Check hideoper status. Require that either:
# 1) +H is not set
# 2) +H is set, but the caller is oper
# 3) +H is set, but whois_use_hideoper is disabled in config
isHideOper = (irc.umodes.get('hideoper'), None) in user.modes
if (not isHideOper) or (isHideOper and sourceisOper) or \
(isHideOper and not irc.botdata.get('whois_use_hideoper', True)):
# Let's be gramatically correct. (If the opertype starts with a vowel, # Let's be gramatically correct. (If the opertype starts with a vowel,
# write "an Operator" instead of "a Operator") # write "an Operator" instead of "a Operator")
n = 'n' if user.opertype[0].lower() in 'aeiou' else '' n = 'n' if user.opertype[0].lower() in 'aeiou' else ''

View File

@ -26,6 +26,10 @@ bot:
prefixes: prefixes:
games: "@" games: "@"
# Determines whether hideoper modes should be respected in WHOIS responses.
# Defaults to true if not specified.
whois_use_hideoper: true
login: login:
# PyLink administrative login - Change this, or the service will not start! # PyLink administrative login - Change this, or the service will not start!
user: admin user: admin