Add command to show active DCC receivers.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 10 Apr 2013 04:48:14 +0000 (06:48 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 10 Apr 2013 04:48:14 +0000 (06:48 +0200)
src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java

index 17d2389..059d63d 100644 (file)
@@ -23,6 +23,7 @@ import java.io.Writer;
 import java.util.Collections;
 import java.util.List;
 
+import net.pterodactylus.irc.DccReceiver;
 import net.pterodactylus.xdcc.core.Core;
 import net.pterodactylus.xdcc.data.Bot;
 import net.pterodactylus.xdcc.data.Pack;
@@ -102,6 +103,12 @@ public class CommandReader extends AbstractExecutionThreadService {
                                        writer.write(String.format("[%d] %s (%s) from %s (#%s) on %s\n", counter++, result.pack().name(), result.pack().size(), result.bot().name(), result.pack().id(), result.bot().network().name()));
                                }
                                writer.write("End of Search.\n");
+                       } else if (words[0].equalsIgnoreCase("dcc")) {
+                               int counter = 0;
+                               for (DccReceiver dccReceiver : core.dccReceivers()) {
+                                       writer.write(String.format("[%d] %s (%s, %d%%%s)\n", counter++, dccReceiver.filename(), dccReceiver.size(), dccReceiver.progress() * 100 / dccReceiver.size(), dccReceiver.isRunning() ? "" : ", finished"));
+                               }
+                               writer.write("End of DCCs.\n");
                        }
 
                        lastLine = line;