/*
- * Sone - DefaultIdentity.java - Copyright © 2010–2019 David Roden
+ * Sone - DefaultIdentity.kt - Copyright © 2010–2020 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
package net.pterodactylus.sone.freenet.wot
-import java.util.Collections.*
+import java.util.Collections.synchronizedMap
+import java.util.Collections.synchronizedSet
+import kotlin.collections.set
/**
* A Web of Trust identity.
*/
-open class DefaultIdentity(private val id: String, private val nickname: String, private val requestUri: String) : Identity {
+open class DefaultIdentity(private val id: String, private val nickname: String?, private val requestUri: String) : Identity {
private val contexts = mutableSetOf<String>().synchronized()
private val properties = mutableMapOf<String, String>().synchronized()
}
}
+ override fun getTrust(): Map<OwnIdentity, Trust> = synchronized(trustCache) {
+ trustCache.toMap()
+ }
+
override fun getTrust(ownIdentity: OwnIdentity) = synchronized(trustCache) {
trustCache[ownIdentity]
}