aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/MessagesQueries.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/juick/server/MessagesQueries.java')
-rw-r--r--src/com/juick/server/MessagesQueries.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java
index 550da56d..d02985ee 100644
--- a/src/com/juick/server/MessagesQueries.java
+++ b/src/com/juick/server/MessagesQueries.java
@@ -138,6 +138,14 @@ public class MessagesQueries {
return rid;
}
+ public static boolean recommendMessage(Connection sql, int mid, int vuid) {
+ boolean res = SQLHelpers.execute(sql, "INSERT IGNORE INTO favorites(user_id,message_id) VALUES (" + vuid + "," + mid + ")") == 1;
+ if (res) {
+ SQLHelpers.executeInt(sql, "UPDATE messages SET likes=likes+1 WHERE message_id=?", mid);
+ }
+ return res;
+ }
+
public static boolean canViewThread(Connection sql, int mid, int uid) {
int privacy = 0;