aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-12-07 18:56:43 +0700
committerGravatar Vitaly Takmazov2016-12-07 22:37:17 +0300
commit69a5bdba32cdf0a48e51baa8c9fb28dca013f515 (patch)
tree678ca66ebd5e3c6e0e46f179542ff35fcf52c767 /juick-xmpp/src/main/java
parentbad2718b1b85d806221fce52c76fa1d388993396 (diff)
message improvenments, checking for tag's duplicates
Diffstat (limited to 'juick-xmpp/src/main/java')
-rw-r--r--juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java29
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 7473134c..08e38c41 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