From a9be5d0dc7005c8005516a2acf9b84adcc095d03 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 23 Jul 2016 11:20:52 -0700 Subject: [PATCH] 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.) --- plugins/relay.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/relay.py b/plugins/relay.py index 9e1400c..2397f53 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -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