From 2e8cc12ada164643624ad79ef7a65d91b65a0318 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 24 Mar 2018 12:06:06 +0100 Subject: [PATCH] do not allow user to quote file --- .../eu/siacs/conversations/ui/ConversationFragment.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 5d60d343c..d67730a14 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -99,6 +99,7 @@ import eu.siacs.conversations.utils.TimeframeUtils; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.chatstate.ChatState; +import eu.siacs.conversations.xmpp.jingle.JingleConnection; import rocks.xmpp.addr.Jid; import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT; @@ -998,11 +999,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke relevantForCorrection = relevantForCorrection.next(); } if (m.getType() != Message.TYPE_STATUS) { + final boolean treatAsFile = m.getType() != Message.TYPE_TEXT && m.getType() != Message.TYPE_PRIVATE - && t == null; + && !(t instanceof TransferablePlaceholder); final boolean encrypted = m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED || m.getEncryption() == Message.ENCRYPTION_PGP; + final boolean receiving = m.getStatus() == Message.STATUS_RECEIVED && (t instanceof JingleConnection || t instanceof HttpDownloadConnection); activity.getMenuInflater().inflate(R.menu.message_context, menu); menu.setHeaderTitle(R.string.message_options); MenuItem copyMessage = menu.findItem(R.id.copy_message); @@ -1028,7 +1031,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke && (m.getConversation().getMucOptions().nonanonymous() || m.getConversation().getMode() == Conversation.MODE_SINGLE)) { correctMessage.setVisible(true); } - if (treatAsFile || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) { + if ((treatAsFile && !receiving) || (m.getType() == Message.TYPE_TEXT && !m.treatAsDownloadable())) { shareWith.setVisible(true); } if (m.getStatus() == Message.STATUS_SEND_FAILED) {