- 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());
+ int totalBotCount = 0;
+ int totalPackCount = 0;
+ for (ConnectedNetwork network : core.connectedNetworks()) {
+ dumpNetworkStats(outputWriter, network);
+ totalBotCount += network.getBotCount();
+ totalPackCount += network.getPackCount();
+ }
+ outputWriter.write(format("Total: %d bots, %d packs.\n", totalBotCount, totalPackCount));
+ return state;
+ }
+
+ private void dumpNetworkStats(Writer outputWriter,
+ ConnectedNetwork network) throws IOException {
+ outputWriter.write(format("Connected to %s via %s:%d.\n",
+ network.getNetwork().name(), network.getHostname(),
+ network.getPort(), network.getNickname()));
+ String joinedChannels = joinChannelNames(network.getChannels());
+ String forcedChannels = joinChannelNames(network.getForcedChannels());
+ if (forcedChannels.isEmpty()) {
+ if (!joinedChannels.isEmpty()) {
+ outputWriter.write(format(" Joined %s.\n", joinedChannels));
+ }
+ } else {
+ if (joinedChannels.isEmpty()) {
+ outputWriter.write(
+ format(" Force-joined %s.\n", forcedChannels));
+ } else {
+ outputWriter.write(format(" Joined %s, force-joined %s.\n",
+ joinedChannels, forcedChannels));