From 1e0b0dbc70d53e97ca0b87e488d079c805c95a13 Mon Sep 17 00:00:00 2001 From: James Lu Date: Thu, 7 Jun 2018 13:07:51 -0700 Subject: [PATCH] relay: part the PyLink service bot after relaying other parts on 'delink' This prevents these messages from being overriden by the "Clientbot was force parted" one if the IRCd responds too quickly. --- plugins/relay.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index 55ff110..da841c1 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -499,21 +499,14 @@ def remove_channel(irc, channel): if irc is None: return - if channel not in map(str.lower, irc.serverdata.get('channels', [])): - world.services['pylink'].extra_channels[irc.name].discard(channel) - if irc.pseudoclient: - irc.proto.part(irc.pseudoclient.uid, channel, 'Channel delinked.') - relay = get_relay((irc.name, channel)) if relay: for user in irc.channels[channel].users.copy(): if not isRelayClient(irc, user): relay_part(irc, channel, user) - # Don't ever part the main client from any of its autojoin channels. else: - if user == irc.pseudoclient.uid and channel in \ - irc.serverdata.get('channels', []): - continue + if user == irc.pseudoclient.uid: + continue # We handle parting the main client later. irc.proto.part(user, channel, 'Channel delinked.') # Don't ever quit it either... if user != irc.pseudoclient.uid and not irc.users[user].channels: @@ -521,6 +514,11 @@ def remove_channel(irc, channel): del relayusers[remoteuser][irc.name] irc.proto.quit(user, 'Left all shared channels.') + if channel not in map(str.lower, irc.serverdata.get('channels', [])): + world.services['pylink'].extra_channels[irc.name].discard(channel) + if irc.pseudoclient: + irc.proto.part(irc.pseudoclient.uid, channel, 'Channel delinked.') + def check_claim(irc, channel, sender, chanobj=None): """ Checks whether the sender of a kick/mode change passes CLAIM checks for