mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Configuration flag for disabling session request on login
Although this was mandatory on RFC 3921, RFC 6120/6121 don't even mention this part of the protocol. Signed-off-by: Daniele Ricci <daniele.athome@gmail.com>
This commit is contained in:
parent
364cbd81da
commit
596008e90a
2 changed files with 25 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smack;
|
||||
|
||||
import org.jivesoftware.smack.packet.Session;
|
||||
import org.jivesoftware.smack.proxy.ProxyInfo;
|
||||
import org.jivesoftware.smack.util.DNSUtil;
|
||||
import org.jivesoftware.smack.util.dns.HostAddress;
|
||||
|
@ -77,6 +78,7 @@ public class ConnectionConfiguration implements Cloneable {
|
|||
private String resource;
|
||||
private boolean sendPresence = true;
|
||||
private boolean rosterLoadedAtLogin = true;
|
||||
private boolean legacySessionDisabled = false;
|
||||
private SecurityMode securityMode = SecurityMode.enabled;
|
||||
|
||||
/**
|
||||
|
@ -449,6 +451,28 @@ public class ConnectionConfiguration implements Cloneable {
|
|||
this.rosterLoadedAtLogin = rosterLoadedAtLogin;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public boolean isLegacySessionDisabled() {
|
||||
return legacySessionDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param legacySessionDisabled if a session has to be requested when logging in.
|
||||
*/
|
||||
public void setLegacySessionDisabled(boolean legacySessionDisabled) {
|
||||
this.legacySessionDisabled = legacySessionDisabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a CallbackHandler to obtain information, such as the password or
|
||||
* principal information during the SASL authentication. A CallbackHandler
|
||||
|
|
|
@ -433,7 +433,7 @@ public class SASLAuthentication {
|
|||
Bind response = (Bind) connection.createPacketCollectorAndSend(bindResource).nextResultOrThrow();
|
||||
String userJID = response.getJid();
|
||||
|
||||
if (sessionSupported) {
|
||||
if (sessionSupported && !connection.getConfiguration().isLegacySessionDisabled()) {
|
||||
Session session = new Session();
|
||||
connection.createPacketCollectorAndSend(session).nextResultOrThrow();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue