aboutsummaryrefslogtreecommitdiff
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/juick/server/SubscriptionsQueries.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/com/juick/server/SubscriptionsQueries.java b/src/com/juick/server/SubscriptionsQueries.java
index 9f9468cd..ca382fc7 100644
--- a/src/com/juick/server/SubscriptionsQueries.java
+++ b/src/com/juick/server/SubscriptionsQueries.java
@@ -43,6 +43,28 @@ public class SubscriptionsQueries {
return jids;
}
+ public static ArrayList<String> getJIDSubscribedToUserAndTags(Connection sql, int uid, int mid) {
+ ArrayList<String> jids = new ArrayList<String>();
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT DISTINCT jid FROM jids WHERE active=1 AND user_id IN (SELECT suser_id FROM subscr_users WHERE user_id=? UNION SELECT suser_id FROM subscr_tags INNER JOIN messages_tags ON (messages_tags.message_id=? AND subscr_tags.tag_id=messages_tags.tag_id))");
+ stmt.setInt(1, uid);
+ stmt.setInt(2, mid);
+ rs = stmt.executeQuery();
+ rs.beforeFirst();
+ while (rs.next()) {
+ jids.add(rs.getString(1));
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+ return jids;
+ }
+
public static ArrayList<String> getJIDSubscribedToComments(Connection sql, int mid, int ignore_uid) {
ArrayList<String> jids = new ArrayList<String>();