From: David ‘Bombe’ Roden Date: Wed, 10 Apr 2013 06:24:27 +0000 (+0200) Subject: Keep track of extra channels. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=e622c80c04262cd8e774ea9cf47f23bbcf1fc68c;p=xudocci.git Keep track of extra channels. --- diff --git a/src/main/java/net/pterodactylus/xdcc/core/Core.java b/src/main/java/net/pterodactylus/xdcc/core/Core.java index 96555e3..d253148 100644 --- a/src/main/java/net/pterodactylus/xdcc/core/Core.java +++ b/src/main/java/net/pterodactylus/xdcc/core/Core.java @@ -78,6 +78,9 @@ public class Core extends AbstractIdleService { /** The channels that are currentlymonitored. */ private final Collection joinedChannels = Sets.newHashSet(); + /** The channels that are joined but not configured. */ + private final Collection extraChannels = Sets.newHashSet(); + /** The current network connections. */ private final Map networkConnections = Collections.synchronizedMap(Maps.newHashMap()); @@ -122,6 +125,15 @@ public class Core extends AbstractIdleService { } /** + * Returns all currently joined channels that are not configured. + * + * @return All currently joined but not configured channels + */ + public Collection extraChannels() { + return ImmutableSet.copyOf(extraChannels); + } + + /** * Returns all currently known bots. * * @return All currently known bots @@ -251,6 +263,9 @@ public class Core extends AbstractIdleService { Optional channel = getChannel(network.get(), channelJoined.channel()); if (!channel.isPresent()) { + /* it’s an extra channel. */ + extraChannels.add(new Channel(network.get(), channelJoined.channel())); + logger.info(String.format("Joined extra Channel %s on %s.", channelJoined.channel(), network.get().name())); return; }