invoke statusChanged callback after syncronization
This commit is contained in:
parent
5a5eb5bdd3
commit
51d1223198
|
@ -218,26 +218,30 @@ public class XmppConnection implements Runnable {
|
||||||
mXmppConnectionService = service;
|
mXmppConnectionService = service;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized void changeStatus(final Account.State nextStatus) {
|
protected void changeStatus(final Account.State nextStatus) {
|
||||||
if (Thread.currentThread().isInterrupted()) {
|
synchronized (this) {
|
||||||
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": not changing status to "+nextStatus+" because thread was interrupted");
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
return;
|
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": not changing status to " + nextStatus + " because thread was interrupted");
|
||||||
}
|
|
||||||
if (account.getStatus() != nextStatus) {
|
|
||||||
if ((nextStatus == Account.State.OFFLINE)
|
|
||||||
&& (account.getStatus() != Account.State.CONNECTING)
|
|
||||||
&& (account.getStatus() != Account.State.ONLINE)
|
|
||||||
&& (account.getStatus() != Account.State.DISABLED)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if (nextStatus == Account.State.ONLINE) {
|
|
||||||
this.attempt = 0;
|
|
||||||
}
|
}
|
||||||
account.setStatus(nextStatus);
|
if (account.getStatus() != nextStatus) {
|
||||||
if (statusListener != null) {
|
if ((nextStatus == Account.State.OFFLINE)
|
||||||
statusListener.onStatusChanged(account);
|
&& (account.getStatus() != Account.State.CONNECTING)
|
||||||
|
&& (account.getStatus() != Account.State.ONLINE)
|
||||||
|
&& (account.getStatus() != Account.State.DISABLED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (nextStatus == Account.State.ONLINE) {
|
||||||
|
this.attempt = 0;
|
||||||
|
}
|
||||||
|
account.setStatus(nextStatus);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (statusListener != null) {
|
||||||
|
statusListener.onStatusChanged(account);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void prepareNewConnection() {
|
public void prepareNewConnection() {
|
||||||
|
|
Loading…
Reference in a new issue