X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneDownloader.java;h=fa0063e4898e5dc335356da450a890239cb30d0d;hb=a57e3b33c5837a40aa08c11fb92f600d928be1ab;hp=46d8540a60ec5c238f9b2aaff57899b4191ba737;hpb=fcaabe0a9b8bb09aabe0e2a1451c3cb00d5cfbf4;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java index 46d8540..fa0063e 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java @@ -169,6 +169,7 @@ public class SoneDownloader extends AbstractService { soneInputStream = soneBucket.getInputStream(); Sone parsedSone = parseSone(originalSone, soneInputStream); if (parsedSone != null) { + parsedSone.setLatestEdition(requestUri.getEdition()); if (requestUri.getKeyType().equals("USK")) { parsedSone.setRequestUri(requestUri.setMetaString(new String[0])); } else { @@ -294,6 +295,7 @@ public class SoneDownloader extends AbstractService { } else { for (SimpleXML postXml : postsXml.getNodes("post")) { String postId = postXml.getValue("id", null); + String postRecipientId = postXml.getValue("recipient", null); String postTime = postXml.getValue("time", null); String postText = postXml.getValue("text", null); if ((postId == null) || (postTime == null) || (postText == null)) { @@ -302,7 +304,11 @@ public class SoneDownloader extends AbstractService { return null; } try { - posts.add(core.getPost(postId).setSone(sone).setTime(Long.parseLong(postTime)).setText(postText)); + Post post = core.getPost(postId).setSone(sone).setTime(Long.parseLong(postTime)).setText(postText); + if ((postRecipientId != null) && (postRecipientId.length() == 43)) { + post.setRecipient(core.getSone(postRecipientId)); + } + posts.add(post); } catch (NumberFormatException nfe1) { /* TODO - mark Sone as bad. */ logger.log(Level.WARNING, "Downloaded post for Sone %s with invalid time: %s", new Object[] { sone, postTime }); @@ -371,6 +377,7 @@ public class SoneDownloader extends AbstractService { sone.setPosts(posts); sone.setReplies(replies); sone.setLikePostIds(likedPostIds); + sone.setLikeReplyIds(likedReplyIds); } return sone;