3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

relay: treat kicks to the service bot on clientbot networks as clear channel

This is so if the bot is kickbanned from a channel, it will remove all users to prevent ghosts on the channel.

* cbot.relay has kicked ChanServ/cbot from #test ((xdxdxd.xdxdxd/cbot) Clientbot was kicked from channel.)
This commit is contained in:
James Lu 2016-07-23 11:20:52 -07:00
parent 88e510b4cf
commit a9be5d0dc7

View File

@ -363,7 +363,6 @@ def getRemoteUser(irc, remoteirc, user, spawnIfMissing=True, times_tagged=0):
spawning one if it doesn't exist and spawnIfMissing is True."""
# Wait until the network is working before trying to spawn anything.
log.debug('(%s) getRemoteUser: waiting for irc.connected', irc.name)
irc.connected.wait(5)
# Don't spawn clones for registered service bots.
@ -1071,6 +1070,15 @@ def handle_kick(irc, source, command, args):
kicker = source
relay = getRelay((irc.name, channel))
# Special case for clientbot: treat kicks to the PyLink service bot as channel clear.
if irc.protoname == 'clientbot' and irc.pseudoclient and target == irc.pseudoclient.uid:
for user in irc.channels[channel].users:
if (not irc.isInternalClient(user)) and (not isRelayClient(irc, user)):
irc.callHooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user,
'text': 'Clientbot was kicked from channel.', 'parse_as': 'KICK'}])
return
# Don't relay kicks to protected service bots.
if relay is None or irc.isServiceBot(target):
return