/*
- * Sone - AbstractSoneCommand.java - Copyright © 2011–2013 David Roden
+ * Sone - AbstractSoneCommand.java - Copyright © 2011–2016 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
* @return The encoded text
*/
protected static String encodeString(String text) {
- return text.replaceAll("\\\\", "\\\\").replaceAll("\n", "\\\\n").replaceAll("\r", "\\\\r");
+ return text.replaceAll("\\\\", "\\\\\\\\").replaceAll("\n", "\\\\n").replaceAll("\r", "\\\\r");
}
/**
* {@code null})
* @return The simple field set containing the replies
*/
- protected static SimpleFieldSet encodeReplies(Collection<? extends PostReply> replies, String prefix) {
+ protected SimpleFieldSet encodeReplies(Collection<? extends PostReply> replies, String prefix) {
SimpleFieldSetBuilder replyBuilder = new SimpleFieldSetBuilder();
int replyIndex = 0;
replyBuilder.put(replyPrefix + "Sone", reply.getSone().getId());
replyBuilder.put(replyPrefix + "Time", reply.getTime());
replyBuilder.put(replyPrefix + "Text", encodeString(reply.getText()));
+ replyBuilder.put(encodeLikes(core.getLikes(reply), replyPrefix + "Likes."));
}
return replyBuilder.get();