mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 09:09:38 +02:00
Introduce AbstractXMPPConnection.outgoingStreamXmlEnvironment
This commit is contained in:
parent
002d060584
commit
bd4b91fc26
5 changed files with 20 additions and 12 deletions
|
@ -235,6 +235,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
|
||||
private XmlEnvironment incomingStreamXmlEnvironment;
|
||||
|
||||
protected XmlEnvironment outgoingStreamXmlEnvironment;
|
||||
|
||||
final Map<QName, NonzaCallback> nonzaCallbacks = new HashMap<>();
|
||||
|
||||
protected final Lock connectionLock = new ReentrantLock();
|
||||
|
@ -2017,7 +2019,13 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
from = XmppStringUtils.completeJidFrom(localpart, to);
|
||||
}
|
||||
String id = getStreamId();
|
||||
sendNonza(new StreamOpen(to, from, id, config.getXmlLang(), StreamOpen.StreamContentNamespace.client));
|
||||
|
||||
StreamOpen streamOpen = new StreamOpen(to, from, id, config.getXmlLang(), StreamOpen.StreamContentNamespace.client);
|
||||
sendNonza(streamOpen);
|
||||
|
||||
XmlEnvironment.Builder xmlEnvironmentBuilder = XmlEnvironment.builder();
|
||||
xmlEnvironmentBuilder.with(streamOpen);
|
||||
outgoingStreamXmlEnvironment = xmlEnvironmentBuilder.build();
|
||||
}
|
||||
|
||||
public static final class SmackTlsContext {
|
||||
|
|
|
@ -163,6 +163,12 @@ public class XmlEnvironment {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder with(StreamOpen streamOpen) {
|
||||
withNamespace(streamOpen.getNamespace());
|
||||
withLanguage(streamOpen.getLanguage());
|
||||
return this;
|
||||
}
|
||||
|
||||
public XmlEnvironment build() {
|
||||
return new XmlEnvironment(this);
|
||||
}
|
||||
|
|
|
@ -624,14 +624,10 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
|||
* XmlStringBuilder contents.
|
||||
*
|
||||
* @param writer TODO javadoc me please
|
||||
* @param enclosingNamespace the enclosing XML namespace.
|
||||
* @param enclosingXmlEnvironment the enclosing XML environment.
|
||||
* @throws IOException if an I/O error occured.
|
||||
*/
|
||||
public void write(Writer writer, String enclosingNamespace) throws IOException {
|
||||
XmlEnvironment enclosingXmlEnvironment = XmlEnvironment.builder()
|
||||
.withNamespace(enclosingNamespace)
|
||||
.build();
|
||||
appendXmlTo(writer, enclosingXmlEnvironment);
|
||||
public void write(Writer writer, XmlEnvironment enclosingXmlEnvironment) throws IOException {
|
||||
try {
|
||||
appendXmlTo(csq -> {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue