3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-26 04:32:51 +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:
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