From 0e84cf6dbee5bc509d5e3d64c3347a3046810d9d Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 15 Oct 2014 22:24:29 +0200 Subject: [PATCH] Remove channel from joined channels when we were kicked. --- src/main/java/net/pterodactylus/xdcc/core/Core.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index ac9ac4d..8d983d5 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -599,6 +599,19 @@ public class Core extends AbstractExecutionThreadService { /* have we been kicked? */ if (nicknameMatchesConnection(kickedFromChannel.connection(), kickedFromChannel.kickee())) { + Optional channel = getChannel(network.get(), kickedFromChannel.channel()); + if (!channel.isPresent()) { + /* maybe it was an extra channel? */ + channel = getExtraChannel(network.get(), kickedFromChannel.channel()); + if (!channel.isPresent()) { + /* okay, whatever. */ + return; + } + + extraChannels.remove(channel); + } else { + channels.remove(channel.get()); + } eventBus.post(new GenericMessage(format( "Kicked from %s/%s by %s: %s", kickedFromChannel.channel(), network.get(), -- 2.7.4