aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Ugnich Anton2014-03-09 01:12:56 +0700
committerGravatar Ugnich Anton2014-03-09 01:12:56 +0700
commitebbd16e1553d25dcd1135c4b3a3a9279f4509844 (patch)
tree4460f04d6193637df638e6e8b39a623b5ff3c4cf /src
parent74f0e662697a05d30b5ac1cec6d1ffeaae14bf5f (diff)
Messages.doSetPopular
Diffstat (limited to 'src')
-rw-r--r--src/java/com/juick/api/Main.java2
-rw-r--r--src/java/com/juick/api/Messages.java10
2 files changed, 12 insertions, 0 deletions
diff --git a/src/java/com/juick/api/Main.java b/src/java/com/juick/api/Main.java
index 9e0b8523..c4fe911e 100644
--- a/src/java/com/juick/api/Main.java
+++ b/src/java/com/juick/api/Main.java
@@ -166,6 +166,8 @@ public class Main extends HttpServlet implements Stream.StreamListener {
} else {
response.sendError(401);
}
+ } else if (uri.equals("/messages/set_popular") && vuid == 1) {
+ messages.doSetPopular(request, response);
} else {
response.sendError(404);
}
diff --git a/src/java/com/juick/api/Messages.java b/src/java/com/juick/api/Messages.java
index 5ecf503f..3aeede68 100644
--- a/src/java/com/juick/api/Messages.java
+++ b/src/java/com/juick/api/Messages.java
@@ -36,4 +36,14 @@ public class Messages {
response.sendError(404);
}
}
+
+ public void doSetPopular(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ int mid = Utils.parseInt(request.getParameter("mid"), 0);
+ int popular = Utils.parseInt(request.getParameter("popular"), 0);
+
+ if (mid > 0) {
+ MessagesQueries.setMessagePopular(sql, mid, popular);
+ Main.replyJSON(request, response, "{\"status\":\"ok\"}");
+ }
+ }
}