Merge branch 'master' into development

This commit is contained in:
Daniel Gultsch 2015-08-23 17:29:46 +02:00
commit 777dd4b51e

View file

@ -85,7 +85,7 @@ public class XmppConnection implements Runnable {
private XmlReader tagReader; private XmlReader tagReader;
private TagWriter tagWriter; private TagWriter tagWriter;
private final Features features = new Features(this); private final Features features = new Features(this);
private boolean shouldBind = true; private boolean needsBinding = true;
private boolean shouldAuthenticate = true; private boolean shouldAuthenticate = true;
private Element streamFeatures; private Element streamFeatures;
private final HashMap<Jid, Info> disco = new HashMap<>(); private final HashMap<Jid, Info> disco = new HashMap<>();
@ -147,7 +147,7 @@ public class XmppConnection implements Runnable {
lastPingSent = SystemClock.elapsedRealtime(); lastPingSent = SystemClock.elapsedRealtime();
this.attempt++; this.attempt++;
try { try {
shouldAuthenticate = shouldBind = !account.isOptionSet(Account.OPTION_REGISTER); shouldAuthenticate = needsBinding = !account.isOptionSet(Account.OPTION_REGISTER);
tagReader = new XmlReader(wakeLock); tagReader = new XmlReader(wakeLock);
tagWriter = new TagWriter(); tagWriter = new TagWriter();
this.changeStatus(Account.State.CONNECTING); this.changeStatus(Account.State.CONNECTING);
@ -615,19 +615,18 @@ public class XmppConnection implements Runnable {
} else { } else {
throw new IncompatibleServerException(); throw new IncompatibleServerException();
} }
} else if (this.streamFeatures.hasChild("sm", "urn:xmpp:sm:" } else if (this.streamFeatures.hasChild("sm", "urn:xmpp:sm:" + smVersion) && streamId != null) {
+ smVersion)
&& streamId != null) {
if (Config.EXTENDED_SM_LOGGING) { if (Config.EXTENDED_SM_LOGGING) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": resuming after stanza #"+stanzasReceived); Log.d(Config.LOGTAG,account.getJid().toBareJid()+": resuming after stanza #"+stanzasReceived);
} }
final ResumePacket resume = new ResumePacket(this.streamId, stanzasReceived, smVersion); final ResumePacket resume = new ResumePacket(this.streamId, stanzasReceived, smVersion);
this.tagWriter.writeStanzaAsync(resume); this.tagWriter.writeStanzaAsync(resume);
} else if (this.streamFeatures.hasChild("bind") && shouldBind) { } else if (needsBinding) {
sendBindRequest(); if (this.streamFeatures.hasChild("bind")) {
} else { sendBindRequest();
disconnect(true); } else {
changeStatus(Account.State.INCOMPATIBLE_SERVER); throw new IncompatibleServerException();
}
} }
} }
@ -694,6 +693,7 @@ public class XmppConnection implements Runnable {
} catch (final InterruptedException ignored) { } catch (final InterruptedException ignored) {
} }
} }
needsBinding = false;
clearIqCallbacks(); clearIqCallbacks();
final IqPacket iq = new IqPacket(IqPacket.TYPE.SET); final IqPacket iq = new IqPacket(IqPacket.TYPE.SET);
iq.addChild("bind", "urn:ietf:params:xml:ns:xmpp-bind") iq.addChild("bind", "urn:ietf:params:xml:ns:xmpp-bind")