aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/PMQueries.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server/PMQueries.java')
-rw-r--r--src/main/java/com/juick/server/PMQueries.java12
1 files changed, 6 insertions, 6 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);