3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +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. # Otherwise, use getRemoteUser to find our UID.
res = getRemoteUser(sourceobj, targetirc, remoteuser[1], res = getRemoteUser(sourceobj, targetirc, remoteuser[1],
spawnIfMissing=False) spawnIfMissing=False)
log.debug('(%s) relay.getOrigUser: targetirc found, getting %r as ' log.debug('(%s) relay.getOrigUser: targetirc found as %s, getting %r as '
'remoteuser for %r (looking up %s/%s).', irc.name, res, 'remoteuser for %r (looking up %s/%s).', irc.name, targetirc.name,
remoteuser[1], user, irc.name) res, remoteuser[1], user, irc.name)
return res return res
else: else:
return remoteuser return remoteuser
@ -740,6 +740,10 @@ def getSupportedCmodes(irc, remoteirc, channel, modes):
arg = getOrigUser(irc, arg, targetirc=remoteirc) or \ arg = getOrigUser(irc, arg, targetirc=remoteirc) or \
getRemoteUser(irc, remoteirc, arg, spawnIfMissing=False) 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) " log.debug("(%s) relay.getSupportedCmodes: argument found as (%r, %r) "
"for network %r.", "for network %r.",
irc.name, modechar, arg, remoteirc.name) irc.name, modechar, arg, remoteirc.name)