X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FCore.java;h=c3276a383967974b414eccd0f391baec433ce40f;hb=173eb2df26ebc15a6aa5565ec15dfad37bfa61a1;hp=5e98c47edd0cbe541296c6e5cca7d9c5551f446f;hpb=936b1e72a332c6bfdd02370a2ea51adf2d8c9248;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 5e98c47..c3276a3 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1104,7 +1104,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, synchronized (knownPosts) { for (Post post : sone.getPosts()) { PostBuilder postBuilder = postBuilderFactory.newPostBuilder(); - postBuilder.copyPost(post).from(storedSone); + postBuilder.copyPost(post).from(storedSone.getId()); Post newPost = postBuilder.build().setKnown(knownPosts.contains(post.getId())); if (!storedPosts.contains(newPost)) { if (newPost.getTime() < getSoneFollowingTime(sone)) { @@ -1130,7 +1130,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, Set storedReplies = storedSone.getReplies(); synchronized (knownReplies) { for (PostReply reply : sone.getReplies()) { - reply.setSone(storedSone).setKnown(knownReplies.contains(reply.getId())); + reply.setKnown(knownReplies.contains(reply.getId())); if (!storedReplies.contains(reply)) { if (reply.getTime() < getSoneFollowingTime(sone)) { knownReplies.add(reply.getId()); @@ -1307,9 +1307,9 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, logger.log(Level.WARNING, "Invalid post found, aborting load!"); return; } - PostBuilder postBuilder = postBuilderFactory.newPostBuilder().withId(postId).from(sone).withTime(postTime).withText(postText); + PostBuilder postBuilder = postBuilderFactory.newPostBuilder().withId(postId).from(sone.getId()).withTime(postTime).withText(postText); if ((postRecipientId != null) && (postRecipientId.length() == 43)) { - postBuilder.to(getSone(postRecipientId)); + postBuilder.to(postRecipientId); } posts.add(postBuilder.build()); } @@ -1330,7 +1330,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, return; } PostReplyBuilder postReplyBuilder = postReplyBuilderFactory.newPostReplyBuilder(); - postReplyBuilder.withId(replyId).from(sone).to(getPost(postId)).withTime(replyTime).withText(replyText); + postReplyBuilder.withId(replyId).from(sone.getId()).to(postId).withTime(replyTime).withText(replyText); replies.add(postReplyBuilder.build()); } @@ -1536,9 +1536,9 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, return null; } PostBuilder postBuilder = postBuilderFactory.newPostBuilder(); - postBuilder.from(sone).randomId().withTime(time).withText(text.trim()); + postBuilder.from(sone.getId()).randomId().withTime(time).withText(text.trim()); if (recipient != null) { - postBuilder.to(recipient); + postBuilder.to(recipient.getId()); } final Post post = postBuilder.build(); synchronized (posts) { @@ -1663,7 +1663,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, return null; } PostReplyBuilder postReplyBuilder = postReplyBuilderFactory.newPostReplyBuilder(); - postReplyBuilder.randomId().from(sone).to(post).currentTime().withText(text.trim()); + postReplyBuilder.randomId().from(sone.getId()).to(post.getId()).currentTime().withText(text.trim()); final PostReply reply = postReplyBuilder.build(); synchronized (replies) { replies.put(reply.getId(), reply); @@ -2304,23 +2304,6 @@ public class Core extends AbstractService implements SoneProvider, PostProvider, } /** - * Generate a Sone URI from the given URI and latest edition. - * - * @param uriString - * The URI to derive the Sone URI from - * @return The derived URI - */ - private static FreenetURI getSoneUri(String uriString) { - try { - FreenetURI uri = new FreenetURI(uriString).setDocName("Sone").setMetaString(new String[0]); - return uri; - } catch (MalformedURLException mue1) { - logger.log(Level.WARNING, String.format("Could not create Sone URI from URI: %s", uriString), mue1); - return null; - } - } - - /** * Notifies the core that a new {@link OwnIdentity} was added. * * @param ownIdentityAddedEvent