X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FGetPostsCommand.java;h=2f250a38770dcedb819ac12c04a1b3fb7168602b;hb=452b72e057f577c3b06389caf606b670ecc600c3;hp=16006fc85ee12f787330758a2da904928c0f4e20;hpb=86de0f4478465475dd403ae9daa90aabe0ca3e9c;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 16006fc..2f250a3 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â2020 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
@@ -25,13 +25,10 @@ import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.fcp.FcpException;
import freenet.support.SimpleFieldSet;
-import freenet.support.api.Bucket;
/**
* Implements the âGetPostsâ FCP command that returns the list of posts a Sone
* made.
- *
- * @author David âBombeâ Roden
*/
public class GetPostsCommand extends AbstractSoneCommand {
@@ -49,15 +46,15 @@ public class GetPostsCommand extends AbstractSoneCommand {
* {@inheritDoc}
*/
@Override
- public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
- Sone sone = getSone(parameters, "Sone");
+ public Response execute(SimpleFieldSet parameters) throws FcpException {
+ 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(), 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())), true));
+ return new Response("Posts", encodePosts(sone.getPosts().subList(startPost, (maxPosts == -1) ? posts.size() : Math.min(startPost + maxPosts, posts.size())), "Posts.", true));
}
}