From: David ‘Bombe’ Roden Date: Wed, 10 Apr 2013 04:48:14 +0000 (+0200) Subject: Add command to show active DCC receivers. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d2f154dff1ee55b23fab7576a9c50063065d40d4;p=xudocci.git Add command to show active DCC receivers. --- diff --git a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java index 17d2389..059d63d 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -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;