From 4171e2b90ec6e81b28d85caf19dc26bb6c9772cf Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 20 Mar 2017 12:16:25 +0100 Subject: [PATCH] do not show block stranger snackbar when blocking command is unavailable. fixes #2393 --- .../java/eu/siacs/conversations/ui/ConversationFragment.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index c15217458..6a2af2095 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1001,6 +1001,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa private void updateSnackBar(final Conversation conversation) { final Account account = conversation.getAccount(); + final XmppConnection connection = account.getXmppConnection(); final int mode = conversation.getMode(); final Contact contact = mode == Conversation.MODE_SINGLE ? conversation.getContact() : null; if (account.getStatus() == Account.State.DISABLED) { @@ -1055,7 +1056,9 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa && (conversation.getOtrSession().getSessionStatus() == SessionStatus.ENCRYPTED) && (!conversation.isOtrFingerprintVerified())) { showSnackbar(R.string.unknown_otr_fingerprint, R.string.verify, clickToVerify); - } else if (conversation.countMessages() != 0 + } else if (connection != null + && connection.getFeatures().blocking() + && conversation.countMessages() != 0 && !conversation.isBlocked() && conversation.isWithStranger()) { showSnackbar(R.string.received_message_from_stranger,R.string.block, mBlockClickListener);