From 18d3536ffe6fdcd15864539041bc33ff1581797d Mon Sep 17 00:00:00 2001 From: sponge <sponge@mail.i2p> Date: Wed, 1 Jun 2011 03:59:12 +0000 Subject: [PATCH] ConfigClients stopClient stubbed out. --- .../i2p/router/web/ConfigClientsHandler.java | 31 ++++++++++++++++--- .../i2p/router/web/ConfigClientsHelper.java | 7 ++++- history.txt | 3 ++ 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java index 9a5d6bbf9..abf1c1c8b 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHandler.java @@ -95,13 +95,22 @@ public class ConfigClientsHandler extends FormHandler { // value if (_action.startsWith("Stop ")) { + String app = _action.substring(5); + int appnum = -1; try { - PluginStarter.stopPlugin(_context, app); - addFormNotice(_("Stopped plugin {0}", app)); - } catch (Throwable e) { - addFormError(_("Error stopping plugin {0}", app) + ": " + e); + appnum = Integer.parseInt(app); + } catch (NumberFormatException nfe) {} + if (appnum >= 0) { + stopClient(appnum); + } else { + try { + PluginStarter.stopPlugin(_context, app); + addFormNotice(_("Stopped plugin {0}", app)); + } catch (Throwable e) { + addFormError(_("Error stopping plugin {0}", app) + ": " + e); _log.error("Error stopping plugin " + app, e); + } } return; } @@ -201,6 +210,20 @@ public class ConfigClientsHandler extends FormHandler { return arr[0].trim(); } + // STUB for stopClient, not completed yet. + private void stopClient(int i) { + List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context); + if (i >= clients.size()) { + addFormError(_("Bad client index.")); + return; + } + ClientAppConfig ca = clients.get(i); + // + // What do we do here? + // + addFormNotice(_("Client") + ' ' + _(ca.clientName) + ' ' + _("stopped") + '.'); + } + private void startClient(int i) { List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context); if (i >= clients.size()) { diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java index 352df72ee..a6fe4ee87 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigClientsHelper.java @@ -109,7 +109,12 @@ public class ConfigClientsHelper extends HelperBase { //"webConsole".equals(ca.clientName) || "Web console".equals(ca.clientName), false, ca.className + ((ca.args != null) ? " " + ca.args : ""), (""+cur).equals(_edit), - true, false, false, true, ca.disabled); + true, false, + // Enable this one and comment out the false below once the stub is filled in. + //!ca.disabled && !("webConsole".equals(ca.clientName) || "Web console".equals(ca.clientName)), + false, + + true, ca.disabled); } if ("new".equals(_edit)) diff --git a/history.txt b/history.txt index fbab25321..941f5b433 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2011-06-01 sponge + * ConfigClients stopClient stubbed out. + 2011-06-01 sponge * Re the below, using better way that kytv suggested. There is more than one way to peel a pineapple... -- GitLab