diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/juick/server/PMQueries.java | 12 | ||||
-rw-r--r-- | src/main/java/com/juick/server/UserQueries.java | 3 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/com/juick/server/PMQueries.java b/src/main/java/com/juick/server/PMQueries.java index 9ff464ba..d1d826cc 100644 --- a/src/main/java/com/juick/server/PMQueries.java +++ b/src/main/java/com/juick/server/PMQueries.java @@ -39,20 +39,20 @@ public class PMQueries { public static boolean createPM(JdbcTemplate sql, int uid_from, int uid_to, String body) { boolean ret = sql.update("INSERT INTO pm(user_id,user_id_to,txt) VALUES (?,?,?)", - new Object[] {uid_from, uid_to, body}) > 0; + uid_from, uid_to, body) > 0; if (ret) { sql.update("INSERT INTO pm_streams(user_id,user_id_to,lastmessage,unread) " + "VALUES (?,?,NOW(),1) " + "ON DUPLICATE KEY UPDATE lastmessage=NOW(),unread=unread+1", - new Object[] {uid_from, uid_to}); + uid_from, uid_to); } return ret; } public static boolean addPMinRoster(JdbcTemplate sql, int uid, String jid) { return sql.update("INSERT INTO pm_inroster(user_id,jid) VALUES (?,?)", - new Object[] {uid, jid}) > 0; + uid, jid) > 0; } public static boolean removePMinRoster(Connection sql, int uid, String jid) { @@ -74,7 +74,7 @@ public class PMQueries { public static boolean havePMinRoster(JdbcTemplate sql, int uid, String jid) { List<Integer> res = sql.queryForList("SELECT 1 FROM pm_inroster " + "WHERE user_id=? AND jid=?", Integer.class, - new Object[] {uid, jid}); + uid, jid); return res.size() > 0; } @@ -107,7 +107,7 @@ public class PMQueries { u.setUID(rs.getInt(1)); u.MessagesCount = rs.getInt(2); return u; - }, new Object[]{uid}); + }, uid); if (users.size() < cnt) { List<User> addUsers = sql.query("SELECT user_id,user_id_to " @@ -118,7 +118,7 @@ public class PMQueries { int uuid = rs.getInt(1) + rs.getInt(2) - uid; u.setUID(uuid); return u; - }, new Object[]{uid, uid, cnt * 2}); + }, uid, uid, cnt * 2); for (User addUser : addUsers) { if (!haveUserInArray(users, addUser.getUID())) { users.add(addUser); diff --git a/src/main/java/com/juick/server/UserQueries.java b/src/main/java/com/juick/server/UserQueries.java index cfa52a16..184d26f5 100644 --- a/src/main/java/com/juick/server/UserQueries.java +++ b/src/main/java/com/juick/server/UserQueries.java @@ -127,7 +127,8 @@ public class UserQueries { sql.query("SELECT id,nick,banned FROM users WHERE id IN (" + uids + ")", (rs, num) -> { - User u = users.get(num); + User u = new User(); + u.setUID(rs.getInt(1)); u.setUName(rs.getString(2)); return u; }); |