aboutsummaryrefslogtreecommitdiff
path: root/src/com/juick/server/MessagesQueries.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/juick/server/MessagesQueries.java')
-rw-r--r--src/com/juick/server/MessagesQueries.java30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/com/juick/server/MessagesQueries.java b/src/com/juick/server/MessagesQueries.java
index f7625a19..7b4b800d 100644
--- a/src/com/juick/server/MessagesQueries.java
+++ b/src/com/juick/server/MessagesQueries.java
@@ -100,7 +100,7 @@ public class MessagesQueries {
PreparedStatement stmt = null;
ResultSet rs = null;
try {
- stmt = sql.prepareStatement("SELECT messages.user_id,users.nick,messages.ts,messages.readonly,messages.attach,messages.place_id,messages.lat,messages.lon FROM messages INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id=?");
+ stmt = sql.prepareStatement("SELECT messages.user_id,users.nick,TIMESTAMPDIFF(MINUTE,messages.ts,NOW()),messages.ts,messages.readonly,messages.privacy,messages.replies,messages.attach,messages.place_id,messages.lat,messages.lon FROM messages INNER JOIN users ON messages.user_id=users.id WHERE messages.message_id=?");
stmt.setInt(1, mid);
rs = stmt.executeQuery();
if (rs.first()) {
@@ -109,16 +109,19 @@ public class MessagesQueries {
msg.User = new com.juick.User();
msg.User.UID = rs.getInt(1);
msg.User.UName = rs.getString(2);
- msg.TimestampString = rs.getString(3);
- msg.ReadOnly = rs.getBoolean(4);
- msg.AttachmentType = rs.getString(5);
- if (rs.getInt(6) > 0) {
- msg.Place = PlacesQueries.getPlace(sql, rs.getInt(6));
+ msg.TimeAgo = rs.getInt(3);
+ msg.TimestampString = rs.getString(4);
+ msg.ReadOnly = rs.getBoolean(5);
+ msg.Privacy = rs.getInt(6);
+ msg.Replies = rs.getInt(7);
+ msg.AttachmentType = rs.getString(8);
+ if (rs.getInt(9) > 0) {
+ msg.Place = PlacesQueries.getPlace(sql, rs.getInt(9));
}
- if (rs.getDouble(7) != 0) {
+ if (rs.getDouble(10) != 0) {
msg.Place = new com.juick.Place();
- msg.Place.lat = rs.getDouble(7);
- msg.Place.lon = rs.getDouble(8);
+ msg.Place.lat = rs.getDouble(10);
+ msg.Place.lon = rs.getDouble(11);
}
}
} catch (SQLException e) {
@@ -132,12 +135,15 @@ public class MessagesQueries {
}
try {
- stmt = sql.prepareStatement("SELECT messages_txt.tags,messages_txt.txt FROM messages_txt WHERE message_id=?");
+ stmt = sql.prepareStatement("SELECT tags,repliesby,txt FROM messages_txt WHERE message_id=?");
stmt.setInt(1, mid);
rs = stmt.executeQuery();
if (rs.first()) {
- msg.parseTags(rs.getString(1));
- msg.Text = rs.getString(2);
+ if (rs.getString(1) != null) {
+ msg.parseTags(rs.getString(1));
+ }
+ msg.RepliesBy = rs.getString(2);
+ msg.Text = rs.getString(3);
}
} catch (SQLException e) {
System.err.println(e);