diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-03-06 12:16:29 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-03-06 12:16:29 +0100 |
commit | 86fff5839aaf618367f3c50a2ad4274c16802aeb (patch) | |
tree | 15616a2910927fdaffa08ebb6752e8d1f1aa0361 /src/main/java/eu/siacs | |
parent | 8339ebf3dc0c0f27e6fc1bfdc1af574ec6cd82c9 (diff) |
warn in conversations when account is disabled
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 15 |
1 files changed, 14 insertions, 1 deletions
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); |