aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/CrosspostQueries.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/juick/server/CrosspostQueries.java')
-rw-r--r--src/com/juick/server/CrosspostQueries.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/com/juick/server/CrosspostQueries.java b/src/com/juick/server/CrosspostQueries.java
index 09d951c1..fd677048 100644
--- a/src/com/juick/server/CrosspostQueries.java
+++ b/src/com/juick/server/CrosspostQueries.java
@@ -34,7 +34,7 @@ public class CrosspostQueries {
PreparedStatement stmt = null;
ResultSet rs = null;
try {
- stmt = sql.prepareStatement("SELECT access_token,access_token_secret FROM twitter WHERE user_id=?");
+ stmt = sql.prepareStatement("SELECT access_token,access_token_secret FROM twitter WHERE user_id=? AND crosspost=1");
stmt.setInt(1, uid);
rs = stmt.executeQuery();
if (rs.first()) {
@@ -54,4 +54,27 @@ public class CrosspostQueries {
public static String getFacebookToken(Connection sql, int uid) {
return SQLHelpers.getString(sql, "SELECT access_token FROM facebook WHERE user_id=? AND access_token IS NOT NULL AND crosspost=1", uid);
}
+
+ public static String[] getVKTokens(Connection sql, int uid) {
+ String tokens[] = null;
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT vk_id,access_token FROM vk WHERE user_id=? AND crosspost=1");
+ stmt.setInt(1, uid);
+ rs = stmt.executeQuery();
+ if (rs.first()) {
+ tokens = new String[2];
+ tokens[0] = rs.getString(1);
+ tokens[1] = rs.getString(2);
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+
+ return tokens;
+ }
}