1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-12-26 04:28:00 +01:00

[jingle] Add empty element optimization for <content/>

This commit is contained in:
Florian Schmaus 2021-10-19 11:16:35 +02:00
parent ec456399b5
commit 585bcb4dc8
2 changed files with 6 additions and 2 deletions

View file

@ -145,6 +145,11 @@ public final class JingleContent implements FullyQualifiedElement {
xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition);
xml.attribute(NAME_ATTRIBUTE_NAME, name);
xml.optAttribute(SENDERS_ATTRIBUTE_NAME, senders);
if (description == null && transport == null) {
return xml.closeEmptyElement();
}
xml.rightAngleBracket();
xml.optAppend(description);

View file

@ -75,8 +75,7 @@ public class JingleContentTest extends SmackTestSuite {
assertEquals(content1.toXML().toString(), builder.build().toXML().toString());
String xml =
"<content xmlns='urn:xmpp:jingle:1' creator='initiator' disposition='session' name='A name' senders='both'>" +
"</content>";
"<content xmlns='urn:xmpp:jingle:1' creator='initiator' disposition='session' name='A name' senders='both'/>";
assertEquals(xml, content1.toXML().toString());
}
}