From: David ‘Bombe’ Roden Date: Wed, 10 Apr 2013 04:50:02 +0000 (+0200) Subject: Add “get” command to command reader. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=aafb2f116a4a53f588e7d912f5f0443e2eae67f3;p=xudocci.git Add “get” command to command reader. --- 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 059d63d..497c5fd 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -29,6 +29,7 @@ import net.pterodactylus.xdcc.data.Bot; import net.pterodactylus.xdcc.data.Pack; import com.google.common.collect.Lists; +import com.google.common.primitives.Ints; import com.google.common.util.concurrent.AbstractExecutionThreadService; /** @@ -109,6 +110,11 @@ public class CommandReader extends AbstractExecutionThreadService { 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"); + } else if (words[0].equalsIgnoreCase("get")) { + Integer index = Ints.tryParse(words[1]); + if ((index != null) && (index < lastResult.size())) { + core.fetch(lastResult.get(index).bot(), lastResult.get(index).pack()); + } } lastLine = line;