Don’t try to join channels that require a registration anymore.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 Oct 2014 07:38:27 +0000 (09:38 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 17 Oct 2014 07:38:27 +0000 (09:38 +0200)
src/main/java/net/pterodactylus/xdcc/core/Core.java

index 0cc8294..1ea95a9 100644 (file)
@@ -18,6 +18,7 @@
 package net.pterodactylus.xdcc.core;
 
 import static java.lang.String.format;
+import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.registeredNicknamesOnly;
 import static net.pterodactylus.irc.util.MessageCleaner.getDefaultInstance;
 import static net.pterodactylus.xdcc.data.Channel.TO_NETWORK;
 import static net.pterodactylus.xdcc.data.Download.FILTER_RUNNING;
@@ -545,6 +546,15 @@ public class Core extends AbstractExecutionThreadService {
                        return;
                }
 
+               if (channelNotJoined.reason() == registeredNicknamesOnly) {
+                       Optional<Channel> channel = getChannel(network.get(), channelNotJoined.channel());
+                       if (channel.isPresent()) {
+                               eventBus.post(new GenericMessage(format("Not trying to join %s anymore.", channel.get())));
+                               channels.remove(channel.get());
+                       }
+                       return;
+               }
+
                eventBus.post(new GenericMessage(
                                format("Could not join %s: %s", channelNotJoined.channel(),
                                                channelNotJoined.reason())));