From e622c80c04262cd8e774ea9cf47f23bbcf1fc68c Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 10 Apr 2013 08:24:27 +0200 Subject: [PATCH 1/1] Keep track of extra channels. --- src/main/java/net/pterodactylus/xdcc/core/Core.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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; } -- 2.7.4