diff options
Diffstat (limited to 'src/main/java/com/juick/api/Messages.java')
-rw-r--r-- | src/main/java/com/juick/api/Messages.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/com/juick/api/Messages.java b/src/main/java/com/juick/api/Messages.java index b5462258..76615e44 100644 --- a/src/main/java/com/juick/api/Messages.java +++ b/src/main/java/com/juick/api/Messages.java @@ -41,6 +41,23 @@ public class Messages { } } + public void doGetRecommended(HttpServletRequest request, HttpServletResponse response, int vuid) throws ServletException, IOException { + int before_mid = Utils.parseInt(request.getParameter("before_mid"), 0); + + ArrayList<Integer> mids = MessagesQueries.getRecommended(sql, vuid, before_mid); + if (mids != null && !mids.isEmpty()) { + ArrayList<com.juick.Message> msgs = MessagesQueries.getMessages(sql, mids); + if (msgs != null && !msgs.isEmpty()) { + String json = com.juick.json.Messages.arrayToString(msgs); + Main.replyJSON(request, response, json); + } else { + response.sendError(404); + } + } else { + response.sendError(404); + } + } + public void doSetPrivacy(HttpServletRequest request, HttpServletResponse response, Stream xmpp, int vuid) throws ServletException, IOException { int mid = Utils.parseInt(request.getParameter("mid"), 0); com.juick.User user = MessagesQueries.getMessageAuthor(sql, mid); |