Report message not encrypted

pull/146/head
M66B 6 years ago
parent ba49a8a411
commit b2bbc756bc

@ -948,9 +948,12 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
// Find encrypted data // Find encrypted data
boolean found = false;
List<EntityAttachment> attachments = db.attachment().getAttachments(id); List<EntityAttachment> attachments = db.attachment().getAttachments(id);
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (attachment.available && "encrypted.asc".equals(attachment.name)) { if (attachment.available && "encrypted.asc".equals(attachment.name)) {
found = true;
// Serialize encrypted data // Serialize encrypted data
FileInputStream encrypted = new FileInputStream(EntityAttachment.getFile(context, attachment.id)); FileInputStream encrypted = new FileInputStream(EntityAttachment.getFile(context, attachment.id));
ByteArrayOutputStream decrypted = new ByteArrayOutputStream(); ByteArrayOutputStream decrypted = new ByteArrayOutputStream();
@ -1008,6 +1011,9 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
break; break;
} }
if (!found)
throw new IllegalArgumentException(getString(R.string.title_not_encrypted));
return null; return null;
} }

@ -239,6 +239,7 @@
<string name="title_encrypt">Encrypt</string> <string name="title_encrypt">Encrypt</string>
<string name="title_decrypt">Decrypt</string> <string name="title_decrypt">Decrypt</string>
<string name="title_no_openpgp">OpenKeychain not found</string> <string name="title_no_openpgp">OpenKeychain not found</string>
<string name="title_not_encrypted">Message is not encrypted</string>
<string name="title_search">Search</string> <string name="title_search">Search</string>
<string name="title_search_hint">Search on server</string> <string name="title_search_hint">Search on server</string>

Loading…
Cancel
Save