aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-03-06 12:16:29 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-03-06 12:16:29 +0100
commit86fff5839aaf618367f3c50a2ad4274c16802aeb (patch)
tree15616a2910927fdaffa08ebb6752e8d1f1aa0361 /src
parent8339ebf3dc0c0f27e6fc1bfdc1af574ec6cd82c9 (diff)
warn in conversations when account is disabled
Diffstat (limited to '')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ConversationFragment.java15
-rw-r--r--src/main/res/values/strings.xml1
2 files changed, 15 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);
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 @@
<string name="send_corrected_message">Send corrected message</string>
<string name="no_keys_just_confirm">You already trust this contact. By selecting \'done\' you are just confirming that %s is part of this conference.</string>
<string name="select_image_and_crop">Select image and crop</string>
+ <string name="this_account_is_disabled">You have disabled this account</string>
</resources>