- fun removeProperty(ownIdentity: OwnIdentity, name: String) {
- performRequest(SimpleFieldSetBuilder().put("Message", "RemoveProperty").put("Identity", ownIdentity.id).put("Property", name).get())
- }
-
- /**
- * Returns the trust for the given identity assigned to it by the given own
- * identity.
- *
- * @param ownIdentity The own identity
- * @param identity The identity to get the trust for
- * @return The trust for the given identity
- * @throws PluginException if an error occured talking to the Web of Trust plugin
- */
- @Throws(PluginException::class)
- fun getTrust(ownIdentity: OwnIdentity, identity: Identity): Trust {
- val (fields) = performRequest(SimpleFieldSetBuilder().put("Message", "GetIdentity").put("Truster", ownIdentity.id).put("Identity", identity.id).get())
- val trust = fields.get("Trust")
- val score = fields.get("Score")
- val rank = fields.get("Rank")
- var explicit: Int? = null
- var implicit: Int? = null
- var distance: Int? = null
- try {
- explicit = Integer.valueOf(trust)
- } catch (nfe1: NumberFormatException) {
- /* ignore. */
- }
-
- try {
- implicit = Integer.valueOf(score)
- } catch (nfe1: NumberFormatException) {
- /* ignore. */
- }
-
- try {
- distance = Integer.valueOf(rank)
- } catch (nfe1: NumberFormatException) {
- /* ignore. */
- }
-
- return Trust(explicit, implicit, distance)
- }
-
- /**
- * Sets the trust for the given identity.
- *
- * @param ownIdentity The trusting identity
- * @param identity The trusted identity
- * @param trust The amount of trust (-100 thru 100)
- * @param comment The comment or explanation of the trust value
- * @throws PluginException if an error occured talking to the Web of Trust plugin
- */
- @Throws(PluginException::class)
- fun setTrust(ownIdentity: OwnIdentity, identity: Identity, trust: Int, comment: String) {
- performRequest(SimpleFieldSetBuilder().put("Message", "SetTrust").put("Truster", ownIdentity.id).put("Trustee", identity.id).put("Value", trust.toString()).put("Comment", comment).get())
- }
-
- /**
- * Removes any trust assignment of the given own identity for the given
- * identity.
- *
- * @param ownIdentity The own identity
- * @param identity The identity to remove all trust for
- * @throws WebOfTrustException if an error occurs
- */
- @Throws(WebOfTrustException::class)
- fun removeTrust(ownIdentity: OwnIdentity, identity: Identity) {
- performRequest(SimpleFieldSetBuilder().put("Message", "RemoveTrust").put("Truster", ownIdentity.id).put("Trustee", identity.id).get())
- }