From c775ff7d7371d3a4ef8663afca7de364daeda526 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Mon, 17 Nov 2014 07:00:38 +0100 Subject: [PATCH] =?utf8?q?Remove=20all=20bots=20from=20a=20channel=20if=20?= =?utf8?q?we=20can=E2=80=99t=20(re-)join=20a=20channel.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/xdcc/core/Core.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index d4e5155..3414d18 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -577,6 +577,16 @@ public class Core extends AbstractExecutionThreadService { return; } + /* remove all bots for this channel, we might have been kicked. */ + Collection botsToRemove = networkBots.row(network.get()) + .values().stream() + .filter(bot -> bot.channel() + .equalsIgnoreCase(channel.get().name())) + .collect(Collectors.toSet()); + botsToRemove.stream() + .forEach(bot -> networkBots.row(network.get()) + .remove(bot.name())); + if (channelNotJoined.reason() == registeredNicknamesOnly) { channels.remove(channel.get()); eventBus.post(new GenericMessage( -- 2.7.4