diff --git a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java index 40828ef79..11651397a 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java @@ -775,7 +775,6 @@ public class XmppConnection implements Runnable { + ": server sent bound and resumed in SASL2 success"); throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER); } - final boolean processNopStreamFeatures; if (resumed != null && streamId != null) { if (this.boundStreamFeatures != null) { this.streamFeatures = this.boundStreamFeatures; @@ -788,6 +787,8 @@ public class XmppConnection implements Runnable { if (bound != null) { clearIqCallbacks(); this.isBound = true; + processNopStreamFeatures(); + this.boundStreamFeatures = this.streamFeatures; final Element streamManagementEnabled = bound.findChild("enabled", Namespace.STREAM_MANAGEMENT); final Element carbonsEnabled = bound.findChild("enabled", Namespace.CARBONS); @@ -807,9 +808,6 @@ public class XmppConnection implements Runnable { features.carbonsEnabled = true; } sendPostBindInitialization(waitForDisco, carbonsEnabled != null); - processNopStreamFeatures = true; - } else { - processNopStreamFeatures = false; } final HashedToken.Mechanism tokenMechanism; if (SaslMechanism.hashedToken(currentSaslMechanism)) { @@ -831,11 +829,6 @@ public class XmppConnection implements Runnable { + ": no response to our hashed token request " + this.hashTokenRequest); } - // a successful resume will not send stream features - if (processNopStreamFeatures) { - processNopStreamFeatures(); - this.boundStreamFeatures = this.streamFeatures; - } } mXmppConnectionService.databaseBackend.updateAccount(account); this.quickStartInProgress = false; @@ -1551,7 +1544,9 @@ public class XmppConnection implements Runnable { .addChild("device") .setContent(String.format("%s %s", Build.MANUFACTURER, Build.MODEL)); } - if (bind != null) { + // do not include bind if 'inlinestreamManagment' is missing and we have a streamId + final boolean mayAttemptBind = streamId == null || inlineStreamManagement; + if (bind != null && mayAttemptBind) { authenticate.addChild(generateBindRequest(bind)); } if (inlineStreamManagement && streamId != null) {