import java.io.BufferedReader;
import java.io.Reader;
import java.io.Writer;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
+import java.util.Set;
import net.pterodactylus.irc.DccReceiver;
import net.pterodactylus.xdcc.core.Core;
import net.pterodactylus.xdcc.data.Pack;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import com.google.common.primitives.Ints;
import com.google.common.util.concurrent.AbstractExecutionThreadService;
if ((index != null) && (index < lastResult.size())) {
core.fetch(lastResult.get(index).bot(), lastResult.get(index).pack());
}
+ } else if (words[0].equalsIgnoreCase("stats")) {
+ int configuredChannelsCount = core.channels().size();
+ int joinedChannelsCount = core.joinedChannels().size();
+ int extraChannelsCount = core.extraChannels().size();
+ Collection<Bot> bots = core.bots();
+ Set<String> packNames = Sets.newHashSet();
+ int packsCount = 0;
+ for (Bot bot : bots) {
+ packsCount += bot.packs().size();
+ for (Pack pack : bot) {
+ packNames.add(pack.name());
+ }
+ }
+
+ writer.write(String.format("%d channels (%d joined, %d extra), %d bots offering %d packs (%d unique).\n", configuredChannelsCount, joinedChannelsCount, extraChannelsCount, bots.size(), packsCount, packNames.size()));
}
lastLine = line;