From aafb2f116a4a53f588e7d912f5f0443e2eae67f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 10 Apr 2013 06:50:02 +0200 Subject: [PATCH] =?utf8?q?Add=20=E2=80=9Cget=E2=80=9D=20command=20to=20com?= =?utf8?q?mand=20reader.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.7.4