compose: automatically use pgp/inline if replied-to msg is pgp/inline
This commit is contained in:
parent
4fc1f448db
commit
41d5098c45
2 changed files with 38 additions and 0 deletions
|
@ -35,6 +35,7 @@ import com.fsck.k9.mail.Message.RecipientType;
|
|||
import com.fsck.k9.mail.MessagingException;
|
||||
import com.fsck.k9.mailstore.LocalMessage;
|
||||
import com.fsck.k9.message.PgpMessageBuilder;
|
||||
import com.fsck.k9.message.ComposePgpInlineDecider;
|
||||
import com.fsck.k9.view.RecipientSelectView.Recipient;
|
||||
import org.openintents.openpgp.IOpenPgpService2;
|
||||
import org.openintents.openpgp.util.OpenPgpApi;
|
||||
|
@ -165,6 +166,12 @@ public class RecipientPresenter implements PermissionPingCallback {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
boolean shouldSendAsPgpInline = ComposePgpInlineDecider.getInstance().shouldReplyInline(message);
|
||||
if (shouldSendAsPgpInline) {
|
||||
cryptoEnablePgpInline = true;
|
||||
}
|
||||
|
||||
} catch (MessagingException e) {
|
||||
// can't happen, we know the recipient types exist
|
||||
throw new AssertionError(e);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.fsck.k9.message;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fsck.k9.crypto.MessageDecryptVerifier;
|
||||
import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.Part;
|
||||
|
||||
|
||||
public class ComposePgpInlineDecider {
|
||||
|
||||
|
||||
private static ComposePgpInlineDecider sDecider = new ComposePgpInlineDecider();
|
||||
|
||||
|
||||
public static ComposePgpInlineDecider getInstance() {
|
||||
return sDecider;
|
||||
}
|
||||
|
||||
public boolean shouldReplyInline(Message localMessage) {
|
||||
// TODO more criteria for this? maybe check the User-Agent header?
|
||||
return messageHasPgpInlineParts(localMessage);
|
||||
}
|
||||
|
||||
private boolean messageHasPgpInlineParts(Message localMessage) {
|
||||
List<Part> inlineParts = MessageDecryptVerifier.findPgpInlineParts(localMessage);
|
||||
return !inlineParts.isEmpty();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue