X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FGetPostsCommand.java;h=36d2912e7d5813568a69abaaa21bffe0f00a7dc2;hb=adc8230792298a693a8f9ba01a6db04753d15b47;hp=0a02a89e7bc29b13151c46cb3fa3e46b683141f6;hpb=96e4cdd1c5a2dc719afbf1f1cc14a3c62e93f432;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java b/src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java index 0a02a89..36d2912 100644 --- a/src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java +++ b/src/main/java/net/pterodactylus/sone/fcp/GetPostsCommand.java @@ -1,5 +1,5 @@ /* - * Sone - GetPostsCommand.java - Copyright © 2011 David Roden + * Sone - GetPostsCommand.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 @@ -50,14 +50,14 @@ public class GetPostsCommand extends AbstractSoneCommand { */ @Override public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException { - Sone sone = getSone(parameters, "Sone"); + Sone sone = getSone(parameters, "Sone", false); int startPost = getInt(parameters, "StartPost", 0); int maxPosts = getInt(parameters, "MaxPosts", -1); List posts = sone.getPosts(); if (posts.size() < startPost) { - return new Response(encodePosts(Collections. emptyList(), "Posts.", false)); + return new Response("Posts", encodePosts(Collections. emptyList(), "Posts.", false)); } - return new Response(encodePosts(sone.getPosts().subList(startPost, (maxPosts == -1) ? posts.size() : Math.min(startPost + maxPosts, posts.size())), "Posts.", true)); + return new Response("Posts", encodePosts(sone.getPosts().subList(startPost, (maxPosts == -1) ? posts.size() : Math.min(startPost + maxPosts, posts.size())), "Posts.", true)); } }