From: David ‘Bombe’ Roden Date: Fri, 17 Oct 2014 07:38:27 +0000 (+0200) Subject: Don’t try to join channels that require a registration anymore. X-Git-Url: https://git.pterodactylus.net/?p=xudocci.git;a=commitdiff_plain;h=9ce99900a9d1401c91db97d4de194452c4689526 Don’t try to join channels that require a registration anymore. --- diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 0cc8294..1ea95a9 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -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 = 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())));