From 51d9de02265d6cc9d6045d79497d2a987ae2f7f7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 15 Nov 2016 14:21:27 +0300 Subject: core classes are now serializeable with JAXB (to use as babbler extension) --- .../com/juick/xmpp/extensions/JuickMessage.java | 36 +++++++++++----------- .../java/com/juick/xmpp/extensions/JuickUser.java | 12 ++++---- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'juick-core/src/main/java/com/juick/xmpp/extensions') 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 += "" + XmlUtils.escape(getText()) + ""; } - for (com.juick.Tag Tag : Tags) { + for (com.juick.Tag Tag : getTags()) { ret += "" + XmlUtils.escape(Tag.getName()) + ""; } ret += ""; @@ -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; -- cgit v1.2.3