Add possibility to cancel a running download.
[xudocci.git] / src / main / java / net / pterodactylus / xdcc / ui / stdin / CommandReader.java
index 26696f9..3714956 100644 (file)
@@ -155,6 +155,11 @@ public class CommandReader extends AbstractExecutionThreadService {
                                if ((index != null) && (index < lastResult.size())) {
                                        core.fetch(lastResult.get(index).bot(), lastResult.get(index).pack());
                                }
+                       } else if (words[0].equalsIgnoreCase("cancel")) {
+                               Integer index = Ints.tryParse(words[1]);
+                               if ((index != null) && (index < lastResult.size())) {
+                                       core.cancelDownload(lastResult.get(index).bot(), lastResult.get(index).pack());
+                               }
                        } else if (words[0].equalsIgnoreCase("stats")) {
                                int configuredChannelsCount = core.channels().size();
                                int joinedChannelsCount = core.joinedChannels().size();