mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 10:17:18 +00:00
Store key alias on decrypt
This commit is contained in:
parent
408f4b5683
commit
65ab16870b
1 changed files with 13 additions and 10 deletions
|
@ -4399,11 +4399,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
DB db = DB.getInstance(context);
|
||||
|
||||
if (EntityMessage.SMIME_SIGNONLY.equals(type)) {
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message == null)
|
||||
return null;
|
||||
EntityMessage message = db.message().getMessage(id);
|
||||
if (message == null)
|
||||
return null;
|
||||
|
||||
if (EntityMessage.SMIME_SIGNONLY.equals(type)) {
|
||||
// Get content/signature
|
||||
File content = null;
|
||||
File signature = null;
|
||||
|
@ -4481,7 +4481,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
// Get encrypted message
|
||||
File input = null;
|
||||
List<EntityAttachment> attachments = db.attachment().getAttachments(id);
|
||||
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
|
||||
for (EntityAttachment attachment : attachments)
|
||||
if (EntityAttachment.SMIME_MESSAGE.equals(attachment.encryption)) {
|
||||
if (!attachment.available)
|
||||
|
@ -4539,16 +4539,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
// Write decrypted body
|
||||
String html = parts.getHtml(context);
|
||||
Helper.writeText(EntityMessage.getFile(context, id), html);
|
||||
Helper.writeText(message.getFile(context), html);
|
||||
|
||||
// Remove existing attachments
|
||||
db.attachment().deleteAttachments(id);
|
||||
db.attachment().deleteAttachments(message.id);
|
||||
|
||||
// Add decrypted attachments
|
||||
List<EntityAttachment> remotes = parts.getAttachments();
|
||||
for (int index = 0; index < remotes.size(); index++) {
|
||||
EntityAttachment remote = remotes.get(index);
|
||||
remote.message = id;
|
||||
remote.message = message.id;
|
||||
remote.sequence = index + 1;
|
||||
remote.id = db.attachment().insertAttachment(remote);
|
||||
try {
|
||||
|
@ -4558,8 +4558,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
}
|
||||
}
|
||||
|
||||
db.message().setMessageEncrypt(id, parts.getEncryption());
|
||||
db.message().setMessageStored(id, new Date().getTime());
|
||||
db.message().setMessageEncrypt(message.id, parts.getEncryption());
|
||||
db.message().setMessageStored(message.id, new Date().getTime());
|
||||
|
||||
if (message.identity != null)
|
||||
db.identity().setIdentitySignKeyAlias(message.identity, alias);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
|
|
Loading…
Reference in a new issue