bug fixes

This commit is contained in:
Daniel Gultsch 2014-03-06 04:13:21 +01:00
parent ac93f7419a
commit 0168f185eb

View file

@ -388,28 +388,22 @@ public class XmppConnectionService extends Service {
for (Account account : accounts) { for (Account account : accounts) {
if (!isConnected) { if (!isConnected) {
account.setStatus(Account.STATUS_NO_INTERNET); account.setStatus(Account.STATUS_NO_INTERNET);
Log.d(LOGTAG,"set no internet status to account");
break;
} else { } else {
if (account.getStatus() == Account.STATUS_NO_INTERNET) { if (account.getStatus() == Account.STATUS_NO_INTERNET) {
account.setStatus(Account.STATUS_OFFLINE); account.setStatus(Account.STATUS_OFFLINE);
} }
} }
if (account.getXmppConnection() == null) { if (accountChangedListener!=null) {
if ((!account.isOptionSet(Account.OPTION_DISABLED))&&(isConnected)) { accountChangedListener.onAccountListChangedListener();
account.setXmppConnection(this.createConnection(account));
Thread thread = new Thread(account.getXmppConnection());
thread.start();
} }
} else {
if ((!account.isOptionSet(Account.OPTION_DISABLED))&&(isConnected)) { if ((!account.isOptionSet(Account.OPTION_DISABLED))&&(isConnected)) {
if (account.getXmppConnection() == null) {
account.setXmppConnection(this.createConnection(account));
}
if (account.getStatus()==Account.STATUS_OFFLINE) { if (account.getStatus()==Account.STATUS_OFFLINE) {
Thread thread = new Thread(account.getXmppConnection()); Thread thread = new Thread(account.getXmppConnection());
thread.start(); thread.start();
} }
} else {
disconnect(account);
}
} }
} }
return START_STICKY; return START_STICKY;