import net.pterodactylus.sone.data.Profile;
import net.pterodactylus.sone.data.Reply;
import net.pterodactylus.sone.data.ReplyShell;
+import net.pterodactylus.sone.data.Shell;
import net.pterodactylus.sone.data.ShellCache;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.data.SoneShell;
return Collections.unmodifiableSet(localSones);
}
+ /**
+ * Returns a Sone or a {@link Shell} around one for the given ID.
+ *
+ * @param soneId
+ * The ID of the Sone
+ * @return The Sone, or a {@link Shell} around one
+ */
+ public Sone getSone(String soneId) {
+ Sone sone = soneCache.get(soneId);
+ if (sone instanceof SoneShell) {
+ soneCache.put(soneId, sone = ((SoneShell) sone).getShelled());
+ }
+ return sone;
+ }
+
//
// ACTIONS
//
*/
public void addSone(Sone sone) {
if (localSones.add(sone)) {
+ soneCache.put(sone.getId(), sone);
SoneInserter soneInserter = new SoneInserter(freenetInterface, sone);
soneInserter.start();
soneInserters.put(sone, soneInserter);