Expose currently joined channels.
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / core / Core.java
index e95cf0e..de4c842 100644 (file)
@@ -48,6 +48,7 @@ import net.pterodactylus.xdcc.data.Server;
 
 import com.google.common.base.Optional;
 import com.google.common.collect.HashBasedTable;
+import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
@@ -73,6 +74,9 @@ public class Core extends AbstractIdleService {
        /** The channels that should be monitored. */
        private final Collection<Channel> channels = Sets.newHashSet();
 
+       /** The channels that are currentlymonitored. */
+       private final Collection<Channel> joinedChannels = Sets.newHashSet();
+
        /** The current network connections. */
        private final Map<Network, Connection> networkConnections = Collections.synchronizedMap(Maps.<Network, Connection>newHashMap());
 
@@ -98,6 +102,25 @@ public class Core extends AbstractIdleService {
        //
 
        /**
+        * Returns all configured channels. Due to various circumstances, configured
+        * channels might not actually be joined.
+        *
+        * @return All configured channels
+        */
+       public Collection<Channel> channels() {
+               return ImmutableSet.copyOf(channels);
+       }
+
+       /**
+        * Returns all currently joined channels.
+        *
+        * @return All currently joined channels
+        */
+       public Collection<Channel> joinedChannels() {
+               return ImmutableSet.copyOf(joinedChannels);
+       }
+
+       /**
         * Returns all currently known bots.
         *
         * @return All currently known bots