From: David ‘Bombe’ Roden Date: Mon, 17 Nov 2014 06:00:38 +0000 (+0100) Subject: Remove all bots from a channel if we can’t (re-)join a channel. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c775ff7d7371d3a4ef8663afca7de364daeda526;p=xudocci.git Remove all bots from a channel if we can’t (re-)join a channel. --- 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(