From 94dba01c5581e43b618d6828ed1b378fd63461a8 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Thu, 19 Dec 2013 01:01:34 +0700 Subject: Message.FriendsOnly, Message.ReadOnly --- src/com/juick/json/Message.java | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/com') diff --git a/src/com/juick/json/Message.java b/src/com/juick/json/Message.java index c765a5d8..4ab1901a 100644 --- a/src/com/juick/json/Message.java +++ b/src/com/juick/json/Message.java @@ -40,6 +40,10 @@ public class Message { if (json.has("replyto")) { jmsg.ReplyTo = json.getInt("replyto"); } + + jmsg.FriendsOnly = json.has("friendsonly"); + jmsg.ReadOnly = json.has("readonly"); + jmsg.Text = json.getString("body").replace(""", "\""); jmsg.User = com.juick.json.User.parseJSON(json.getJSONObject("user")); @@ -64,9 +68,6 @@ public class Message { if (json.has("photo")) { jmsg.Photo = json.getJSONObject("photo").getString("small"); } - if (json.has("video")) { - jmsg.Video = json.getJSONObject("video").getString("mp4"); - } return jmsg; } @@ -84,6 +85,12 @@ public class Message { if (msg.ReplyTo > 0) { json.put("replyto", msg.ReplyTo); } + if (msg.FriendsOnly) { + json.put("friendsonly", 1); + } + if (msg.ReadOnly) { + json.put("readonly", 1); + } if (msg.Text != null) { json.put("body", msg.Text); } @@ -106,17 +113,11 @@ public class Message { } if (msg.AttachmentType != null) { String fname = msg.MID + (msg.RID > 0 ? "-" + msg.RID : "") + "." + msg.AttachmentType; - if (msg.AttachmentType.equals("mp4")) { - JSONObject video = new JSONObject(); - video.put("mp4", "http://i.juick.com/video/" + fname); - json.put("video", video); - } else { - JSONObject photo = new JSONObject(); - photo.put("thumbnail", "http://i.juick.com/ps/" + fname); - photo.put("small", "http://i.juick.com/photos-512/" + fname); - photo.put("medium", "http://i.juick.com/photos-1024/" + fname); - json.put("photo", photo); - } + JSONObject photo = new JSONObject(); + photo.put("thumbnail", "http://i.juick.com/ps/" + fname); + photo.put("small", "http://i.juick.com/photos-512/" + fname); + photo.put("medium", "http://i.juick.com/photos-1024/" + fname); + json.put("photo", photo); } } catch (JSONException e) { } -- cgit v1.2.3