aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-05-31 21:17:19 +0200
committerChristian Schneppe <christian@pix-art.de>2017-05-31 21:17:19 +0200
commit6ae1c187057b6148722c0af5b2e4525d1f15b2ff (patch)
tree1fbad68a62b75ac281da86bd1df22751ee5ec7db /src/main/java/de
parent83f25dc67e76fedf2729bd09c09406c0597792f6 (diff)
invoke statusChanged callback after syncronization
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/xmpp/XmppConnection.java36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
index 7a4aa15fd..fc157cf4d 100644
--- a/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
+++ b/src/main/java/de/pixart/messenger/xmpp/XmppConnection.java
@@ -228,26 +228,30 @@ public class XmppConnection implements Runnable {
mXmppConnectionService = service;
}
- protected synchronized void changeStatus(final Account.State nextStatus) {
- if (Thread.currentThread().isInterrupted()) {
- Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": not changing status to " + nextStatus + " because thread was interrupted");
- return;
- }
- if (account.getStatus() != nextStatus) {
- if ((nextStatus == Account.State.OFFLINE)
- && (account.getStatus() != Account.State.CONNECTING)
- && (account.getStatus() != Account.State.ONLINE)
- && (account.getStatus() != Account.State.DISABLED)) {
+ protected void changeStatus(final Account.State nextStatus) {
+ synchronized (this) {
+ if (Thread.currentThread().isInterrupted()) {
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": not changing status to " + nextStatus + " because thread was interrupted");
return;
}
- if (nextStatus == Account.State.ONLINE) {
- this.attempt = 0;
- }
- account.setStatus(nextStatus);
- if (statusListener != null) {
- statusListener.onStatusChanged(account);
+ 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;
+ }
+ if (nextStatus == Account.State.ONLINE) {
+ this.attempt = 0;
+ }
+ account.setStatus(nextStatus);
+ } else {
+ return;
}
}
+ if (statusListener != null) {
+ statusListener.onStatusChanged(account);
+ }
}
public void prepareNewConnection() {