Author: xor
Date: 2008-11-09 21:19:58 +0000 (Sun, 09 Nov 2008)
New Revision: 23450

Modified:
   trunk/plugins/WoT/WoT.java
Log:
Provide FCP message for getting the own identities. Batosai: I know that you 
did not want to provide this for security reasons. But its really necessary for 
useability of client applications that they can just show the list. As soon as 
we want to make this secure, we can use passwords or whatever.

Modified: trunk/plugins/WoT/WoT.java
===================================================================
--- trunk/plugins/WoT/WoT.java  2008-11-09 18:33:58 UTC (rev 23449)
+++ trunk/plugins/WoT/WoT.java  2008-11-09 21:19:58 UTC (rev 23450)
@@ -423,6 +423,9 @@
                        else if(params.get("Message").equals("GetIdentity")) {
                                replysender.send(handleGetIdentity(params), 
data);
                        }
+                       else 
if(params.get("Message").equals("GetOwnIdentities")) {
+                               
replysender.send(handleGetOwnIdentities(params), data);
+                       }                       
                        else 
if(params.get("Message").equals("GetIdentitiesByScore")) {
                                
replysender.send(handleGetIdentitiesByScore(params), data);
                        }                       
@@ -558,6 +561,26 @@
        }
        */

+       private SimpleFieldSet handleGetOwnIdentities(SimpleFieldSet params) 
throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException, DuplicateIdentityException {
+               
+               SimpleFieldSet sfs = new SimpleFieldSet(false);
+
+               sfs.putAppend("Message", "OwnIdentities");
+               
+               ObjectSet<OwnIdentity> result = 
OwnIdentity.getAllOwnIdentities(db);
+       
+               for(int idx = 1 ; result.hasNext() ; idx++) {
+                       OwnIdentity oid = result.next();
+                       /* FIXME: Isn't append slower than replace? Figure this 
out */
+                       sfs.putAppend("Identity"+idx, oid.getId());
+                       sfs.putAppend("RequestURI"+idx, 
oid.getRequestURI().toString());
+                       sfs.putAppend("InsertURI"+idx, 
oid.getInsertURI().toString());
+                       sfs.putAppend("Nickname"+idx, oid.getNickName());
+                       /* FIXME: Allow the client to select what data he wants 
*/
+               }
+               return sfs;
+       }
+       
        private SimpleFieldSet handleGetIdentitiesByScore(SimpleFieldSet 
params) throws InvalidParameterException, MalformedURLException, 
UnknownIdentityException, DuplicateIdentityException {

                SimpleFieldSet sfs = new SimpleFieldSet(false);


Reply via email to