From 4fd8620c6cc1ca88c4496671e6e59c40aba93019 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 4 Feb 2014 21:44:16 +0100 Subject: allow to temporarily disable accounts --- src/de/gultsch/chat/services/XmppConnectionService.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/de/gultsch/chat/services') diff --git a/src/de/gultsch/chat/services/XmppConnectionService.java b/src/de/gultsch/chat/services/XmppConnectionService.java index fbbaca5c..ae1140ee 100644 --- a/src/de/gultsch/chat/services/XmppConnectionService.java +++ b/src/de/gultsch/chat/services/XmppConnectionService.java @@ -95,8 +95,11 @@ public class XmppConnectionService extends Service { public int onStartCommand(Intent intent, int flags, int startId) { for (Account account : accounts) { if (!connections.containsKey(account)) { - - this.connections.put(account, this.createConnection(account)); + if (!account.isOptionSet(Account.OPTION_DISABLED)) { + this.connections.put(account, this.createConnection(account)); + } else { + Log.d(LOGTAG,account.getJid()+": not starting because it's disabled"); + } } } return START_STICKY; @@ -253,7 +256,11 @@ public class XmppConnectionService extends Service { connection.disconnect(); this.connections.remove(account); } - this.connections.put(account, this.createConnection(account)); + if (!account.isOptionSet(Account.OPTION_DISABLED)) { + this.connections.put(account, this.createConnection(account)); + } else { + Log.d(LOGTAG,account.getJid()+": not starting because it's disabled"); + } if (accountChangedListener!=null) accountChangedListener.onAccountListChangedListener(); } -- cgit v1.2.3