1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 12:37:58 +01:00

Emit <starttls/> as empty element when possible

This commit is contained in:
Florian Schmaus 2019-10-30 11:59:51 +01:00
parent 2915101843
commit b0277d7e74

View file

@ -1,6 +1,6 @@
/**
*
* Copyright © 2014-2018 Florian Schmaus
* Copyright © 2014-2019 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -52,9 +52,15 @@ public class StartTls implements Nonza {
@Override
public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace);
xml.rightAngleBracket();
xml.condEmptyElement(required, "required");
xml.closeElement(this);
if (required) {
xml.rightAngleBracket();
xml.emptyElement("required");
xml.closeElement(this);
} else {
xml.closeEmptyElement();
}
return xml;
}