Author: batosai
Date: 2008-08-10 13:03:03 +0000 (Sun, 10 Aug 2008)
New Revision: 21707
Modified:
trunk/apps/WoT/src/plugins/WoT/Identity.java
trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java
trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Handle publishTrustList like any other property.
Modified: trunk/apps/WoT/src/plugins/WoT/Identity.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/Identity.java 2008-08-10 12:54:21 UTC
(rev 21706)
+++ trunk/apps/WoT/src/plugins/WoT/Identity.java 2008-08-10 13:03:03 UTC
(rev 21707)
@@ -7,7 +7,6 @@
import java.util.Date;
import java.util.HashMap;
-import java.util.Map;
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
@@ -24,7 +23,6 @@
FreenetURI requestURI;
Date lastChange;
- boolean publishTrustList;
HashMap<String, String> props;
/**
@@ -34,11 +32,10 @@
* @param lastChange Last time the Identity has been updated
* @param publishTrustList Whether the identity publishes its trustList
or not
*/
- public Identity (FreenetURI requestURI, Date lastChange, boolean
publishTrustList) {
+ public Identity (FreenetURI requestURI, Date lastChange) {
setRequestURI(requestURI);
setLastChange(lastChange);
- setPublishTrustList(publishTrustList);
props = new HashMap<String, String>();
}
@@ -93,20 +90,6 @@
public void setLastChange(Date lastChange) {
this.lastChange = lastChange;
}
-
- /**
- * @return publishTrustList
- */
- public boolean PublishesTrustList() {
- return publishTrustList;
- }
-
- /**
- * @param publishTrustList Whether the Identity publishes its trustList
or not
- */
- public void setPublishTrustList(boolean publishTrustList) {
- this.publishTrustList = publishTrustList;
- }
public void setProp(String key, String value) {
props.put(key, value);
Modified: trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java 2008-08-10 12:54:21 UTC
(rev 21706)
+++ trunk/apps/WoT/src/plugins/WoT/OwnIdentity.java 2008-08-10 13:03:03 UTC
(rev 21707)
@@ -55,9 +55,9 @@
* @param lastChange Last time the identity (or its trustList) has been
updated
* @param publishTrustList Whether the Identity publishes its trustList
or not
*/
- public OwnIdentity(FreenetURI insertURI, FreenetURI requestURI, Date
lastInsert, Date lastChange, boolean publishTrustList) {
+ public OwnIdentity(FreenetURI insertURI, FreenetURI requestURI, Date
lastInsert, Date lastChange) {
- super(requestURI, lastChange, publishTrustList);
+ super(requestURI, lastChange);
setInsertURI(insertURI);
setLastInsert(lastInsert);
}
@@ -88,9 +88,6 @@
// Create the content
Element identity = xmlDoc.createElement("identity");
- Element publishTrustList =
xmlDoc.createElement("publishTrustList");
- publishTrustList.setAttribute("value",
String.valueOf(this.publishTrustList));
- identity.appendChild(publishTrustList);
Set set = props.entrySet();
Iterator i = set.iterator();
@@ -104,7 +101,7 @@
rootElement.appendChild(identity);
- if(this.publishTrustList) {
+ if(getProp("publishTrustList").equals("true")) {
Trustlist trustList = new Trustlist(db, this);
rootElement.appendChild(trustList.toXML(xmlDoc));
}
Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-10 12:54:21 UTC
(rev 21706)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java 2008-08-10 13:03:03 UTC
(rev 21707)
@@ -141,7 +141,7 @@
else {
cell.addChild(new HTMLNode("a", "href",
id.getRequestURI() + "/identity.xml", id.getLastInsert().toString()));
}
- row.addChild("td", id.PublishesTrustList() ?
"true" : "false");
+ row.addChild("td",
id.getProp("publishTrustList").equals("true") ? "Yes" : "No");
// Insert button, will be automatic later
HTMLNode cell2 = row.addChild("td");
@@ -194,7 +194,7 @@
row=identitiesTable.addChild("tr");
row.addChild("td", new String[] {"title",
"style"}, new String[] {id.getRequestURI().toString(), "cursor: help;"},
id.getRequestURI().getDocName());
row.addChild("td",
id.getLastChange().toString());
- row.addChild("td", id.PublishesTrustList() ?
"true" : "false");
+ row.addChild("td",
id.getProp("publishTrustList").equals("true") ? "Yes" : "No");
}
}
@@ -258,10 +258,11 @@
private String addIdentity(HTTPRequest request) {
+ // TODO Check if the identity already exists
FreenetURI uri;
try {
uri = new
FreenetURI(request.getPartAsString("identityURI", 1024));
- Identity identity = new Identity(uri, new Date(0),
true);
+ Identity identity = new Identity(uri, new Date(0));
db.store(identity);
db.commit();
fetcher.fetch(identity);
@@ -277,8 +278,7 @@
OwnIdentity identity = new OwnIdentity( new
FreenetURI(request.getPartAsString("insertURI",1024)).setKeyType("USK"),
new
FreenetURI(request.getPartAsString("requestURI",1024)).setKeyType("USK"),
new Date(0),
-
new Date(),
-
!request.getPartAsString("publishTrustList",1024).equals(""));
+
new Date());
identity.setProp("nickName",
request.getPartAsString("nickName", 1024));
//TODO Make the new identity trust the seed identity
@@ -301,7 +301,7 @@
return e.getLocalizedMessage();
}
- ObjectSet<OwnIdentity> ownIdentities = db.queryByExample(new
OwnIdentity(null, uri, null, null, true));
+ ObjectSet<OwnIdentity> ownIdentities = db.queryByExample(new
OwnIdentity(null, uri, null, null));
if (ownIdentities.size() == 0) return "Identity not found";
OwnIdentity identity = ownIdentities.next();