Save draft state in message header for now
Apparently, storing the draft state header in the encrypted payload introduces difficulties in Enigmail due to restrictions from Thunderbird. To stay compatible, this commit keeps the draft state in the outer header for now, but we should move it into the encrypted payload if the issue with Thunderbird is somehow resolved. see: https://github.com/autocrypt/autocrypt/pull/376#issuecomment-384293480
This commit is contained in:
parent
39a732d0c3
commit
d0e588fb9f
3 changed files with 6 additions and 12 deletions
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue