3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 20:22:45 +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) irc.proto.partClient(irc, irc.pseudoclient.uid, channel)
relay = findRelay((irc.name, channel)) relay = findRelay((irc.name, channel))
if relay: if relay:
all_links = db[relay]['links'].copy() for user in irc.channels[channel].users.copy():
all_links.update((relay,))
log.debug('(%s) removeChannel: all_links: %s', irc.name, all_links)
for user in irc.channels[channel].users:
if not utils.isInternalClient(irc, user): if not utils.isInternalClient(irc, user):
relayPart(irc, channel, 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: else:
rc = remoteirc.channels[remotechan] irc.proto.partClient(irc, user, channel, 'Channel delinked.')
for user in remoteirc.channels[remotechan].users.copy(): if not irc.users[user].channels:
log.debug('(%s) removeChannel: part user %s/%s from %s', irc.name, user, remotenet, remotechan) irc.proto.quitClient(irc, user, 'Left all shared channels.')
if not utils.isInternalClient(remoteirc, user): remoteuser = getLocalUser(irc, user)
relayPart(remoteirc, remotechan, user) del relayusers[remoteuser][irc.name]
@utils.add_cmd @utils.add_cmd
def create(irc, source, args): def create(irc, source, args):