handle case when server loses support for quick start
This commit is contained in:
parent
717aeddb82
commit
3d56d01826
|
@ -898,6 +898,10 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
sendPacket(packet);
|
sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
changeStatusToOnline();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeStatusToOnline() {
|
||||||
Log.d(
|
Log.d(
|
||||||
Config.LOGTAG,
|
Config.LOGTAG,
|
||||||
account.getJid().asBareJid() + ": online with resource " + account.getResource());
|
account.getJid().asBareJid() + ": online with resource " + account.getResource());
|
||||||
|
@ -1184,12 +1188,20 @@ public class XmppConnection implements Runnable {
|
||||||
features.encryptionEnabled || Config.ALLOW_NON_TLS_CONNECTIONS || account.isOnion();
|
features.encryptionEnabled || Config.ALLOW_NON_TLS_CONNECTIONS || account.isOnion();
|
||||||
final boolean needsBinding = !isBound && !account.isOptionSet(Account.OPTION_REGISTER);
|
final boolean needsBinding = !isBound && !account.isOptionSet(Account.OPTION_REGISTER);
|
||||||
if (this.quickStartInProgress) {
|
if (this.quickStartInProgress) {
|
||||||
Log.d(
|
if (this.streamFeatures.hasChild("authentication", Namespace.SASL_2)) {
|
||||||
Config.LOGTAG,
|
Log.d(
|
||||||
account.getJid().asBareJid()
|
Config.LOGTAG,
|
||||||
+ ": quick start in progress. ignoring features: "
|
account.getJid().asBareJid()
|
||||||
+ XmlHelper.printElementNames(this.streamFeatures));
|
+ ": quick start in progress. ignoring features: "
|
||||||
} else if (this.streamFeatures.hasChild("starttls", Namespace.TLS)
|
+ XmlHelper.printElementNames(this.streamFeatures));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Log.d(Config.LOGTAG,account.getJid().asBareJid()+": server lost support for SASL 2. quick start not possible");
|
||||||
|
this.account.setOption(Account.OPTION_QUICKSTART_AVAILABLE, false);
|
||||||
|
mXmppConnectionService.updateAccount(account);
|
||||||
|
throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER);
|
||||||
|
}
|
||||||
|
if (this.streamFeatures.hasChild("starttls", Namespace.TLS)
|
||||||
&& !features.encryptionEnabled) {
|
&& !features.encryptionEnabled) {
|
||||||
sendStartTLS();
|
sendStartTLS();
|
||||||
} else if (this.streamFeatures.hasChild("register", Namespace.REGISTER_STREAM_FEATURE)
|
} else if (this.streamFeatures.hasChild("register", Namespace.REGISTER_STREAM_FEATURE)
|
||||||
|
@ -1878,13 +1890,10 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finalizeBind() {
|
private void finalizeBind() {
|
||||||
Log.d(
|
|
||||||
Config.LOGTAG,
|
|
||||||
account.getJid().asBareJid() + ": online with resource " + account.getResource());
|
|
||||||
if (bindListener != null) {
|
if (bindListener != null) {
|
||||||
bindListener.onBind(account);
|
bindListener.onBind(account);
|
||||||
}
|
}
|
||||||
changeStatus(Account.State.ONLINE);
|
changeStatusToOnline();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableAdvancedStreamFeatures() {
|
private void enableAdvancedStreamFeatures() {
|
||||||
|
@ -2012,6 +2021,7 @@ public class XmppConnection implements Runnable {
|
||||||
private boolean establishStream(final boolean secureConnection) throws IOException {
|
private boolean establishStream(final boolean secureConnection) throws IOException {
|
||||||
final SaslMechanism saslMechanism = account.getPinnedMechanism();
|
final SaslMechanism saslMechanism = account.getPinnedMechanism();
|
||||||
if (secureConnection
|
if (secureConnection
|
||||||
|
&& Config.SASL_2_ENABLED
|
||||||
&& saslMechanism != null
|
&& saslMechanism != null
|
||||||
&& account.isOptionSet(Account.OPTION_QUICKSTART_AVAILABLE)) {
|
&& account.isOptionSet(Account.OPTION_QUICKSTART_AVAILABLE)) {
|
||||||
this.saslMechanism = saslMechanism;
|
this.saslMechanism = saslMechanism;
|
||||||
|
|
Loading…
Reference in a new issue