Allow to set the reply policy in a smart manner

Depending on whether the original email was encrypted, one can set
different reply policies.
This commit is contained in:
maxime
2017-08-26 19:47:36 -07:00
parent ceb7f0a8b4
commit d343f7f538

View File

@ -146,7 +146,7 @@ Also see `mu4e-context-policy'."
:group 'mu4e-compose)) :group 'mu4e-compose))
(defcustom mu4e-compose-crypto-reply-policy 'sign-and-encrypt (defcustom mu4e-compose-crypto-reply-encrypted-policy 'sign-and-encrypt
"Policy for signing/encrypting replies to encrypted messages. "Policy for signing/encrypting replies to encrypted messages.
We have the following choices: We have the following choices:
@ -162,6 +162,22 @@ We have the following choices:
:safe 'symbolp :safe 'symbolp
:group 'mu4e-compose)) :group 'mu4e-compose))
(defcustom mu4e-compose-crypto-reply-plain-encrypted-policy 'sign "Policy for signing/encrypting replies to encrypted messages.
We have the following choices:
- `sign': sign the reply
- `sign-and-encrypt': sign and encrypt the reply
- `encrypt': encrypt the reply, but don't sign it.
- anything else: do nothing."
:type '(choice
(const :tag "Sign the reply" sign)
(const :tag "Sign and encrypt the reply" sign-and-encrypt)
(const :tag "Encrypt the reply" encrypt)
(const :tag "Don't do anything" nil)
:safe 'symbolp
:group 'mu4e-compose))
(defcustom mu4e-compose-format-flowed nil (defcustom mu4e-compose-format-flowed nil
"Whether to compose messages to be sent as format=flowed (or "Whether to compose messages to be sent as format=flowed (or
with long lines if `use-hard-newlines' is set to nil). The with long lines if `use-hard-newlines' is set to nil). The
@ -525,13 +541,23 @@ buffers; lets remap its faces so it uses the ones for mu4e."
(defun mu4e~compose-crypto-reply (parent compose-type) (defun mu4e~compose-crypto-reply (parent compose-type)
"When composing a reply to an encrypted message, we can "When composing a reply to an encrypted message, we can
automatically encrypt that reply." automatically encrypt that reply. When the message is unencrypted,
(when (and (eq compose-type 'reply) we can decide what we want to do."
(message "%S %S" parent compose-type)
(if (and (eq compose-type 'reply)
(and parent (member 'encrypted (mu4e-message-field parent :flags)))) (and parent (member 'encrypted (mu4e-message-field parent :flags))))
(case mu4e-compose-crypto-reply-policy (case mu4e-compose-crypto-reply-encrypted-policy
(sign (mml-secure-message-sign)) (sign (mml-secure-message-sign))
(encrypt (mml-secure-message-encrypt)) (encrypt (mml-secure-message-encrypt))
(sign-and-encrypt (mml-secure-message-sign-encrypt))))) (sign-and-encrypt (mml-secure-message-sign-encrypt))
(message "Do nothing"))
(case mu4e-compose-crypto-reply-plain-policy
(sign (mml-secure-message-sign))
(encrypt (mml-secure-message-encrypt))
(sign-and-encrypt (mml-secure-message-sign-encrypt))
(message "Do nothing")))
)
(defun* mu4e~compose-handler (compose-type &optional original-msg includes) (defun* mu4e~compose-handler (compose-type &optional original-msg includes)
"Create a new draft message, or open an existing one. "Create a new draft message, or open an existing one.