From b67b2f126af0c410cdb5b1a925d19b5d2cc5b2b2 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Tue, 15 Jul 2014 16:56:38 +0700 Subject: User.Banned --- src/com/juick/server/MessagesQueries.java | 11 ++++++----- src/com/juick/server/UserQueries.java | 6 ++++-- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java index 124f3898..fbdd7e69 100644 --- a/src/com/juick/server/MessagesQueries.java +++ b/src/com/juick/server/MessagesQueries.java @@ -951,7 +951,7 @@ public class MessagesQueries { PreparedStatement stmt = null; ResultSet rs = null; try { - stmt = sql.prepareStatement("SELECT replies.reply_id,replies.replyto,replies.user_id,users.nick,replies.txt,TIMESTAMPDIFF(MINUTE,replies.ts,NOW()),DATE_FORMAT(replies.ts,'%Y-%m-%d %H:%i:%s'),replies.attach FROM replies INNER JOIN users ON replies.user_id=users.id WHERE replies.message_id=? ORDER BY replies.reply_id ASC"); + stmt = sql.prepareStatement("SELECT replies.reply_id,replies.replyto,replies.user_id,users.nick,users.banned,replies.txt,TIMESTAMPDIFF(MINUTE,replies.ts,NOW()),DATE_FORMAT(replies.ts,'%Y-%m-%d %H:%i:%s'),replies.attach FROM replies INNER JOIN users ON replies.user_id=users.id WHERE replies.message_id=? ORDER BY replies.reply_id ASC"); stmt.setInt(1, mid); rs = stmt.executeQuery(); rs.beforeFirst(); @@ -963,10 +963,11 @@ public class MessagesQueries { msg.User = new com.juick.User(); msg.User.UID = rs.getInt(3); msg.User.UName = rs.getString(4); - msg.Text = rs.getString(5); - msg.TimeAgo = rs.getInt(6); - msg.TimestampString = rs.getString(7); - msg.AttachmentType = rs.getString(8); + msg.User.Banned = rs.getBoolean(5); + msg.Text = rs.getString(6); + msg.TimeAgo = rs.getInt(7); + msg.TimestampString = rs.getString(8); + msg.AttachmentType = rs.getString(9); replies.add(msg); } diff --git a/src/com/juick/server/UserQueries.java b/src/com/juick/server/UserQueries.java index 5c1aaccf..d1313715 100644 --- a/src/com/juick/server/UserQueries.java +++ b/src/com/juick/server/UserQueries.java @@ -87,13 +87,14 @@ public class UserQueries { PreparedStatement stmt = null; ResultSet rs = null; try { - stmt = sql.prepareStatement("SELECT nick FROM users WHERE id=?"); + stmt = sql.prepareStatement("SELECT nick,banned FROM users WHERE id=?"); stmt.setInt(1, uid); rs = stmt.executeQuery(); if (rs.first()) { user = new com.juick.User(); user.UID = uid; user.UName = rs.getString(1); + user.Banned = rs.getBoolean(2); } } catch (SQLException e) { System.err.println(e); @@ -109,13 +110,14 @@ public class UserQueries { PreparedStatement stmt = null; ResultSet rs = null; try { - stmt = sql.prepareStatement("SELECT id,nick FROM users WHERE nick=?"); + stmt = sql.prepareStatement("SELECT id,nick,banned FROM users WHERE nick=?"); stmt.setString(1, username); rs = stmt.executeQuery(); if (rs.first()) { user = new com.juick.User(); user.UID = rs.getInt(1); user.UName = rs.getString(2); + user.Banned = rs.getBoolean(3); } } catch (SQLException e) { System.err.println(e); -- cgit v1.2.3