aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/juick/server/MessagesQueries.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java
index b406eb39..3ec412b0 100644
--- a/src/com/juick/server/MessagesQueries.java
+++ b/src/com/juick/server/MessagesQueries.java
@@ -160,6 +160,31 @@ public class MessagesQueries {
return user;
}
+ public static String getMessageRecommendations(Connection sql, int mid) {
+ String ret = "";
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT users.nick FROM favorites INNER JOIN users ON (favorites.message_id=? AND favorites.user_id=users.id)");
+ stmt.setInt(1, mid);
+ rs = stmt.executeQuery();
+ rs.beforeFirst();
+ while (rs.next()) {
+ if (!ret.isEmpty()) {
+ ret += ", ";
+ }
+ ret += "<a href=\"/" + rs.getString(1) + "/\">@" + rs.getString(1) + "</a>";
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ return ret;
+ }
+
public static ArrayList<Integer> getAll(Connection sql, int before) {
ArrayList<Integer> mids = new ArrayList<Integer>(20);