3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 19:52:53 +01:00

relay: fix DELINK delinking more networks than the current one

This commit is contained in:
James Lu 2015-07-21 20:18:35 -07:00
parent a04bce99c1
commit 6abb56921e

View File

@ -633,27 +633,15 @@ def removeChannel(irc, channel):
irc.proto.partClient(irc, irc.pseudoclient.uid, channel)
relay = findRelay((irc.name, channel))
if relay:
all_links = db[relay]['links'].copy()
all_links.update((relay,))
log.debug('(%s) removeChannel: all_links: %s', irc.name, all_links)
for user in irc.channels[channel].users:
for user in irc.channels[channel].users.copy():
if not utils.isInternalClient(irc, user):
relayPart(irc, channel, user)
for link in all_links:
if link[0] == irc.name:
# Don't relay things to their source network...
continue
remotenet, remotechan = link
try:
remoteirc = utils.networkobjects[remotenet]
except KeyError:
continue
else:
rc = remoteirc.channels[remotechan]
for user in remoteirc.channels[remotechan].users.copy():
log.debug('(%s) removeChannel: part user %s/%s from %s', irc.name, user, remotenet, remotechan)
if not utils.isInternalClient(remoteirc, user):
relayPart(remoteirc, remotechan, user)
irc.proto.partClient(irc, user, channel, 'Channel delinked.')
if not irc.users[user].channels:
irc.proto.quitClient(irc, user, 'Left all shared channels.')
remoteuser = getLocalUser(irc, user)
del relayusers[remoteuser][irc.name]
@utils.add_cmd
def create(irc, source, args):