- @JvmOverloads
- fun loadTrustedIdentities(ownIdentity: OwnIdentity, context: String? = null): Set<Identity> {
- val (fields) = performRequest(SimpleFieldSetBuilder().put("Message", "GetIdentitiesByScore").put("Truster", ownIdentity.id).put("Selection", "+").put("Context", context ?: "").put("WantTrustValues", "true").get())
- val identities = HashSet<Identity>()
- var identityCounter = -1
- while (true) {
- val id = fields.get("Identity" + ++identityCounter) ?: break
- val nickname = fields.get("Nickname$identityCounter")
- val requestUri = fields.get("RequestURI$identityCounter")
- val identity = DefaultIdentity(id, nickname, requestUri)
- identity.setContexts(parseContexts("Contexts$identityCounter.", fields))
- identity.properties = parseProperties("Properties$identityCounter.", fields)
- val trust = parseInt(fields.get("Trust$identityCounter"), null)
- val score = parseInt(fields.get("Score$identityCounter"), 0)!!
- val rank = parseInt(fields.get("Rank$identityCounter"), 0)!!
- identity.setTrust(ownIdentity, Trust(trust, score, rank))
- identities.add(identity)
- }
- return identities
- }