3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-25 19:54:25 +01:00

relay: cleanup code flow in handle_mode

This commit is contained in:
James Lu 2017-08-05 21:13:26 -07:00
parent 4379ef68ef
commit b9a58670ef

View File

@ -773,15 +773,12 @@ def get_supported_cmodes(irc, remoteirc, channel, modes):
# Iterate over every mode see whether the remote IRCd supports # Iterate over every mode see whether the remote IRCd supports
# this mode, and what its mode char for it is (if it is different). # this mode, and what its mode char for it is (if it is different).
for name, m in irc.cmodes.items(): for name, m in irc.cmodes.items():
supported_char = None
if name.startswith('*'): if name.startswith('*'):
# XXX: Okay, we need a better place to store modetypes. # XXX: Okay, we need a better place to store modetypes.
continue continue
if modechar == m: if modechar == m:
supported_char = remoteirc.cmodes.get(name) supported_char = remoteirc.cmodes.get(name)
if supported_char is None: if supported_char is None:
break break
@ -827,9 +824,6 @@ def get_supported_cmodes(irc, remoteirc, channel, modes):
irc.name, name, arg, remoteirc.name) irc.name, name, arg, remoteirc.name)
break break
supported_char = remoteirc.cmodes.get(name)
if supported_char:
final_modepair = (prefix+supported_char, arg) final_modepair = (prefix+supported_char, arg)
if name in ('ban', 'banexception', 'invex') and not utils.isHostmask(arg): if name in ('ban', 'banexception', 'invex') and not utils.isHostmask(arg):
# Don't add bans that don't match n!u@h syntax! # Don't add bans that don't match n!u@h syntax!
@ -845,6 +839,7 @@ def get_supported_cmodes(irc, remoteirc, channel, modes):
break break
supported_modes.append(final_modepair) supported_modes.append(final_modepair)
break
log.debug('(%s) relay.get_supported_cmodes: final modelist (sending to %s%s) is %s', irc.name, remoteirc.name, remotechan, supported_modes) log.debug('(%s) relay.get_supported_cmodes: final modelist (sending to %s%s) is %s', irc.name, remoteirc.name, remotechan, supported_modes)
return supported_modes return supported_modes