mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-28 11:42:15 -05:00
fail old/invalid iq stanzas on bind
This commit is contained in:
parent
5c0853f302
commit
6694af8fca
@ -34,6 +34,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -709,6 +710,7 @@ public class XmppConnection implements Runnable {
|
||||
} catch (final InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
clearIqCallbacks();
|
||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
|
||||
iq.addChild("bind", "urn:ietf:params:xml:ns:xmpp-bind")
|
||||
.addChild("resource").setContent(account.getResource());
|
||||
@ -739,6 +741,17 @@ public class XmppConnection implements Runnable {
|
||||
});
|
||||
}
|
||||
|
||||
private void clearIqCallbacks() {
|
||||
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": clearing iq iq callbacks");
|
||||
final IqPacket failurePacket = new IqPacket(IqPacket.TYPE.ERROR);
|
||||
Iterator<Entry<String, Pair<IqPacket, OnIqPacketReceived>>> iterator = this.packetCallbacks.entrySet().iterator();
|
||||
while(iterator.hasNext()) {
|
||||
Entry<String, Pair<IqPacket, OnIqPacketReceived>> entry = iterator.next();
|
||||
entry.getValue().second.onIqPacketReceived(account,failurePacket);
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendStartSession() {
|
||||
final IqPacket startSession = new IqPacket(IqPacket.TYPE.SET);
|
||||
startSession.addChild("session","urn:ietf:params:xml:ns:xmpp-session");
|
||||
|
Loading…
Reference in New Issue
Block a user