3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +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

(cherry picked from commit 9a74626d62)
This commit is contained in:
James Lu 2019-06-26 12:41:26 -07:00
parent 2cdcd8e193
commit e02ab9f2ff

View File

@ -1766,10 +1766,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))