/**
* Returns the reply with the given ID. If there is no reply with the given
- * ID yet, a new one is created.
- *
- * @param replyId
- * The ID of the reply to get
- * @return The reply
- */
- public PostReply getReply(String replyId) {
- return getReply(replyId, true);
- }
-
- /**
- * Returns the reply with the given ID. If there is no reply with the given
* ID yet, a new one is created, unless {@code create} is false in which
* case {@code null} is returned.
*
* to return {@code null} if no reply can be found
* @return The reply, or {@code null} if there is no such reply
*/
- public PostReply getReply(String replyId, boolean create) {
+ public PostReply getPostReply(String replyId, boolean create) {
synchronized (replies) {
PostReply reply = replies.get(replyId);
if (create && (reply == null)) {
logger.log(Level.WARNING, "Invalid reply found, aborting load!");
return;
}
- replies.add(getReply(replyId).setSone(sone).setPost(getPost(postId)).setTime(replyTime).setText(replyText));
+ replies.add(getPostReply(replyId, true).setSone(sone).setPost(getPost(postId)).setTime(replyTime).setText(replyText));
}
/* load post likes. */
return null;
}
try {
- replies.add(core.getReply(replyId).setSone(sone).setPost(core.getPost(replyPostId)).setTime(Long.parseLong(replyTime)).setText(replyText));
+ replies.add(core.getPostReply(replyId, true).setSone(sone).setPost(core.getPost(replyPostId)).setTime(Long.parseLong(replyTime)).setText(replyText));
} catch (NumberFormatException nfe1) {
/* TODO - mark Sone as bad. */
logger.log(Level.WARNING, String.format("Downloaded reply for Sone %s with invalid time: %s", sone, replyTime));
protected PostReply getReply(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {
try {
String replyId = simpleFieldSet.getString(parameterName);
- PostReply reply = core.getReply(replyId, false);
+ PostReply reply = core.getPostReply(replyId, false);
if (reply == null) {
throw new FcpException("Could not load reply from “" + replyId + "”.");
}
protected void processTemplate(FreenetRequest request, TemplateContext templateContext) throws RedirectException {
super.processTemplate(request, templateContext);
String replyId = request.getHttpRequest().getPartAsStringFailsafe("reply", 36);
- PostReply reply = webInterface.getCore().getReply(replyId);
+ PostReply reply = webInterface.getCore().getPostReply(replyId, false);
String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 256);
if (request.getMethod() == Method.POST) {
if (!webInterface.getCore().isLocalSone(reply.getSone())) {
}
webInterface.getCore().markPostKnown(post);
} else if (type.equals("reply")) {
- PostReply reply = webInterface.getCore().getReply(id, false);
+ PostReply reply = webInterface.getCore().getPostReply(id, false);
if (reply == null) {
continue;
}
*/
private String getReplyPostId(String phrase) {
String replyId = phrase.startsWith("reply://") ? phrase.substring(8) : phrase;
- return (webInterface.getCore().getReply(replyId, false) != null) ? webInterface.getCore().getReply(replyId, false).getPost().getId() : null;
+ return (webInterface.getCore().getPostReply(replyId, false) != null) ? webInterface.getCore().getPostReply(replyId, false).getPost().getId() : null;
}
/**
@Override
protected JsonObject createJsonObject(FreenetRequest request) {
String replyId = request.getHttpRequest().getParam("reply");
- PostReply reply = webInterface.getCore().getReply(replyId);
+ PostReply reply = webInterface.getCore().getPostReply(replyId, false);
if (reply == null) {
return createErrorJsonObject("invalid-reply-id");
}
Set<Sone> sones = webInterface.getCore().getLikes(post);
return createSuccessJsonObject().put("likes", sones.size()).put("sones", getSones(sones));
} else if ("reply".equals(type)) {
- PostReply reply = webInterface.getCore().getReply(id);
+ PostReply reply = webInterface.getCore().getPostReply(id, false);
Set<Sone> sones = webInterface.getCore().getLikes(reply);
return createSuccessJsonObject().put("likes", sones.size()).put("sones", getSones(sones));
}
@Override
protected JsonObject createJsonObject(FreenetRequest request) {
String replyId = request.getHttpRequest().getParam("reply");
- PostReply reply = webInterface.getCore().getReply(replyId);
+ PostReply reply = webInterface.getCore().getPostReply(replyId, false);
if ((reply == null) || (reply.getSone() == null)) {
return createErrorJsonObject("invalid-reply-id");
}
if (allIds.length() > 0) {
String[] ids = allIds.split(",");
for (String id : ids) {
- PostReply reply = webInterface.getCore().getReply(id, false);
+ PostReply reply = webInterface.getCore().getPostReply(id, false);
if (reply == null) {
continue;
}
}
core.markPostKnown(post);
} else if (type.equals("reply")) {
- PostReply reply = core.getReply(id, false);
+ PostReply reply = core.getPostReply(id, false);
if (reply == null) {
continue;
}