diff --git a/app/core/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java b/app/core/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java index 41381ede2..563a31057 100644 --- a/app/core/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java +++ b/app/core/src/main/java/com/fsck/k9/message/PgpMessageBuilder.java @@ -168,11 +168,13 @@ public class PgpMessageBuilder extends MessageBuilder { boolean payloadSupportsMimeHeaders = !isPgpInlineMode; if (payloadSupportsMimeHeaders) { - moveDraftStateIntoEncryptedPayload(); if (cryptoStatus.isEncryptSubject()) { moveSubjectIntoEncryptedPayload(); } maybeAddGossipHeadersToBodyPart(); + + // unfortuntately, we can't store the Autocrypt-Draft-State header in the payload + // see https://github.com/autocrypt/autocrypt/pull/376#issuecomment-384293480 } } @@ -219,14 +221,6 @@ public class PgpMessageBuilder extends MessageBuilder { } } - private void moveDraftStateIntoEncryptedPayload() { - String[] autocryptDraftState = currentProcessedMimeMessage.getHeader(AutocryptDraftStateHeader.AUTOCRYPT_DRAFT_STATE_HEADER); - if (autocryptDraftState.length == 1) { - messageContentBodyPart.setHeader(AutocryptDraftStateHeader.AUTOCRYPT_DRAFT_STATE_HEADER, autocryptDraftState[0]); - currentProcessedMimeMessage.removeHeader(AutocryptDraftStateHeader.AUTOCRYPT_DRAFT_STATE_HEADER); - } - } - private void maybeAddGossipHeadersToBodyPart() { if (!cryptoStatus.isEncryptionEnabled()) { return; diff --git a/app/ui/src/main/java/com/fsck/k9/activity/MessageCompose.java b/app/ui/src/main/java/com/fsck/k9/activity/MessageCompose.java index e6c85da3b..95902128b 100644 --- a/app/ui/src/main/java/com/fsck/k9/activity/MessageCompose.java +++ b/app/ui/src/main/java/com/fsck/k9/activity/MessageCompose.java @@ -1306,7 +1306,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, draftId = MessagingController.getInstance(getApplication()).getId(message); subjectView.setText(messageViewInfo.subject); - recipientPresenter.initFromDraftMessage(message, messageViewInfo.rootPart); + recipientPresenter.initFromDraftMessage(message); // Read In-Reply-To header from draft final String[] inReplyTo = message.getHeader("In-Reply-To"); diff --git a/app/ui/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java b/app/ui/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java index ff8e2a360..4a49a017f 100644 --- a/app/ui/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java +++ b/app/ui/src/main/java/com/fsck/k9/activity/compose/RecipientPresenter.java @@ -225,10 +225,10 @@ public class RecipientPresenter { outState.putBoolean(STATE_KEY_CRYPTO_ENABLE_PGP_INLINE, cryptoEnablePgpInline); } - public void initFromDraftMessage(Message message, Part rootPart) { + public void initFromDraftMessage(Message message) { initRecipientsFromDraftMessage(message); - String[] draftStateHeader = rootPart.getHeader(AutocryptDraftStateHeader.AUTOCRYPT_DRAFT_STATE_HEADER); + String[] draftStateHeader = message.getHeader(AutocryptDraftStateHeader.AUTOCRYPT_DRAFT_STATE_HEADER); if (draftStateHeader.length == 1) { initEncryptionStateFromDraftStateHeader(draftStateHeader[0]); } else {