diff options
author | Ugnich Anton | 2013-12-19 01:01:34 +0700 |
---|---|---|
committer | Ugnich Anton | 2013-12-19 01:01:34 +0700 |
commit | 94dba01c5581e43b618d6828ed1b378fd63461a8 (patch) | |
tree | 4f92d68fdab892bfb0f3d14984ba1a18d8094497 /src/com | |
parent | 8019c7bb6a181d5c36bca40fcbf8b5042d825191 (diff) |
Message.FriendsOnly, Message.ReadOnly
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/juick/json/Message.java | 29 |
1 files changed, 15 insertions, 14 deletions
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) { } |