Remove unused code.
[Sone.git] / src / main / java / net / pterodactylus / sone / fcp / GetPostsCommand.java
index 6a3b07e..bd579ca 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Sone - GetPostsCommand.java - Copyright © 2011 David Roden
+ * Sone - GetPostsCommand.java - Copyright © 2011–2013 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
@@ -45,19 +45,16 @@ public class GetPostsCommand extends AbstractSoneCommand {
                super(core);
        }
 
-       /**
-        * {@inheritDoc}
-        */
        @Override
        public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
-               Sone sone = getSone(parameters, "Sone", false);
+               Sone sone = getMandatorySone(parameters, "Sone");
                int startPost = getInt(parameters, "StartPost", 0);
                int maxPosts = getInt(parameters, "MaxPosts", -1);
                List<Post> posts = sone.getPosts();
                if (posts.size() < startPost) {
-                       return new Response("Posts", encodePosts(Collections.<Post> emptyList(), "Posts.", false));
+                       return new Response("Posts", encodePosts(Collections.<Post> emptyList(), "Posts."));
                }
-               return new Response("Posts", encodePosts(sone.getPosts().subList(startPost, (maxPosts == -1) ? posts.size() : Math.min(startPost + maxPosts, posts.size())), "Posts.", true));
+               return new Response("Posts", encodePostsWithReplies(sone.getPosts().subList(startPost, (maxPosts == -1) ? posts.size() : Math.min(startPost + maxPosts, posts.size())), "Posts."));
        }
 
 }