Remove channel from joined channels when we were kicked.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 15 Oct 2014 20:24:29 +0000 (22:24 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 15 Oct 2014 20:24:29 +0000 (22:24 +0200)
src/main/java/net/pterodactylus/xdcc/core/Core.java

index ac9ac4d..8d983d5 100644 (file)
@@ -599,6 +599,19 @@ public class Core extends AbstractExecutionThreadService {
 
                /* have we been kicked? */
                if (nicknameMatchesConnection(kickedFromChannel.connection(), kickedFromChannel.kickee())) {
+                       Optional<Channel> 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(),