X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=4bf8a8a1a054d284512e76cfa6da64bc0d9037a7;hp=0caf03fe0047c22b672895fad32b0e8194819b74;hb=90d8e2eacb9888735865d8f890d105885959ca65;hpb=4aec89e6f9c6eb0972be5e9a3e1363bb487a2898 diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 0caf03f..4bf8a8a 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -413,23 +413,6 @@ public class Core extends AbstractService implements SoneProvider { } /** - * Returns all Sones that have liked the given reply. - * - * @param reply - * The reply to get the liking Sones for - * @return The Sones that like the given reply - */ - public Set getLikes(PostReply reply) { - Set sones = new HashSet(); - for (Sone sone : getSones()) { - if (sone.getLikedReplyIds().contains(reply.getId())) { - sones.add(sone); - } - } - return sones; - } - - /** * Returns whether the given post is bookmarked. * * @param post @@ -601,7 +584,7 @@ public class Core extends AbstractService implements SoneProvider { return existingSone.get(); } boolean newSone = !existingSone.isPresent(); - final Sone sone = newSone ? database.newSoneBuilder().by(identity.getId()).build(Optional.absent()) : existingSone.get(); + final Sone sone = newSone ? database.newSoneBuilder().by(identity.getId()).using(new Client("Sone", SonePlugin.VERSION.toString())).build(Optional.absent()) : existingSone.get(); sone.modify().setLatestEdition(Numbers.safeParseLong(identity.getProperty("Sone.LatestEdition"), (long) 0)).update(); if (newSone) { synchronized (knownSones) { @@ -1663,6 +1646,7 @@ public class Core extends AbstractService implements SoneProvider { OwnIdentity ownIdentity = ownIdentityAddedEvent.ownIdentity(); logger.log(Level.FINEST, String.format("Adding OwnIdentity: %s", ownIdentity)); if (ownIdentity.hasContext("Sone")) { + database.storeIdentity(ownIdentity); addLocalSone(ownIdentity); } } @@ -1691,6 +1675,7 @@ public class Core extends AbstractService implements SoneProvider { Identity identity = identityAddedEvent.identity(); logger.log(Level.FINEST, String.format("Adding Identity: %s", identity)); trustedIdentities.put(identityAddedEvent.ownIdentity(), identity); + database.storeIdentity(identity); addRemoteSone(identity); } @@ -1703,6 +1688,7 @@ public class Core extends AbstractService implements SoneProvider { @Subscribe public void identityUpdated(IdentityUpdatedEvent identityUpdatedEvent) { final Identity identity = identityUpdatedEvent.identity(); + database.storeIdentity(identity); soneDownloaders.execute(new Runnable() { @Override