aboutsummaryrefslogtreecommitdiff
path: root/juick-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-core/src')
-rw-r--r--juick-core/src/main/java/com/juick/Message.java119
-rw-r--r--juick-core/src/main/java/com/juick/Tag.java17
-rw-r--r--juick-core/src/main/java/com/juick/User.java57
-rw-r--r--juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java12
-rw-r--r--juick-core/src/main/java/com/juick/json/MessageSerializer.java26
-rw-r--r--juick-core/src/main/java/com/juick/json/UserSerializer.java12
-rw-r--r--juick-core/src/main/java/com/juick/package-info.java16
-rw-r--r--juick-core/src/main/java/com/juick/xml/adapters/SimpleDateAdapter.java35
-rw-r--r--juick-core/src/main/java/com/juick/xmpp/extensions/JuickMessage.java36
-rw-r--r--juick-core/src/main/java/com/juick/xmpp/extensions/JuickUser.java12
10 files changed, 237 insertions, 105 deletions
diff --git a/juick-core/src/main/java/com/juick/Message.java b/juick-core/src/main/java/com/juick/Message.java
index 8afd1d7b..d60abc5e 100644
--- a/juick-core/src/main/java/com/juick/Message.java
+++ b/juick-core/src/main/java/com/juick/Message.java
@@ -20,7 +20,10 @@ package com.juick;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.juick.xml.adapters.SimpleDateAdapter;
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.*;
import java.util.stream.Collectors;
@@ -28,31 +31,37 @@ import java.util.stream.Collectors;
*
* @author Ugnich Anton
*/
+@XmlRootElement(name = "juick", namespace = "http://juick.com/message")
+@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
public class Message implements Comparable {
- private int MID = 0;
- private int RID = 0;
-
- @JsonProperty("replyto")
- public int ReplyTo = 0;
- private String Text = null;
- private User User = null;
- @JsonProperty("tags")
- public List<Tag> Tags = new ArrayList<>();
+ private int mid = 0;
+ private int rid = 0;
+ private int replyto = 0;
+ private String text = null;
+ private User user = null;
+ private List<Tag> Tags = new ArrayList<>();
private Date date;
+ @XmlTransient
public int TimeAgo = 0;
@JsonIgnore
- public int Privacy = 1;
+ private int privacy = 1;
+ @XmlTransient
public boolean FriendsOnly = false;
+ @XmlTransient
public boolean ReadOnly = false;
+ @XmlTransient
public boolean Hidden = false;
@JsonIgnore
+ @XmlTransient
public boolean VisitorCanComment = true;
+ @XmlTransient
public int Replies = 0;
public String RepliesBy = null;
public String AttachmentType = null;
public String Photo = null;
public String Video = null;
public Place Place = null;
+ @XmlTransient
public int Likes = 0;
private boolean liked = false;
public List<Message> childs = new ArrayList<>();
@@ -64,15 +73,15 @@ public class Message implements Comparable {
}
public Message(Message msg) {
- setMID(msg.getMID());
- setRID(msg.getRID());
- ReplyTo = msg.ReplyTo;
+ setMid(msg.getMid());
+ setRid(msg.getRid());
+ replyto = msg.replyto;
setText(msg.getText());
setUser(msg.getUser());
Tags = msg.Tags;
setDate(msg.getDate());
TimeAgo = msg.TimeAgo;
- Privacy = msg.Privacy;
+ privacy = msg.privacy;
FriendsOnly = msg.FriendsOnly;
ReadOnly = msg.ReadOnly;
Hidden = msg.Hidden;
@@ -101,7 +110,7 @@ public class Message implements Comparable {
return false;
}
Message jmsg = (Message) obj;
- return (this.getMID() == jmsg.getMID() && this.getRID() == jmsg.getRID());
+ return (this.getMid() == jmsg.getMid() && this.getRid() == jmsg.getRid());
}
@Override
@@ -111,16 +120,16 @@ public class Message implements Comparable {
}
Message jmsg = (Message) obj;
- if (this.getMID() != jmsg.getMID()) {
- if (this.getMID() > jmsg.getMID()) {
+ if (this.getMid() != jmsg.getMid()) {
+ if (this.getMid() > jmsg.getMid()) {
return -1;
} else {
return 1;
}
}
- if (this.getRID() != jmsg.getRID()) {
- if (this.getRID() < jmsg.getRID()) {
+ if (this.getRid() != jmsg.getRid()) {
+ if (this.getRid() < jmsg.getRid()) {
return -1;
} else {
return 1;
@@ -151,9 +160,9 @@ public class Message implements Comparable {
if (AttachmentType != null) {
String url = "http://i.juick.com/";
url += AttachmentType.equals("mp4") ? "video" : "photos-1024";
- url += "/" + getMID();
- if (getRID() > 0) {
- url += "-" + getRID();
+ url += "/" + getMid();
+ if (getRid() > 0) {
+ url += "-" + getRid();
}
url += "." + AttachmentType;
return url;
@@ -171,13 +180,13 @@ public class Message implements Comparable {
if (FriendsOnly) {
ret += " *friends";
}
- if (Privacy == -2) {
+ if (privacy == -2) {
ret += " *private";
}
- if (Privacy == -1) {
+ if (privacy == -1) {
ret += " *friends";
}
- if (Privacy == 2) {
+ if (privacy == 2) {
ret += " *public";
}
if (ReadOnly) {
@@ -188,42 +197,48 @@ public class Message implements Comparable {
}
@JsonProperty("mid")
- public int getMID() {
- return MID;
+ @XmlAttribute(name = "mid")
+ public int getMid() {
+ return mid;
}
- public void setMID(int MID) {
- this.MID = MID;
+ public void setMid(int mid) {
+ this.mid = mid;
}
@JsonProperty("rid")
- public int getRID() {
- return RID;
+ @XmlAttribute(name = "rid")
+ public int getRid() {
+ return rid;
}
- public void setRID(int RID) {
- this.RID = RID;
+ public void setRid(int rid) {
+ this.rid = rid;
}
+ @XmlElement(name = "user", namespace = "http://juick.com/user")
public com.juick.User getUser() {
- return User;
+ return user;
}
public void setUser(com.juick.User user) {
- User = user;
+ this.user = user;
}
@JsonProperty("body")
+ @XmlElement(name = "body")
public String getText() {
- return Text;
+ return text;
}
public void setText(String text) {
- Text = text;
+ this.text = text;
}
@JsonProperty("timestamp")
@JsonFormat(shape= JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss", timezone="UTC")
+ @XmlAttribute(name = "ts")
+ @XmlJavaTypeAdapter(SimpleDateAdapter.class)
public Date getDate() {
return date;
}
@@ -248,6 +263,7 @@ public class Message implements Comparable {
this.Recommendation = recommendation;
}
+ @XmlTransient
public boolean isLiked() {
return liked;
}
@@ -262,4 +278,33 @@ public class Message implements Comparable {
public void setReplyQuote(String quote) {
replyQuote = quote;
}
+
+ @JsonProperty("replyto")
+ @XmlAttribute(name = "replyto")
+ public int getReplyto() {
+ return replyto;
+ }
+
+ public void setReplyto(int replyto) {
+ this.replyto = replyto;
+ }
+
+ @JsonProperty("tags")
+ @XmlElement(name = "tag")
+ public List<Tag> getTags() {
+ return Tags;
+ }
+
+ public void setTags(List<Tag> tags) {
+ Tags = tags;
+ }
+
+ @XmlAttribute
+ public int getPrivacy() {
+ return privacy;
+ }
+
+ public void setPrivacy(int privacy) {
+ this.privacy = privacy;
+ }
}
diff --git a/juick-core/src/main/java/com/juick/Tag.java b/juick-core/src/main/java/com/juick/Tag.java
index fa518e84..4ba3a812 100644
--- a/juick-core/src/main/java/com/juick/Tag.java
+++ b/juick-core/src/main/java/com/juick/Tag.java
@@ -20,18 +20,28 @@ package com.juick;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonValue;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlValue;
import java.util.Objects;
/**
* @author Ugnich Anton
*/
+@XmlRootElement(name = "tag", namespace = "http://juick.com/message")
+@XmlAccessorType(XmlAccessType.PROPERTY)
public class Tag {
- private final String name;
+
+ private String name;
public int TID = 0;
public int SynonymID = 0;
public int UsageCnt = 0;
+ public Tag() {
+
+ }
public Tag(String name) {
this.name = name;
@@ -44,6 +54,7 @@ public class Tag {
}
@JsonIgnore
+ @XmlValue
public String getName() {
return name;
}
@@ -53,4 +64,8 @@ public class Tag {
public String toString() {
return name;
}
+
+ public void setName(String name) {
+ this.name = name;
+ }
}
diff --git a/juick-core/src/main/java/com/juick/User.java b/juick-core/src/main/java/com/juick/User.java
index b8936bab..83dcda5f 100644
--- a/juick-core/src/main/java/com/juick/User.java
+++ b/juick-core/src/main/java/com/juick/User.java
@@ -20,27 +20,29 @@ package com.juick;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
+import javax.xml.bind.annotation.*;
+
/**
* @author Ugnich Anton
*/
+@XmlRootElement(name = "user", namespace = "http://juick.com/user")
+@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
public class User {
- private int UID = 0;
- private String UName = null;
- @JsonIgnore
- public Object Avatar = null;
+ private int uid = 0;
+ private String name = null;
+ private Object Avatar = null;
private String FullName = null;
private String JID = null;
private int MessagesCount = 0;
private String AuthHash = null;
- @JsonIgnore
- public boolean Banned = false;
+ private boolean Banned = false;
public User() {
}
public User(User u) {
- setUID(u.getUID());
- setUName(u.getUName());
+ setUid(u.getUid());
+ setName(u.getName());
Avatar = u.Avatar;
setFullName(u.getFullName());
setJID(u.getJID());
@@ -52,28 +54,31 @@ public class User {
@Override
public boolean equals(Object obj) {
return obj == this ||
- (obj instanceof User && ((User) obj).getUID() == this.getUID());
+ (obj instanceof User && ((User) obj).getUid() == this.getUid());
}
@JsonProperty("uid")
- public int getUID() {
- return UID;
+ @XmlAttribute(name = "uid")
+ public int getUid() {
+ return uid;
}
- public void setUID(int UID) {
- this.UID = UID;
+ public void setUid(int uid) {
+ this.uid = uid;
}
@JsonProperty("uname")
- public String getUName() {
- return UName;
+ @XmlAttribute(name = "uname")
+ public String getName() {
+ return name;
}
- public void setUName(String UName) {
- this.UName = UName;
+ public void setName(String name) {
+ this.name = name;
}
@JsonProperty("fullname")
+ @XmlTransient
public String getFullName() {
return FullName;
}
@@ -101,6 +106,7 @@ public class User {
}
@JsonProperty("unreadCount")
+ @XmlTransient
public Integer getUnreadCount() {
return MessagesCount;
}
@@ -108,4 +114,21 @@ public class User {
public void setUnreadCount(Integer count) {
MessagesCount = count;
}
+
+ @XmlTransient
+ public boolean isBanned() {
+ return Banned;
+ }
+
+ public void setBanned(boolean banned) {
+ Banned = banned;
+ }
+
+ public Object getAvatar() {
+ return Avatar;
+ }
+
+ public void setAvatar(Object avatar) {
+ Avatar = avatar;
+ }
}
diff --git a/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java b/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java
index 6c712d28..be2c6838 100644
--- a/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java
+++ b/juick-core/src/main/java/com/juick/formatters/PlainTextFormatter.java
@@ -1,17 +1,15 @@
package com.juick.formatters;
-import com.juick.Message;
-
/**
* Created by vitalyster on 12.10.2016.
*/
public class PlainTextFormatter {
public static String formatPost(com.juick.Message jmsg) {
StringBuilder sb = new StringBuilder();
- boolean isReply = jmsg.getRID() > 0;
+ boolean isReply = jmsg.getRid() > 0;
String title = isReply ? "Reply by @" : "@";
String subtitle = isReply ? jmsg.getReplyQuote() : jmsg.getTagsString();
- sb.append(title).append(jmsg.getUser().getUName()).append(":\n")
+ sb.append(title).append(jmsg.getUser().getName()).append(":\n")
.append(subtitle).append("\n").append(jmsg.getText()).append("\n");
if (jmsg.Photo != null) {
sb.append(jmsg.Photo);
@@ -20,9 +18,9 @@ public class PlainTextFormatter {
}
public static String formatUrl(com.juick.Message jmsg) {
- if (jmsg.getRID() > 0) {
- return String.format("https://juick.com/%d#%d", jmsg.getMID(), jmsg.getRID());
+ if (jmsg.getRid() > 0) {
+ return String.format("https://juick.com/%d#%d", jmsg.getMid(), jmsg.getRid());
}
- return "https://juick.com/" + jmsg.getMID();
+ return "https://juick.com/" + jmsg.getMid();
}
}
diff --git a/juick-core/src/main/java/com/juick/json/MessageSerializer.java b/juick-core/src/main/java/com/juick/json/MessageSerializer.java
index 3ef903f0..ebc3b0b0 100644
--- a/juick-core/src/main/java/com/juick/json/MessageSerializer.java
+++ b/juick-core/src/main/java/com/juick/json/MessageSerializer.java
@@ -51,12 +51,12 @@ public class MessageSerializer extends JSONSerializer<Message> {
@Override
public Message deserialize(JSONObject json) throws JSONException, ParseException {
com.juick.Message jmsg = new com.juick.Message();
- jmsg.setMID(json.getInt("mid"));
+ jmsg.setMid(json.getInt("mid"));
if (json.has("rid")) {
- jmsg.setRID(json.getInt("rid"));
+ jmsg.setRid(json.getInt("rid"));
}
if (json.has("replyto")) {
- jmsg.ReplyTo = json.getInt("replyto");
+ jmsg.setReplyto(json.getInt("replyto"));
}
jmsg.FriendsOnly = json.has("friendsonly");
@@ -70,7 +70,7 @@ public class MessageSerializer extends JSONSerializer<Message> {
if (json.has("tags")) {
JSONArray tags = json.getJSONArray("tags");
for (int n = 0; n < tags.length(); n++) {
- jmsg.Tags.add(new Tag(tags.getString(n).replace("&quot;", "\"")));
+ jmsg.getTags().add(new Tag(tags.getString(n).replace("&quot;", "\"")));
}
}
@@ -90,14 +90,14 @@ public class MessageSerializer extends JSONSerializer<Message> {
JSONObject json = new JSONObject();
try {
- if (msg.getMID() > 0) {
- json.put("mid", msg.getMID());
+ if (msg.getMid() > 0) {
+ json.put("mid", msg.getMid());
}
- if (msg.getRID() > 0) {
- json.put("rid", msg.getRID());
+ if (msg.getRid() > 0) {
+ json.put("rid", msg.getRid());
}
- if (msg.ReplyTo > 0) {
- json.put("replyto", msg.ReplyTo);
+ if (msg.getReplyto() > 0) {
+ json.put("replyto", msg.getReplyto());
}
if (msg.FriendsOnly) {
json.put("friendsonly", 1);
@@ -114,8 +114,8 @@ public class MessageSerializer extends JSONSerializer<Message> {
if (msg.getUser() != null) {
json.put("user", userSerializer.serialize(msg.getUser()));
}
- if (msg.Tags != null && msg.Tags.size() > 0) {
- json.put("tags", new JSONArray(msg.Tags.stream().map(Tag::getName).collect(Collectors.toList())));
+ if (msg.getTags() != null && msg.getTags().size() > 0) {
+ json.put("tags", new JSONArray(msg.getTags().stream().map(Tag::getName).collect(Collectors.toList())));
}
if (msg.Replies > 0) {
json.put("replies", msg.Replies);
@@ -124,7 +124,7 @@ public class MessageSerializer extends JSONSerializer<Message> {
json.put("place", placeSerializer.serialize(msg.Place));
}
if (msg.AttachmentType != null) {
- String fname = msg.getMID() + (msg.getRID() > 0 ? "-" + msg.getRID() : "") + "." + msg.AttachmentType;
+ String fname = msg.getMid() + (msg.getRid() > 0 ? "-" + msg.getRid() : "") + "." + msg.AttachmentType;
JSONObject photo = new JSONObject();
String protocol = getUriScheme() == URIScheme.Plain ? "http:" : "https:";
photo.put("thumbnail", protocol + "//i.juick.com/ps/" + fname);
diff --git a/juick-core/src/main/java/com/juick/json/UserSerializer.java b/juick-core/src/main/java/com/juick/json/UserSerializer.java
index 390f4bf6..08d21d39 100644
--- a/juick-core/src/main/java/com/juick/json/UserSerializer.java
+++ b/juick-core/src/main/java/com/juick/json/UserSerializer.java
@@ -30,8 +30,8 @@ public class UserSerializer extends JSONSerializer<User> {
@Override
public User deserialize(JSONObject json) throws JSONException {
User juser = new User();
- juser.setUID(json.getInt("uid"));
- juser.setUName(json.getString("uname"));
+ juser.setUid(json.getInt("uid"));
+ juser.setName(json.getString("uname"));
if (json.has("fullname")) {
juser.setFullName(json.getString("fullname"));
}
@@ -43,11 +43,11 @@ public class UserSerializer extends JSONSerializer<User> {
JSONObject json = new JSONObject();
try {
- if (user.getUID() > 0) {
- json.put("uid", user.getUID());
+ if (user.getUid() > 0) {
+ json.put("uid", user.getUid());
}
- if (user.getUName() != null) {
- json.put("uname", user.getUName());
+ if (user.getName() != null) {
+ json.put("uname", user.getName());
}
if (user.getFullName() != null) {
json.put("fullname", user.getFullName());
diff --git a/juick-core/src/main/java/com/juick/package-info.java b/juick-core/src/main/java/com/juick/package-info.java
new file mode 100644
index 00000000..1ebddc60
--- /dev/null
+++ b/juick-core/src/main/java/com/juick/package-info.java
@@ -0,0 +1,16 @@
+/**
+ * Created by vitalyster on 15.11.2016.
+ */
+@XmlSchema(
+ namespace="http://juick.com/message",
+ elementFormDefault = XmlNsForm.QUALIFIED,
+ xmlns={
+ @XmlNs(prefix="", namespaceURI="http://juick.com/message"),
+ @XmlNs(prefix="user", namespaceURI="http://juick.com/user")
+ }
+)
+package com.juick;
+
+import javax.xml.bind.annotation.XmlNs;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlSchema; \ No newline at end of file
diff --git a/juick-core/src/main/java/com/juick/xml/adapters/SimpleDateAdapter.java b/juick-core/src/main/java/com/juick/xml/adapters/SimpleDateAdapter.java
new file mode 100644
index 00000000..9cb56909
--- /dev/null
+++ b/juick-core/src/main/java/com/juick/xml/adapters/SimpleDateAdapter.java
@@ -0,0 +1,35 @@
+package com.juick.xml.adapters;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+/**
+ * Created by vitalyster on 15.11.2016.
+ */
+
+public class SimpleDateAdapter extends XmlAdapter<String, Date> {
+
+ private final SimpleDateFormat dateFormat;
+ public SimpleDateAdapter() {
+ dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ }
+
+ @Override
+ public String marshal(Date v) throws Exception {
+ synchronized (dateFormat) {
+ return dateFormat.format(v);
+ }
+ }
+
+ @Override
+ public Date unmarshal(String v) throws Exception {
+ synchronized (dateFormat) {
+ return dateFormat.parse(v);
+ }
+ }
+
+}
diff --git a/juick-core/src/main/java/com/juick/xmpp/extensions/JuickMessage.java b/juick-core/src/main/java/com/juick/xmpp/extensions/JuickMessage.java
index d259bc43..2c3875c5 100644
--- a/juick-core/src/main/java/com/juick/xmpp/extensions/JuickMessage.java
+++ b/juick-core/src/main/java/com/juick/xmpp/extensions/JuickMessage.java
@@ -60,19 +60,19 @@ public class JuickMessage extends com.juick.Message implements StanzaChild {
final String sMID = parser.getAttributeValue(null, "mid");
if (sMID != null) {
- jmsg.setMID(Integer.parseInt(sMID));
+ jmsg.setMid(Integer.parseInt(sMID));
}
final String sRID = parser.getAttributeValue(null, "rid");
if (sRID != null) {
- jmsg.setRID(Integer.parseInt(sRID));
+ jmsg.setRid(Integer.parseInt(sRID));
}
final String sReplyTo = parser.getAttributeValue(null, "replyto");
if (sReplyTo != null) {
- jmsg.ReplyTo = Integer.parseInt(sReplyTo);
+ jmsg.setReplyto(Integer.parseInt(sReplyTo));
}
final String sPrivacy = parser.getAttributeValue(null, "privacy");
if (sPrivacy != null) {
- jmsg.Privacy = Integer.parseInt(sPrivacy);
+ jmsg.setPrivacy(Integer.parseInt(sPrivacy));
}
final String sFriendsOnly = parser.getAttributeValue(null, "friendsonly");
if (sFriendsOnly != null) {
@@ -96,7 +96,7 @@ public class JuickMessage extends com.juick.Message implements StanzaChild {
} else if (tag.equals(JuickUser.TagName) && xmlns != null && xmlns.equals(JuickUser.XMLNS)) {
jmsg.setUser(new JuickUser().parse(parser));
} else if (tag.equals("tag")) {
- jmsg.Tags.add(new Tag(XmlUtils.getTagText(parser)));
+ jmsg.getTags().add(new Tag(XmlUtils.getTagText(parser)));
} else {
XmlUtils.skip(parser);
}
@@ -109,16 +109,16 @@ public class JuickMessage extends com.juick.Message implements StanzaChild {
String ret = "";
ret = "<" + TagName + " xmlns=\"" + XMLNS + "\"";
- if (getMID() > 0) {
- ret += " mid=\"" + getMID() + "\"";
+ if (getMid() > 0) {
+ ret += " mid=\"" + getMid() + "\"";
}
- if (getRID() > 0) {
- ret += " rid=\"" + getRID() + "\"";
+ if (getRid() > 0) {
+ ret += " rid=\"" + getRid() + "\"";
}
- if (ReplyTo > 0) {
- ret += " replyto=\"" + ReplyTo + "\"";
+ if (getReplyto() > 0) {
+ ret += " replyto=\"" + getReplyto() + "\"";
}
- ret += " privacy=\"" + Privacy + "\"";
+ ret += " privacy=\"" + getPrivacy() + "\"";
if (FriendsOnly) {
ret += " friendsonly=\"1\"";
}
@@ -138,7 +138,7 @@ public class JuickMessage extends com.juick.Message implements StanzaChild {
if (getText() != null) {
ret += "<body>" + XmlUtils.escape(getText()) + "</body>";
}
- for (com.juick.Tag Tag : Tags) {
+ for (com.juick.Tag Tag : getTags()) {
ret += "<tag>" + XmlUtils.escape(Tag.getName()) + "</tag>";
}
ret += "</" + TagName + ">";
@@ -152,7 +152,7 @@ public class JuickMessage extends com.juick.Message implements StanzaChild {
return false;
}
JuickMessage jmsg = (JuickMessage) obj;
- return (this.getMID() == jmsg.getMID() && this.getRID() == jmsg.getRID());
+ return (this.getMid() == jmsg.getMid() && this.getRid() == jmsg.getRid());
}
@Override
@@ -162,16 +162,16 @@ public class JuickMessage extends com.juick.Message implements StanzaChild {
}
JuickMessage jmsg = (JuickMessage) obj;
- if (this.getMID() != jmsg.getMID()) {
- if (this.getMID() > jmsg.getMID()) {
+ if (this.getMid() != jmsg.getMid()) {
+ if (this.getMid() > jmsg.getMid()) {
return -1;
} else {
return 1;
}
}
- if (this.getRID() != jmsg.getRID()) {
- if (this.getRID() < jmsg.getRID()) {
+ if (this.getRid() != jmsg.getRid()) {
+ if (this.getRid() < jmsg.getRid()) {
return -1;
} else {
return 1;
diff --git a/juick-core/src/main/java/com/juick/xmpp/extensions/JuickUser.java b/juick-core/src/main/java/com/juick/xmpp/extensions/JuickUser.java
index edc6749a..7473134c 100644
--- a/juick-core/src/main/java/com/juick/xmpp/extensions/JuickUser.java
+++ b/juick-core/src/main/java/com/juick/xmpp/extensions/JuickUser.java
@@ -49,20 +49,20 @@ public class JuickUser extends com.juick.User implements StanzaChild {
JuickUser juser = new JuickUser();
String strUID = parser.getAttributeValue(null, "uid");
if (strUID != null) {
- juser.setUID(Integer.parseInt(strUID));
+ juser.setUid(Integer.parseInt(strUID));
}
- juser.setUName(parser.getAttributeValue(null, "uname"));
+ juser.setName(parser.getAttributeValue(null, "uname"));
XmlUtils.skip(parser);
return juser;
}
public static String toString(com.juick.User user) {
String str = "<" + TagName + " xmlns='" + XMLNS + "'";
- if (user.getUID() > 0) {
- str += " uid='" + user.getUID() + "'";
+ if (user.getUid() > 0) {
+ str += " uid='" + user.getUid() + "'";
}
- if (user.getUName() != null && user.getUName().length() > 0) {
- str += " uname='" + XmlUtils.escape(user.getUName()) + "'";
+ if (user.getName() != null && user.getName().length() > 0) {
+ str += " uname='" + XmlUtils.escape(user.getName()) + "'";
}
str += "/>";
return str;