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=2dc59a1b3ab9247d371c9db8b552689befc2a51d;hb=a47643aed43d118ca68044f95451bb5374cdb332;hpb=a50303a787867cdc2449da8846e1e365b771e109 diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java index 2dc59a1..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 @@ -53,8 +53,8 @@ public class GetPostFeedCommand extends AbstractSoneCommand { * {@inheritDoc} */ @Override - public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { - Sone sone = getSone(parameters, "Sone"); + public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { + 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 Reply(encodePosts(Collections. emptyList())); + return new Response("PostFeed", encodePosts(Collections. emptyList(), "Posts.", false)); } - return new Reply(encodePosts(sortedPosts.subList(startPost, (maxPosts == -1) ? sortedPosts.size() : Math.min(startPost + maxPosts, sortedPosts.size())))); + return new Response("PostFeed", encodePosts(sortedPosts.subList(startPost, (maxPosts == -1) ? sortedPosts.size() : Math.min(startPost + maxPosts, sortedPosts.size())), "Posts.", true)); } }