X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FGetPostFeedCommand.java;h=2c44dbf66200ca51049bf503af424e02fae206d1;hp=895c1c6c05ffa04b97f7b4e6fa578169ac5ad4b1;hb=a47643aed43d118ca68044f95451bb5374cdb332;hpb=96e4cdd1c5a2dc719afbf1f1cc14a3c62e93f432 diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java index 895c1c6..2c44dbf 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java @@ -1,5 +1,5 @@ /* - * Sone - GetPostFeedCommand.java - Copyright © 2011 David Roden + * Sone - GetPostFeedCommand.java - Copyright © 2011–2012 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 @@ -54,7 +54,7 @@ public class GetPostFeedCommand extends AbstractSoneCommand { */ @Override public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { - Sone sone = getSone(parameters, "Sone"); + Sone sone = getSone(parameters, "Sone", true); int startPost = getInt(parameters, "StartPost", 0); int maxPosts = getInt(parameters, "MaxPosts", -1); @@ -64,7 +64,7 @@ public class GetPostFeedCommand extends AbstractSoneCommand { if (!getCore().hasSone(friendSoneId)) { continue; } - allPosts.addAll(getCore().getSone(friendSoneId).getPosts()); + allPosts.addAll(getCore().getSone(friendSoneId, false).getPosts()); } allPosts.addAll(getCore().getDirectedPosts(sone)); allPosts = Filters.filteredSet(allPosts, Post.FUTURE_POSTS_FILTER); @@ -73,10 +73,10 @@ public class GetPostFeedCommand extends AbstractSoneCommand { Collections.sort(sortedPosts, Post.TIME_COMPARATOR); if (sortedPosts.size() < startPost) { - return new Response(encodePosts(Collections. emptyList(), "Posts.", false)); + return new Response("PostFeed", encodePosts(Collections. emptyList(), "Posts.", false)); } - return new Response(encodePosts(sortedPosts.subList(startPost, (maxPosts == -1) ? sortedPosts.size() : Math.min(startPost + maxPosts, sortedPosts.size())), "Posts.", true)); + return new Response("PostFeed", encodePosts(sortedPosts.subList(startPost, (maxPosts == -1) ? sortedPosts.size() : Math.min(startPost + maxPosts, sortedPosts.size())), "Posts.", true)); } }