From 52be4d6d0bf21502d301814ba88735fd72a3f284 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 2 May 2013 21:12:36 +0200 Subject: [PATCH] Add possibility to disconnect all connections at once. --- .../java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 2ef14d7..eaaef23 100644 --- a/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java +++ b/src/main/java/net/pterodactylus/xdcc/ui/stdin/CommandReader.java @@ -169,9 +169,15 @@ public class CommandReader extends AbstractExecutionThreadService { } writeLine("End of connections."); } else if (words[0].equalsIgnoreCase("disconnect")) { - Integer index = Ints.tryParse(words[1]); - if ((index != null) && (index < lastConnections.size())) { - core.closeConnection(lastConnections.get(index)); + if ((words.length == 1) || ("all".equals(words[1]))) { + for (Connection connection : lastConnections) { + core.closeConnection(connection); + } + } else { + Integer index = Ints.tryParse(words[1]); + if ((index != null) && (index < lastConnections.size())) { + core.closeConnection(lastConnections.get(index)); + } } } -- 2.7.4