mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 08:12:05 +01:00
Improve XmlStringBuilder usage in Bytestream
This commit is contained in:
parent
6021f8a8ce
commit
650da55b23
1 changed files with 6 additions and 8 deletions
|
@ -221,17 +221,13 @@ public class Bytestream extends IQ {
|
|||
@Override
|
||||
public XmlStringBuilder getChildElementXML() {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.halfOpenElement(IQ.QUERY_ELEMENT);
|
||||
xml.halfOpenElement(QUERY_ELEMENT);
|
||||
xml.xmlnsAttribute(NAMESPACE);
|
||||
|
||||
switch(getType()) {
|
||||
case set:
|
||||
if (getSessionID() != null) {
|
||||
xml.attribute("sid", getSessionID());
|
||||
}
|
||||
if (getMode() != null) {
|
||||
xml.attribute("mode", getMode());
|
||||
}
|
||||
xml.optAttribute("sid", getSessionID());
|
||||
xml.optAttribute("mode", getMode());
|
||||
xml.rightAngelBracket();
|
||||
if (getToActivate() == null) {
|
||||
for (StreamHost streamHost : getStreamHosts()) {
|
||||
|
@ -256,11 +252,13 @@ public class Bytestream extends IQ {
|
|||
break;
|
||||
case get:
|
||||
xml.closeEmptyElement();
|
||||
// Return here so that we don't run into the
|
||||
// closeElement(QUERY_ELEMNT) section
|
||||
return xml;
|
||||
default:
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
xml.closeElement(IQ.QUERY_ELEMENT);
|
||||
xml.closeElement(QUERY_ELEMENT);
|
||||
|
||||
return xml;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue