aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-12-18 22:25:45 +0100
committerChristian Schneppe <christian@pix-art.de>2016-12-18 22:25:45 +0100
commit1bfb4981bf97f19e1d1e8e16c19bab8cf0ae2ac8 (patch)
tree6ec7a802786b5198edf524487b680605db447a8b
parent51673904620b0bb9645d00940e997d3e3821c454 (diff)
don't reconnect accout when system reports no internet connection
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 99167fa94..8b7459b9e 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3048,7 +3048,8 @@ public class XmppConnectionService extends Service {
connection = createConnection(account);
account.setXmppConnection(connection);
}
- if (!account.isOptionSet(Account.OPTION_DISABLED)) {
+ boolean hasInternet = hasInternetConnection();
+ if (!account.isOptionSet(Account.OPTION_DISABLED) && hasInternet) {
if (!force) {
disconnect(account, false);
}
@@ -3059,10 +3060,13 @@ public class XmppConnectionService extends Service {
thread.start();
scheduleWakeUpCall(Config.CONNECT_DISCO_TIMEOUT, account.getUuid().hashCode());
} else {
- disconnect(account, force || account.getTrueStatus().isError());
+ disconnect(account, force || account.getTrueStatus().isError() || !hasInternet);
account.getRoster().clearPresences();
connection.resetEverything();
account.getAxolotlService().resetBrokenness();
+ if (!hasInternet) {
+ account.setStatus(Account.State.NO_INTERNET);
+ }
}
}
}