3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

relay: don't relay as text modes being set on netburst (#627)

This commit is contained in:
James Lu 2018-09-21 21:53:34 -07:00
parent 2f4476eb0c
commit a3e18081a6

View File

@ -1751,28 +1751,31 @@ def handle_mode(irc, numeric, command, args):
get_relay_server_sid(remoteirc, irc) or remoteirc.sid get_relay_server_sid(remoteirc, irc) or remoteirc.sid
if not remoteirc.has_cap('can-spawn-clients'): if not remoteirc.has_cap('can-spawn-clients'):
friendly_modes = [] if numeric in irc.servers and not irc.servers[numeric].has_eob:
log.debug('(%s) Not relaying modes from server %s/%s to %s as it has not finished bursting',
irc.name, numeric, irc.get_friendly_name(numeric), remoteirc.name)
else:
friendly_modes = []
for modepair in modes:
modechar = modepair[0][-1]
if modechar in irc.prefixmodes:
orig_user = get_orig_user(irc, modepair[1])
if orig_user and orig_user[0] == remoteirc.name:
# Don't display prefix mode changes for someone on the target clientbot
# link; this will either be relayed via modesync or ignored.
continue
for modepair in modes: # Convert UIDs to nicks when relaying this to clientbot.
modechar = modepair[0][-1] modepair = (modepair[0], irc.get_friendly_name(modepair[1]))
if modechar in irc.prefixmodes: elif modechar in irc.cmodes['*A'] and irc.is_hostmask(modepair[1]) and \
orig_user = get_orig_user(irc, modepair[1]) conf.conf.get('relay', {}).get('clientbot_modesync', 'none').lower() != 'none':
if orig_user and orig_user[0] == remoteirc.name: # Don't show bans if the ban is a simple n!u@h and modesync is enabled
# Don't display prefix mode changes for someone on the target clientbot
# link; this will either be relayed via modesync or ignored.
continue continue
friendly_modes.append(modepair)
# Convert UIDs to nicks when relaying this to clientbot. if friendly_modes:
modepair = (modepair[0], irc.get_friendly_name(modepair[1])) # Call hooks, this is used for clientbot relay.
elif modechar in irc.cmodes['*A'] and irc.is_hostmask(modepair[1]) and \ remoteirc.call_hooks([remotesender, 'RELAY_RAW_MODE', {'channel': remotechan, 'modes': friendly_modes}])
conf.conf.get('relay', {}).get('clientbot_modesync', 'none').lower() != 'none':
# Don't show bans if the ban is a simple n!u@h and modesync is enabled
continue
friendly_modes.append(modepair)
if friendly_modes:
# Call hooks, this is used for clientbot relay.
remoteirc.call_hooks([remotesender, 'RELAY_RAW_MODE', {'channel': remotechan, 'modes': friendly_modes}])
if supported_modes: if supported_modes:
remoteirc.mode(remotesender, remotechan, supported_modes) remoteirc.mode(remotesender, remotechan, supported_modes)