3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-26 12:43:09 +01:00

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.
This commit is contained in:
James Lu 2018-06-07 13:07:51 -07:00
parent 83a7f14b5a
commit 1e0b0dbc70

View File

@ -499,21 +499,14 @@ def remove_channel(irc, channel):
if irc is None: if irc is None:
return 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)) relay = get_relay((irc.name, channel))
if relay: if relay:
for user in irc.channels[channel].users.copy(): for user in irc.channels[channel].users.copy():
if not isRelayClient(irc, user): if not isRelayClient(irc, user):
relay_part(irc, channel, user) relay_part(irc, channel, user)
# Don't ever part the main client from any of its autojoin channels.
else: else:
if user == irc.pseudoclient.uid and channel in \ if user == irc.pseudoclient.uid:
irc.serverdata.get('channels', []): continue # We handle parting the main client later.
continue
irc.proto.part(user, channel, 'Channel delinked.') irc.proto.part(user, channel, 'Channel delinked.')
# Don't ever quit it either... # Don't ever quit it either...
if user != irc.pseudoclient.uid and not irc.users[user].channels: 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] del relayusers[remoteuser][irc.name]
irc.proto.quit(user, 'Left all shared channels.') 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): def check_claim(irc, channel, sender, chanobj=None):
""" """
Checks whether the sender of a kick/mode change passes CLAIM checks for Checks whether the sender of a kick/mode change passes CLAIM checks for