From: David ‘Bombe’ Roden Date: Thu, 11 Jun 2009 05:28:58 +0000 (+0200) Subject: Implement AddIdentity message. X-Git-Tag: v0.1.1~39 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=c200f549b8ebde87b6145f1f5bacf932e68151f5;p=jFCPlib.git Implement AddIdentity message. --- diff --git a/src/net/pterodactylus/fcp/plugin/WebOfTrustPlugin.java b/src/net/pterodactylus/fcp/plugin/WebOfTrustPlugin.java index 1949527..d5cedfc 100644 --- a/src/net/pterodactylus/fcp/plugin/WebOfTrustPlugin.java +++ b/src/net/pterodactylus/fcp/plugin/WebOfTrustPlugin.java @@ -173,6 +173,27 @@ public class WebOfTrustPlugin { return new IdentityTrust(trust, score, rank); } + /** + * Adds a new identity by its request URI. + * + * @param requestUri + * The request URI of the identity to add + * @return The added identity + * @throws IOException + * if an I/O error occurs + * @throws FcpException + * if an FCP error occurs + */ + public Identity addIdentity(String requestUri) throws IOException, FcpException { + Map replies = fcpClient.sendPluginMessage("plugins.WoT.WoT", createParameters("Message", "AddIdentity", "RequestURI", requestUri)); + if (!replies.get("Message").equals("IdentityAdded")) { + throw new FcpException("WebOfTrust Plugin did not reply with “IdentityAdded” message!"); + } + String identifier = replies.get("ID"); + String nickname = replies.get("Nickname"); + return new Identity(identifier, nickname, requestUri); + } + // // PRIVATE METHODS //