From 11a8a747e37cc643d19855271ede5a9ad752f71d Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 11 Mar 2014 16:49:42 +0100 Subject: fixed bug with disabling accounts --- .../siacs/conversations/services/XmppConnectionService.java | 11 +++++++++-- src/eu/siacs/conversations/ui/ManageAccountActivity.java | 1 - 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src/eu/siacs') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index da8129c4..5fa0c850 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -292,7 +292,7 @@ public class XmppConnectionService extends Service { // TODO: ask user to handle it maybe } } else { - Log.d(LOGTAG, packet.toString()); + //Log.d(LOGTAG, packet.toString()); } replaceContactInConversation(contact.getJid(), contact); } @@ -414,9 +414,15 @@ public class XmppConnectionService extends Service { if (!account.isOptionSet(Account.OPTION_DISABLED)) { if (!isConnected) { account.setStatus(Account.STATUS_NO_INTERNET); + if (statusListener!=null) { + statusListener.onStatusChanged(account); + } } else { if (account.getStatus() == Account.STATUS_NO_INTERNET) { account.setStatus(Account.STATUS_OFFLINE); + if (statusListener!=null) { + statusListener.onStatusChanged(account); + } } // TODO 3 remaining cases @@ -440,6 +446,7 @@ public class XmppConnectionService extends Service { new Thread(account.getXmppConnection()).start(); } else { Log.d(LOGTAG,account.getJid()+": status="+account.getStatus()); + // TODO notify user of ssl cert problem or auth problem or what ever } //in any case. reschedule wakup call this.scheduleWakeupCall(PING_MAX_INTERVAL, true); @@ -1053,7 +1060,7 @@ public class XmppConnectionService extends Service { } public void disconnect(final Account account, boolean blocking) { - if (account.getStatus() == Account.STATUS_ONLINE) { + if ((account.getStatus() == Account.STATUS_ONLINE)||(account.getStatus() == Account.STATUS_DISABLED)) { List conversations = getConversations(); for (int i = 0; i < conversations.size(); i++) { Conversation conversation = conversations.get(i); diff --git a/src/eu/siacs/conversations/ui/ManageAccountActivity.java b/src/eu/siacs/conversations/ui/ManageAccountActivity.java index 2af69867..85998131 100644 --- a/src/eu/siacs/conversations/ui/ManageAccountActivity.java +++ b/src/eu/siacs/conversations/ui/ManageAccountActivity.java @@ -48,7 +48,6 @@ public class ManageAccountActivity extends XmppActivity { @Override public void onAccountListChangedListener() { - Log.d("xmppService", "ui on account list changed listener"); accountList.clear(); accountList.addAll(xmppConnectionService.getAccounts()); runOnUiThread(new Runnable() { -- cgit v1.2.3