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

relay: consistency fixes for the hideoper setting

- Don't enforce +H on /oper when the hideoper option is disabled
- Skip relaying -H if the hideoper option is enabled - closes #629
This commit is contained in:
James Lu 2019-06-26 12:41:26 -07:00
parent c1158fd33a
commit 9a74626d62

View File

@ -1867,10 +1867,19 @@ def handle_mode(irc, numeric, command, args):
# Set hideoper on remote opers, to prevent inflating
# /lusers and various /stats
hideoper_mode = remoteirc.umodes.get('hideoper')
try:
use_hideoper = conf.conf['relay']['hideoper']
except KeyError:
use_hideoper = True
# If Relay oper hiding is enabled, don't allow unsetting +H
if use_hideoper and ('-%s' % hideoper_mode, None) in modes:
modes.remove(('-%s' % hideoper_mode, None))
modes = get_supported_umodes(irc, remoteirc, modes)
if hideoper_mode:
if ('+o', None) in modes:
if ('+o', None) in modes and use_hideoper:
modes.append(('+%s' % hideoper_mode, None))
elif ('-o', None) in modes:
modes.append(('-%s' % hideoper_mode, None))