From 86fff5839aaf618367f3c50a2ad4274c16802aeb Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 6 Mar 2016 12:16:29 +0100 Subject: warn in conversations when account is disabled --- .../eu/siacs/conversations/ui/ConversationFragment.java | 15 ++++++++++++++- src/main/res/values/strings.xml | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 9ef950c4..1665090c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -777,6 +777,17 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } } + private OnClickListener mEnableAccountListener = new OnClickListener() { + @Override + public void onClick(View v) { + final Account account = conversation == null ? null : conversation.getAccount(); + if (account != null) { + account.setOption(Account.OPTION_DISABLED, false); + activity.xmppConnectionService.updateAccount(account); + } + } + }; + private OnClickListener mUnblockClickListener = new OnClickListener() { @Override public void onClick(final View v) { @@ -822,7 +833,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa final Account account = conversation.getAccount(); final Contact contact = conversation.getContact(); final int mode = conversation.getMode(); - if (conversation.isBlocked()) { + if (account.getStatus() == Account.State.DISABLED) { + showSnackbar(R.string.this_account_is_disabled, R.string.enable, this.mEnableAccountListener); + } else if (conversation.isBlocked()) { showSnackbar(R.string.contact_blocked, R.string.unblock, this.mUnblockClickListener); } else if (!contact.showInRoster() && contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) { showSnackbar(R.string.contact_added_you, R.string.add_back, this.mAddBackClickListener); diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 9657ea24..f0f2cc3e 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -604,4 +604,5 @@ Send corrected message You already trust this contact. By selecting \'done\' you are just confirming that %s is part of this conference. Select image and crop + You have disabled this account -- cgit v1.2.3