diff options
Diffstat (limited to 'juick-xmpp/src/main/java/com')
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java b/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java index 7473134c7..08e38c416 100644 --- a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java +++ b/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java @@ -17,18 +17,17 @@ */ package com.juick.xmpp.extensions; +import com.juick.xmpp.StanzaChild; import com.juick.xmpp.utils.XmlUtils; -import com.juick.xmpp.*; -import java.io.IOException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; +import java.io.IOException; + /** - * * @author Ugnich Anton */ public class JuickUser extends com.juick.User implements StanzaChild { - public final static String XMLNS = "http://juick.com/user"; public final static String TagName = "user"; @@ -57,15 +56,19 @@ public class JuickUser extends com.juick.User implements StanzaChild { } public static String toString(com.juick.User user) { - String str = "<" + TagName + " xmlns='" + XMLNS + "'"; - if (user.getUid() > 0) { - str += " uid='" + user.getUid() + "'"; - } - if (user.getName() != null && user.getName().length() > 0) { - str += " uname='" + XmlUtils.escape(user.getName()) + "'"; - } - str += "/>"; - return str; + StringBuilder builder = new StringBuilder(); + + builder.append("<").append(TagName).append(" xmlns='").append(XMLNS).append("'"); + + if (user.getUid() > 0) + builder.append(" uid='").append(user.getUid()).append("'"); + + if (user.getName() != null && user.getName().length() > 0) + builder.append(" uname='").append(XmlUtils.escape(user.getName())).append("'"); + + builder.append("/>"); + + return builder.toString(); } @Override |