remember bound stream features. fixes #45

This commit is contained in:
Daniel Gultsch 2023-05-02 15:35:27 +02:00
parent d4c323d7e6
commit aa8e0b3c4d
No known key found for this signature in database
GPG key ID: F43D18AD2A0982C2

View file

@ -161,6 +161,7 @@ public class XmppConnection implements Runnable {
private boolean quickStartInProgress = false; private boolean quickStartInProgress = false;
private boolean isBound = false; private boolean isBound = false;
private Element streamFeatures; private Element streamFeatures;
private Element boundStreamFeatures;
private String streamId = null; private String streamId = null;
private int stanzasReceived = 0; private int stanzasReceived = 0;
private int stanzasSent = 0; private int stanzasSent = 0;
@ -776,6 +777,10 @@ public class XmppConnection implements Runnable {
} }
final boolean processNopStreamFeatures; final boolean processNopStreamFeatures;
if (resumed != null && streamId != null) { if (resumed != null && streamId != null) {
if (this.boundStreamFeatures != null) {
this.streamFeatures = this.boundStreamFeatures;
Log.d(Config.LOGTAG, "putting previous stream features back in place: " + XmlHelper.printElementNames(this.boundStreamFeatures));
}
processResumed(resumed); processResumed(resumed);
} else if (failed != null) { } else if (failed != null) {
processFailed(failed, false); // wait for new stream features processFailed(failed, false); // wait for new stream features
@ -829,6 +834,7 @@ public class XmppConnection implements Runnable {
// a successful resume will not send stream features // a successful resume will not send stream features
if (processNopStreamFeatures) { if (processNopStreamFeatures) {
processNopStreamFeatures(); processNopStreamFeatures();
this.boundStreamFeatures = this.streamFeatures;
} }
} }
mXmppConnectionService.databaseBackend.updateAccount(account); mXmppConnectionService.databaseBackend.updateAccount(account);
@ -1388,6 +1394,7 @@ public class XmppConnection implements Runnable {
throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER); throw new StateChangingException(Account.State.INCOMPATIBLE_SERVER);
} }
} else { } else {
Log.d( Log.d(
Config.LOGTAG, Config.LOGTAG,
account.getJid().asBareJid() account.getJid().asBareJid()
@ -2422,6 +2429,7 @@ public class XmppConnection implements Runnable {
private void resetStreamId() { private void resetStreamId() {
this.streamId = null; this.streamId = null;
this.boundStreamFeatures = null;
} }
private List<Entry<Jid, ServiceDiscoveryResult>> findDiscoItemsByFeature(final String feature) { private List<Entry<Jid, ServiceDiscoveryResult>> findDiscoItemsByFeature(final String feature) {