aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-08-31 15:18:40 +0200
committerChristian Schneppe <christian@pix-art.de>2019-08-31 15:19:20 +0200
commit016124b548a81c34a8dd5572fa354eaf00dd058f (patch)
treefa9334a65fbf19b21a490feba1918e1fd540fa8e /src
parent6c3b5defa3fc5bafac3810340b2e868fa8d26d8f (diff)
create empty disco result on error to fire advance stream features event
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java12
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java15
2 files changed, 26 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java b/src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java
index 7b7d0f549..50b118cba 100644
--- a/src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java
+++ b/src/main/java/de/pixart/messenger/entities/ServiceDiscoveryResult.java
@@ -85,6 +85,18 @@ public class ServiceDiscoveryResult {
}
}
+ private ServiceDiscoveryResult() {
+ this.hash = "sha-1";
+ this.features = Collections.emptyList();
+ this.identities = Collections.emptyList();
+ this.ver = null;
+ this.forms = Collections.emptyList();
+ }
+
+ public static ServiceDiscoveryResult empty() {
+ return new ServiceDiscoveryResult();
+ }
+
public ServiceDiscoveryResult(Cursor cursor) throws JSONException {
this(
cursor.getString(cursor.getColumnIndex(HASH)),
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 70ae1bc1b..0cb1ee90b 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -1249,8 +1249,21 @@ public class XmppConnection implements Runnable {
if (advancedStreamFeaturesLoaded && (jid.equals(Jid.of(account.getServer())) || jid.equals(account.getJid().asBareJid()))) {
enableAdvancedStreamFeatures();
}
- } else {
+ } else if (packet.getType() == IqPacket.TYPE.ERROR) {
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not query disco info for " + jid.toString());
+ final boolean serverOrAccount = jid.equals(Jid.of(account.getServer())) || jid.equals(account.getJid().asBareJid());
+ final boolean advancedStreamFeaturesLoaded;
+ if (serverOrAccount) {
+ synchronized (XmppConnection.this.disco) {
+ disco.put(jid, ServiceDiscoveryResult.empty());
+ advancedStreamFeaturesLoaded = disco.containsKey(Jid.of(account.getServer())) && disco.containsKey(account.getJid().asBareJid());
+ }
+ } else {
+ advancedStreamFeaturesLoaded = false;
+ }
+ if (advancedStreamFeaturesLoaded) {
+ enableAdvancedStreamFeatures();
+ }
}
if (packet.getType() != IqPacket.TYPE.TIMEOUT) {
if (mPendingServiceDiscoveries.decrementAndGet() == 0