mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 05:52:06 +01:00
Merge pull request #423 from adiaholic/streamFactory
Use AbstractStreamOpen instead of StreamOpen to open stream
This commit is contained in:
commit
53d66261af
4 changed files with 10 additions and 9 deletions
|
@ -70,6 +70,7 @@ import org.jivesoftware.smack.filter.StanzaFilter;
|
|||
import org.jivesoftware.smack.filter.StanzaIdFilter;
|
||||
import org.jivesoftware.smack.internal.SmackTlsContext;
|
||||
import org.jivesoftware.smack.iqrequest.IQRequestHandler;
|
||||
import org.jivesoftware.smack.packet.AbstractStreamOpen;
|
||||
import org.jivesoftware.smack.packet.Bind;
|
||||
import org.jivesoftware.smack.packet.ErrorIQ;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
|
@ -2246,7 +2247,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
updateOutgoingStreamXmlEnvironmentOnStreamOpen(streamOpen);
|
||||
}
|
||||
|
||||
protected void updateOutgoingStreamXmlEnvironmentOnStreamOpen(StreamOpen streamOpen) {
|
||||
protected void updateOutgoingStreamXmlEnvironmentOnStreamOpen(AbstractStreamOpen streamOpen) {
|
||||
XmlEnvironment.Builder xmlEnvironmentBuilder = XmlEnvironment.builder();
|
||||
xmlEnvironmentBuilder.with(streamOpen);
|
||||
outgoingStreamXmlEnvironment = xmlEnvironmentBuilder.build();
|
||||
|
|
|
@ -61,6 +61,7 @@ import org.jivesoftware.smack.fsm.StateTransitionResult;
|
|||
import org.jivesoftware.smack.fsm.StateTransitionResult.AttemptResult;
|
||||
import org.jivesoftware.smack.internal.AbstractStats;
|
||||
import org.jivesoftware.smack.internal.SmackTlsContext;
|
||||
import org.jivesoftware.smack.packet.AbstractStreamOpen;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Nonza;
|
||||
|
@ -68,7 +69,6 @@ import org.jivesoftware.smack.packet.Presence;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.StreamClose;
|
||||
import org.jivesoftware.smack.packet.StreamError;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
||||
import org.jivesoftware.smack.packet.XmlEnvironment;
|
||||
import org.jivesoftware.smack.parsing.SmackParsingException;
|
||||
|
@ -572,13 +572,13 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne
|
|||
if (localpart != null) {
|
||||
from = XmppStringUtils.completeJidFrom(localpart, xmppServiceDomain);
|
||||
}
|
||||
StreamOpen streamOpen = streamOpenAndCloseFactory.createStreamOpen(xmppServiceDomain, from, getStreamId(), getConfiguration().getXmlLang());
|
||||
AbstractStreamOpen streamOpen = streamOpenAndCloseFactory.createStreamOpen(xmppServiceDomain, from, getStreamId(), getConfiguration().getXmlLang());
|
||||
sendStreamOpen(streamOpen);
|
||||
|
||||
waitForFeaturesReceived(waitFor);
|
||||
}
|
||||
|
||||
private void sendStreamOpen(StreamOpen streamOpen) throws NotConnectedException, InterruptedException {
|
||||
private void sendStreamOpen(AbstractStreamOpen streamOpen) throws NotConnectedException, InterruptedException {
|
||||
sendNonza(streamOpen);
|
||||
updateOutgoingStreamXmlEnvironmentOnStreamOpen(streamOpen);
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
*/
|
||||
package org.jivesoftware.smack.c2s;
|
||||
|
||||
import org.jivesoftware.smack.packet.StreamClose;
|
||||
import org.jivesoftware.smack.packet.StreamOpen;
|
||||
import org.jivesoftware.smack.packet.AbstractStreamClose;
|
||||
import org.jivesoftware.smack.packet.AbstractStreamOpen;
|
||||
|
||||
public interface StreamOpenAndCloseFactory {
|
||||
StreamOpen createStreamOpen(CharSequence to, CharSequence from, String id, String lang);
|
||||
AbstractStreamOpen createStreamOpen(CharSequence to, CharSequence from, String id, String lang);
|
||||
|
||||
StreamClose createStreamClose();
|
||||
AbstractStreamClose createStreamClose();
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ public class XmlEnvironment {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Builder with(StreamOpen streamOpen) {
|
||||
public Builder with(AbstractStreamOpen streamOpen) {
|
||||
withNamespace(streamOpen.getNamespace());
|
||||
withLanguage(streamOpen.getLanguage());
|
||||
return this;
|
||||
|
|
Loading…
Reference in a new issue