mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 05:22:06 +01:00
[jingle] Add empty element optimization for <content/>
This commit is contained in:
parent
ec456399b5
commit
585bcb4dc8
2 changed files with 6 additions and 2 deletions
|
@ -145,6 +145,11 @@ public final class JingleContent implements FullyQualifiedElement {
|
||||||
xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition);
|
xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition);
|
||||||
xml.attribute(NAME_ATTRIBUTE_NAME, name);
|
xml.attribute(NAME_ATTRIBUTE_NAME, name);
|
||||||
xml.optAttribute(SENDERS_ATTRIBUTE_NAME, senders);
|
xml.optAttribute(SENDERS_ATTRIBUTE_NAME, senders);
|
||||||
|
|
||||||
|
if (description == null && transport == null) {
|
||||||
|
return xml.closeEmptyElement();
|
||||||
|
}
|
||||||
|
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
|
|
||||||
xml.optAppend(description);
|
xml.optAppend(description);
|
||||||
|
|
|
@ -75,8 +75,7 @@ public class JingleContentTest extends SmackTestSuite {
|
||||||
assertEquals(content1.toXML().toString(), builder.build().toXML().toString());
|
assertEquals(content1.toXML().toString(), builder.build().toXML().toString());
|
||||||
|
|
||||||
String xml =
|
String xml =
|
||||||
"<content xmlns='urn:xmpp:jingle:1' creator='initiator' disposition='session' name='A name' senders='both'>" +
|
"<content xmlns='urn:xmpp:jingle:1' creator='initiator' disposition='session' name='A name' senders='both'/>";
|
||||||
"</content>";
|
|
||||||
assertEquals(xml, content1.toXML().toString());
|
assertEquals(xml, content1.toXML().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue