Remove setting to disable legacy session establishment

This commit is contained in:
Florian Schmaus 2018-04-02 13:27:01 +02:00
parent ad87243060
commit b443958bee
2 changed files with 1 additions and 43 deletions

View File

@ -550,10 +550,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
Session.Feature sessionFeature = getFeature(Session.ELEMENT, Session.NAMESPACE); Session.Feature sessionFeature = getFeature(Session.ELEMENT, Session.NAMESPACE);
// Only bind the session if it's announced as stream feature by the server, is not optional and not disabled // Only bind the session if it's announced as stream feature by the server, is not optional and not disabled
// For more information see http://tools.ietf.org/html/draft-cridland-xmpp-session-01 // For more information see http://tools.ietf.org/html/draft-cridland-xmpp-session-01
// TODO remove this suppression once "disable legacy session" code has been removed from Smack if (sessionFeature != null && !sessionFeature.isOptional()) {
@SuppressWarnings("deprecation")
boolean legacySessionDisabled = getConfiguration().isLegacySessionDisabled();
if (sessionFeature != null && !sessionFeature.isOptional() && !legacySessionDisabled) {
Session session = new Session(); Session session = new Session();
packetCollector = createStanzaCollectorAndSend(new StanzaIdFilter(session), session); packetCollector = createStanzaCollectorAndSend(new StanzaIdFilter(session), session);
packetCollector.nextResultOrThrow(); packetCollector.nextResultOrThrow();

View File

@ -32,7 +32,6 @@ import javax.net.ssl.X509TrustManager;
import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.CallbackHandler;
import org.jivesoftware.smack.debugger.SmackDebuggerFactory; import org.jivesoftware.smack.debugger.SmackDebuggerFactory;
import org.jivesoftware.smack.packet.Session;
import org.jivesoftware.smack.proxy.ProxyInfo; import org.jivesoftware.smack.proxy.ProxyInfo;
import org.jivesoftware.smack.sasl.SASLMechanism; import org.jivesoftware.smack.sasl.SASLMechanism;
import org.jivesoftware.smack.sasl.core.SASLAnonymous; import org.jivesoftware.smack.sasl.core.SASLAnonymous;
@ -100,7 +99,6 @@ public abstract class ConnectionConfiguration {
*/ */
private final boolean sendPresence; private final boolean sendPresence;
private final boolean legacySessionDisabled;
private final SecurityMode securityMode; private final SecurityMode securityMode;
private final DnssecMode dnssecMode; private final DnssecMode dnssecMode;
@ -159,7 +157,6 @@ public abstract class ConnectionConfiguration {
enabledSSLCiphers = builder.enabledSSLCiphers; enabledSSLCiphers = builder.enabledSSLCiphers;
hostnameVerifier = builder.hostnameVerifier; hostnameVerifier = builder.hostnameVerifier;
sendPresence = builder.sendPresence; sendPresence = builder.sendPresence;
legacySessionDisabled = builder.legacySessionDisabled;
debuggerFactory = builder.debuggerFactory; debuggerFactory = builder.debuggerFactory;
allowNullOrEmptyUsername = builder.allowEmptyOrNullUsername; allowNullOrEmptyUsername = builder.allowEmptyOrNullUsername;
enabledSaslMechanisms = builder.enabledSaslMechanisms; enabledSaslMechanisms = builder.enabledSaslMechanisms;
@ -291,20 +288,6 @@ public abstract class ConnectionConfiguration {
return debuggerFactory; return debuggerFactory;
} }
/**
* Returns true if a {@link Session} will be requested on login if the server
* supports it. Although this was mandatory on RFC 3921, RFC 6120/6121 don't
* even mention this part of the protocol.
*
* @return true if a session has to be requested when logging in.
* @deprecated Smack processes the 'optional' element of the session stream feature.
* @see Builder#setLegacySessionDisabled(boolean)
*/
@Deprecated
public boolean isLegacySessionDisabled() {
return legacySessionDisabled;
}
/** /**
* Returns a CallbackHandler to obtain information, such as the password or * Returns a CallbackHandler to obtain information, such as the password or
* principal information during the SASL authentication. A CallbackHandler * principal information during the SASL authentication. A CallbackHandler
@ -517,7 +500,6 @@ public abstract class ConnectionConfiguration {
private String password; private String password;
private Resourcepart resource; private Resourcepart resource;
private boolean sendPresence = true; private boolean sendPresence = true;
private boolean legacySessionDisabled = false;
private ProxyInfo proxy; private ProxyInfo proxy;
private CallbackHandler callbackHandler; private CallbackHandler callbackHandler;
private SmackDebuggerFactory debuggerFactory; private SmackDebuggerFactory debuggerFactory;
@ -777,27 +759,6 @@ public abstract class ConnectionConfiguration {
return getThis(); return getThis();
} }
/**
* Sets if a {@link Session} will be requested on login if the server supports
* it. Although this was mandatory on RFC 3921, RFC 6120/6121 don't even
* mention this part of the protocol.
* <p>
* Deprecation notice: This setting is no longer required in most cases because Smack processes the 'optional'
* element eventually found in the session stream feature. See also <a
* href="https://tools.ietf.org/html/draft-cridland-xmpp-session-01">Here Lies Extensible Messaging and Presence
* Protocol (XMPP) Session Establishment</a>
* </p>
*
* @param legacySessionDisabled if a session has to be requested when logging in.
* @return a reference to this builder.
* @deprecated Smack processes the 'optional' element of the session stream feature.
*/
@Deprecated
public B setLegacySessionDisabled(boolean legacySessionDisabled) {
this.legacySessionDisabled = legacySessionDisabled;
return getThis();
}
/** /**
* Sets if an initial available presence will be sent to the server. By default * Sets if an initial available presence will be sent to the server. By default
* an available presence will be sent to the server indicating that this presence * an available presence will be sent to the server indicating that this presence