Author: batosai
Date: 2008-08-04 22:24:54 +0000 (Mon, 04 Aug 2008)
New Revision: 21606
Modified:
trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Handle the creation of new identities.
Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-04 22:24:20 UTC
(rev 21605)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-04 22:24:54 UTC
(rev 21606)
@@ -6,6 +6,9 @@
package plugins.WoT;
+import java.net.MalformedURLException;
+import java.util.Date;
+
import com.db4o.Db4o;
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
@@ -83,7 +86,27 @@
@Override
public String handleHTTPPost(HTTPRequest request) throws
PluginHTTPException {
- return null;
+
+ //TODO Check the form password given by fProxy
+ String page = request.getPath().substring(SELF_URI.length());
+ if(page.equals("/createIdentity")) {
+ try {
+ OwnIdentity identity = new OwnIdentity( new
FreenetURI(request.getPartAsString("insertURI",1024)),
+
new
FreenetURI(request.getPartAsString("requestURI",1024)),
+
new Date(0),
+
new Date(),
+
!request.getPartAsString("publishTrustList",1024).equals(""));
+ db.store(identity);
+ }
+ catch(MalformedURLException e) {
+ // TODO Make a good looking error messages
system
+ return e.getLocalizedMessage();
+ }
+ return makeOwnIdentitiesPage();
+ }
+ else {
+ return makeHomePage();
+ }
}
@Override
@@ -160,8 +183,6 @@
createForm.addChild("#", "Publish trust list ");
createForm.addChild("input", new String[] { "type", "name",
"checked" }, new String[] { "checkbox", "publishTrustList", "true"});
createForm.addChild("br");
-
-
createForm.addChild("input", new String[] { "type", "name",
"value" }, new String[] { "submit", "create", "Create a new identity !" });
contentNode.addChild(box);