Treat invite-only channels as banned.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 13 Jan 2015 21:12:07 +0000 (22:12 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 13 Jan 2015 21:12:07 +0000 (22:12 +0100)
src/main/java/net/pterodactylus/xdcc/core/Core.java

index e24fa2f..b020c1a 100644 (file)
@@ -19,6 +19,7 @@ package net.pterodactylus.xdcc.core;
 
 import static java.lang.String.format;
 import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.banned;
+import static net.pterodactylus.irc.event.ChannelNotJoined.Reason.inviteOnly;
 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;
@@ -660,6 +661,13 @@ public class Core extends AbstractExecutionThreadService {
                                        format("Not trying to join %s anymore.", channel.get())));
                        return;
                }
+               if (channelNotJoined.reason() == inviteOnly) {
+                       channelBanManager.ban(channel.get());
+                       eventBus.post(new GenericMessage(
+                                       format("%s is invite-only, suspending join for a day.",
+                                                       channel.get())));
+                       return;
+               }
                if (channelNotJoined.reason() == banned) {
                        channelBanManager.ban(channel.get());
                        eventBus.post(new GenericMessage(