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

relay: drop prefix modes if the target doesn't have a relay clone yet

This fixes modes like ('+v', None) from being accidentally sent by Relay, when Automode happens to set modes before all relay clients are spawned.
This commit is contained in:
James Lu 2016-07-07 22:16:34 -07:00
parent 00766041f3
commit df41dabb71

View File

@ -403,9 +403,9 @@ def getOrigUser(irc, user, targetirc=None):
# Otherwise, use getRemoteUser to find our UID.
res = getRemoteUser(sourceobj, targetirc, remoteuser[1],
spawnIfMissing=False)
log.debug('(%s) relay.getOrigUser: targetirc found, getting %r as '
'remoteuser for %r (looking up %s/%s).', irc.name, res,
remoteuser[1], user, irc.name)
log.debug('(%s) relay.getOrigUser: targetirc found as %s, getting %r as '
'remoteuser for %r (looking up %s/%s).', irc.name, targetirc.name,
res, remoteuser[1], user, irc.name)
return res
else:
return remoteuser
@ -740,6 +740,10 @@ def getSupportedCmodes(irc, remoteirc, channel, modes):
arg = getOrigUser(irc, arg, targetirc=remoteirc) or \
getRemoteUser(irc, remoteirc, arg, spawnIfMissing=False)
if arg is None:
# Relay client for target user doesn't exist yet. Drop the mode.
break
log.debug("(%s) relay.getSupportedCmodes: argument found as (%r, %r) "
"for network %r.",
irc.name, modechar, arg, remoteirc.name)