do not allow user to quote file

This commit is contained in:
Daniel Gultsch 2018-03-24 12:06:06 +01:00
parent acdf822415
commit 2e8cc12ada
1 changed files with 5 additions and 2 deletions

View File

@ -99,6 +99,7 @@ import eu.siacs.conversations.utils.TimeframeUtils;
import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.utils.UIHelper;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import eu.siacs.conversations.xmpp.chatstate.ChatState; import eu.siacs.conversations.xmpp.chatstate.ChatState;
import eu.siacs.conversations.xmpp.jingle.JingleConnection;
import rocks.xmpp.addr.Jid; import rocks.xmpp.addr.Jid;
import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT; import static eu.siacs.conversations.ui.XmppActivity.EXTRA_ACCOUNT;
@ -998,11 +999,13 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
relevantForCorrection = relevantForCorrection.next(); relevantForCorrection = relevantForCorrection.next();
} }
if (m.getType() != Message.TYPE_STATUS) { if (m.getType() != Message.TYPE_STATUS) {
final boolean treatAsFile = m.getType() != Message.TYPE_TEXT final boolean treatAsFile = m.getType() != Message.TYPE_TEXT
&& m.getType() != Message.TYPE_PRIVATE && m.getType() != Message.TYPE_PRIVATE
&& t == null; && !(t instanceof TransferablePlaceholder);
final boolean encrypted = m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED final boolean encrypted = m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED
|| m.getEncryption() == Message.ENCRYPTION_PGP; || 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); activity.getMenuInflater().inflate(R.menu.message_context, menu);
menu.setHeaderTitle(R.string.message_options); menu.setHeaderTitle(R.string.message_options);
MenuItem copyMessage = menu.findItem(R.id.copy_message); 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)) { && (m.getConversation().getMucOptions().nonanonymous() || m.getConversation().getMode() == Conversation.MODE_SINGLE)) {
correctMessage.setVisible(true); 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); shareWith.setVisible(true);
} }
if (m.getStatus() == Message.STATUS_SEND_FAILED) { if (m.getStatus() == Message.STATUS_SEND_FAILED) {