aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/UserQueries.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/juick/server/UserQueries.java')
-rw-r--r--src/com/juick/server/UserQueries.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/juick/server/UserQueries.java b/src/com/juick/server/UserQueries.java
index bb4d19df..e56accdb 100644
--- a/src/com/juick/server/UserQueries.java
+++ b/src/com/juick/server/UserQueries.java
@@ -123,6 +123,29 @@ public class UserQueries {
return user;
}
+ public static com.juick.User getUserByJID(Connection sql, String jid) {
+ com.juick.User user = null;
+
+ PreparedStatement stmt = null;
+ ResultSet rs = null;
+ try {
+ stmt = sql.prepareStatement("SELECT id,nick FROM users WHERE id=(SELECT user_id FROM jids WHERE jid=?)");
+ stmt.setString(1, jid);
+ rs = stmt.executeQuery();
+ if (rs.first()) {
+ user = new com.juick.User();
+ user.UID = rs.getInt(1);
+ user.UName = rs.getString(2);
+ user.JID = jid;
+ }
+ } catch (SQLException e) {
+ System.err.println(e);
+ } finally {
+ Utils.finishSQL(rs, stmt);
+ }
+ return user;
+ }
+
public static ArrayList<com.juick.User> getUsersByName(Connection sql, ArrayList<String> unames) {
ArrayList<com.juick.User> users = new ArrayList<com.juick.User>();