aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/json
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com/juick/json')
-rw-r--r--src/test/java/com/juick/json/MessageSerializer.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/test/java/com/juick/json/MessageSerializer.java b/src/test/java/com/juick/json/MessageSerializer.java
index ebc3b0b0..38596a1a 100644
--- a/src/test/java/com/juick/json/MessageSerializer.java
+++ b/src/test/java/com/juick/json/MessageSerializer.java
@@ -18,6 +18,7 @@
package com.juick.json;
import com.juick.Message;
+import com.juick.Photo;
import com.juick.Tag;
import org.json.JSONArray;
import org.json.JSONException;
@@ -79,7 +80,12 @@ public class MessageSerializer extends JSONSerializer<Message> {
}
if (json.has("photo")) {
- jmsg.Photo = json.getJSONObject("photo").getString("small");
+ JSONObject obj = json.getJSONObject("photo");
+ Photo photo = new Photo();
+ photo.setSmall(obj.getString("small"));
+ photo.setMedium(obj.getString("medium"));
+ photo.setThumbnail(obj.getString("thumbnail"));
+ jmsg.setPhoto(photo);
}
return jmsg;
@@ -123,8 +129,9 @@ public class MessageSerializer extends JSONSerializer<Message> {
if (msg.Place != null) {
json.put("place", placeSerializer.serialize(msg.Place));
}
- if (msg.AttachmentType != null) {
- String fname = msg.getMid() + (msg.getRid() > 0 ? "-" + msg.getRid() : "") + "." + msg.AttachmentType;
+ if (msg.getAttachmentType() != null) {
+ json.put("attach", msg.getAttachmentType());
+ String fname = msg.getMid() + (msg.getRid() > 0 ? "-" + msg.getRid() : "") + "." + msg.getAttachmentType();
JSONObject photo = new JSONObject();
String protocol = getUriScheme() == URIScheme.Plain ? "http:" : "https:";
photo.put("thumbnail", protocol + "//i.juick.com/ps/" + fname);