diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-08-01 08:53:04 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-08-01 08:53:04 +0200 |
commit | 7b6d679ea2c8557d732fdd79021ef3d2b7d84304 (patch) | |
tree | e160a0cb18ae1f5b8646614552f3e6470d639570 /src/main | |
parent | 06baecdae2a3af8b6c28266a0dd56db2227068da (diff) |
deduplicate disco items before disco#info
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/de/pixart/messenger/xmpp/XmppConnection.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java index 8180c4eb7..fc40b410e 100644 --- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java +++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java @@ -31,6 +31,7 @@ import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; import java.util.List; @@ -1120,6 +1121,7 @@ public class XmppConnection implements Runnable { public void sendDiscoTimeout() { if (mWaitForDisco.compareAndSet(true, false)) { + Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": finalizing bind after disco timeout"); finalizeBind(); } } @@ -1259,15 +1261,19 @@ public class XmppConnection implements Runnable { @Override public void onIqPacketReceived(final Account account, final IqPacket packet) { if (packet.getType() == IqPacket.TYPE.RESULT) { + HashSet<Jid> items = new HashSet<Jid>(); final List<Element> elements = packet.query().getChildren(); for (final Element element : elements) { if (element.getName().equals("item")) { final Jid jid = element.getAttributeAsJid("jid"); if (jid != null && !jid.equals(account.getServer())) { - sendServiceDiscoveryInfo(jid); + items.add(jid); } } } + for (Jid jid : items) { + sendServiceDiscoveryInfo(jid); + } } else { Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": could not query disco items of " + server); } |