mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Send more information with the stream open tag
This commit is contained in:
parent
e493500cfe
commit
37081b2810
3 changed files with 35 additions and 5 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smack.packet;
|
||||
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
/**
|
||||
|
@ -59,13 +60,17 @@ public class StreamOpen extends FullStreamElement {
|
|||
*/
|
||||
private final String contentNamespace;
|
||||
|
||||
public StreamOpen(String to) {
|
||||
public StreamOpen(CharSequence to) {
|
||||
this(to, null, null, null, StreamContentNamespace.client);
|
||||
}
|
||||
|
||||
public StreamOpen(String to, String from, String id, String lang, StreamContentNamespace ns) {
|
||||
this.to = to;
|
||||
this.from = from;
|
||||
public StreamOpen(CharSequence to, CharSequence from, String id) {
|
||||
this(to, from, id, "en", StreamContentNamespace.client);
|
||||
}
|
||||
|
||||
public StreamOpen(CharSequence to, CharSequence from, String id, String lang, StreamContentNamespace ns) {
|
||||
this.to = StringUtils.maybeToString(to);
|
||||
this.from = StringUtils.maybeToString(from);
|
||||
this.id = id;
|
||||
this.lang = lang;
|
||||
switch (ns) {
|
||||
|
|
|
@ -264,4 +264,17 @@ public class StringUtils {
|
|||
}
|
||||
return cs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the String representation of the given char sequence if it is not null.
|
||||
*
|
||||
* @param cs the char sequence or null.
|
||||
* @return the String representation of <code>cs</code> or null.
|
||||
*/
|
||||
public static String maybeToString(CharSequence cs) {
|
||||
if (cs == null) {
|
||||
return null;
|
||||
}
|
||||
return cs.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue