Author: toad
Date: 2008-04-05 15:18:52 +0000 (Sat, 05 Apr 2008)
New Revision: 19036

Modified:
   trunk/freenet/src/freenet/node/fcp/ConfigData.java
   trunk/freenet/src/freenet/node/fcp/GetConfig.java
   trunk/freenet/src/freenet/node/fcp/ModifyConfig.java
Log:
Same for FCP Config stuff.

Modified: trunk/freenet/src/freenet/node/fcp/ConfigData.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ConfigData.java  2008-04-05 15:15:58 UTC 
(rev 19035)
+++ trunk/freenet/src/freenet/node/fcp/ConfigData.java  2008-04-05 15:18:52 UTC 
(rev 19036)
@@ -19,8 +19,9 @@
        final boolean withShortDescription;
        final boolean withLongDescription;
        final boolean withDataTypes;
+       final String identifier;

-       public ConfigData(Node node, boolean withCurrent, boolean withDefaults, 
boolean withSortOrder, boolean withExpertFlag, boolean withForceWriteFlag, 
boolean withShortDescription, boolean withLongDescription, boolean 
withDataTypes) {
+       public ConfigData(Node node, boolean withCurrent, boolean withDefaults, 
boolean withSortOrder, boolean withExpertFlag, boolean withForceWriteFlag, 
boolean withShortDescription, boolean withLongDescription, boolean 
withDataTypes, String identifier) {
                this.node = node;
                this.withCurrent = withCurrent;
                this.withDefaults = withDefaults;
@@ -30,6 +31,7 @@
                this.withShortDescription = withShortDescription;
                this.withLongDescription = withLongDescription;
                this.withDataTypes = withDataTypes;
+               this.identifier = identifier;
        }


@@ -83,6 +85,8 @@
                                fs.put("dataType", type);
                        }
                }
+               if(identifier != null)
+                       fs.putSingle("Identifier", identifier);
                return fs;
        }


Modified: trunk/freenet/src/freenet/node/fcp/GetConfig.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/GetConfig.java   2008-04-05 15:15:58 UTC 
(rev 19035)
+++ trunk/freenet/src/freenet/node/fcp/GetConfig.java   2008-04-05 15:18:52 UTC 
(rev 19036)
@@ -18,6 +18,7 @@
        final boolean withLongDescription;
        final boolean withDataTypes;
        static final String NAME = "GetConfig";
+       final String identifier;

        public GetConfig(SimpleFieldSet fs) {
                withCurrent = Fields.stringToBool(fs.get("WithCurrent"), false);
@@ -28,6 +29,8 @@
                withShortDescription = 
Fields.stringToBool(fs.get("WithShortDescription"), false);
                withLongDescription = 
Fields.stringToBool(fs.get("WithLongDescription"), false);
                withDataTypes = Fields.stringToBool(fs.get("WithDataTypes"), 
false);
+               this.identifier = fs.get("Identifier");
+               fs.removeValue("Identifier");
        }

        public SimpleFieldSet getFieldSet() {
@@ -41,9 +44,9 @@
        public void run(FCPConnectionHandler handler, Node node)
                        throws MessageInvalidException {
                if(!handler.hasFullAccess()) {
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.ACCESS_DENIED, "GetConfig requires 
full access", null, false);
+                       throw new 
MessageInvalidException(ProtocolErrorMessage.ACCESS_DENIED, "GetConfig requires 
full access", identifier, false);
                }
-               handler.outputHandler.queue(new ConfigData(node, withCurrent, 
withDefaults, withSortOrder, withExpertFlag, withForceWriteFlag, 
withShortDescription, withLongDescription, withDataTypes));
+               handler.outputHandler.queue(new ConfigData(node, withCurrent, 
withDefaults, withSortOrder, withExpertFlag, withForceWriteFlag, 
withShortDescription, withLongDescription, withDataTypes, identifier));
        }

 }

Modified: trunk/freenet/src/freenet/node/fcp/ModifyConfig.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ModifyConfig.java        2008-04-05 
15:15:58 UTC (rev 19035)
+++ trunk/freenet/src/freenet/node/fcp/ModifyConfig.java        2008-04-05 
15:18:52 UTC (rev 19036)
@@ -15,9 +15,12 @@
        static final String NAME = "ModifyConfig";

        final SimpleFieldSet fs;
+       final String identifier;

        public ModifyConfig(SimpleFieldSet fs) {
                this.fs = fs;
+               this.identifier = fs.get("Identifier");
+               fs.removeValue("Identifier");
        }

        public SimpleFieldSet getFieldSet() {
@@ -30,7 +33,7 @@

        public void run(FCPConnectionHandler handler, Node node) throws 
MessageInvalidException {
                if(!handler.hasFullAccess()) {
-                       throw new 
MessageInvalidException(ProtocolErrorMessage.ACCESS_DENIED, "ModifyConfig 
requires full access", fs.get("Identifier"), false);
+                       throw new 
MessageInvalidException(ProtocolErrorMessage.ACCESS_DENIED, "ModifyConfig 
requires full access", identifier, false);
                }
                Config config = node.config;
                SubConfig[] sc = config.getConfigs();
@@ -61,6 +64,6 @@
                        }
                }
                node.clientCore.storeConfig();
-               handler.outputHandler.queue(new ConfigData(node, true, false, 
false, false, false, false, false, false));
+               handler.outputHandler.queue(new ConfigData(node, true, false, 
false, false, false, false, false, false, identifier));
        }
 }


Reply via email to