mirror of https://github.com/djcb/mu.git
* mu4e/crypto: support mu4e-decryption-policy
This commit is contained in:
parent
b8639f63b4
commit
53cf08baf8
|
@ -1107,12 +1107,18 @@ current window. "
|
||||||
(mu4e-error "Must be in mu4e-headers-mode (%S)" major-mode))
|
(mu4e-error "Must be in mu4e-headers-mode (%S)" major-mode))
|
||||||
(let* ((docid (or (mu4e~headers-docid-at-point)
|
(let* ((docid (or (mu4e~headers-docid-at-point)
|
||||||
(mu4e-warn "No message at point")))
|
(mu4e-warn "No message at point")))
|
||||||
|
;; decrypt (or not), based on `mu4e-decryption-policy'.
|
||||||
|
(decrypt
|
||||||
|
(and (member 'encrypted (mu4e-field-at-point :flags))
|
||||||
|
(if (eq mu4e-decryption-policy 'ask)
|
||||||
|
(yes-or-no-p (mu4e-format "Decrypt message?"))
|
||||||
|
mu4e-decryption-policy)))
|
||||||
(viewwin (mu4e~headers-redraw-get-view-window)))
|
(viewwin (mu4e~headers-redraw-get-view-window)))
|
||||||
(unless (window-live-p viewwin)
|
(unless (window-live-p viewwin)
|
||||||
(mu4e-error "Cannot get a message view"))
|
(mu4e-error "Cannot get a message view"))
|
||||||
(select-window viewwin)
|
(select-window viewwin)
|
||||||
(switch-to-buffer (mu4e~headers-get-loading-buf))
|
(switch-to-buffer (mu4e~headers-get-loading-buf))
|
||||||
(mu4e~proc-view docid mu4e-show-images)))
|
(mu4e~proc-view docid mu4e-show-images decrypt)))
|
||||||
|
|
||||||
(defun mu4e-headers-rerun-search ()
|
(defun mu4e-headers-rerun-search ()
|
||||||
"Rerun the search for the last search expression."
|
"Rerun the search for the last search expression."
|
||||||
|
|
|
@ -456,17 +456,17 @@ seen AFTER (the time_t value)."
|
||||||
(if personal "true" "false")
|
(if personal "true" "false")
|
||||||
(or after 0)))
|
(or after 0)))
|
||||||
|
|
||||||
(defun mu4e~proc-view (docid-or-msgid &optional images)
|
(defun mu4e~proc-view (docid-or-msgid &optional images decrypt)
|
||||||
"Get one particular message based on its DOCID-OR-MSGID (keyword
|
"Get one particular message based on its DOCID-OR-MSGID (keyword
|
||||||
argument). Optionally, if IMAGES is non-nil, backend will any
|
argument). Optionally, if IMAGES is non-nil, backend will any
|
||||||
images attached to the message, and return them as temp files. The
|
images attached to the message, and return them as temp files. The
|
||||||
result will be delivered to the function registered as
|
result will be delivered to the function registered as
|
||||||
`mu4e-message-func'."
|
`mu4e-message-func'."
|
||||||
(mu4e~proc-send-command
|
(mu4e~proc-send-command
|
||||||
"view %s extract-images:%s extract-encrypted:true"
|
"view %s extract-images:%s extract-encrypted:%s"
|
||||||
(mu4e--docid-msgid-param docid-or-msgid)
|
(mu4e--docid-msgid-param docid-or-msgid)
|
||||||
(if images "true" "false")))
|
(if images "true" "false")
|
||||||
|
(if decrypt "true" "false")))
|
||||||
|
|
||||||
(provide 'mu4e-proc)
|
(provide 'mu4e-proc)
|
||||||
|
|
||||||
;; End of mu4e-proc.el
|
;; End of mu4e-proc.el
|
||||||
|
|
|
@ -157,14 +157,14 @@ view buffer."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'mu4e-crypto)
|
:group 'mu4e-crypto)
|
||||||
|
|
||||||
(defcustom mu4e-decryption-policy 'auto
|
(defcustom mu4e-decryption-policy t
|
||||||
"Policy for dealing with encrypted parts. The setting is a symbol:
|
"Policy for dealing with encrypted parts. The setting is a symbol:
|
||||||
* `auto': try to decrypt automatically
|
* t: try to decrypt automatically
|
||||||
* `ask': ask before decrypting anything
|
* `ask': ask before decrypting anything
|
||||||
* `no': don't try to decrypt anything."
|
* nil: don't try to decrypt anything."
|
||||||
:type '(choice (const :tag "Try to decrypt automatically" auto)
|
:type '(choice (const :tag "Try to decrypt automatically" t)
|
||||||
(const :tag "Ask before decrypting anything" ask)
|
(const :tag "Ask before decrypting anything" ask)
|
||||||
(const :tag "Don't try to decrypt anything" no))
|
(const :tag "Don't try to decrypt anything" nil))
|
||||||
:group 'mu4e-crypto)
|
:group 'mu4e-crypto)
|
||||||
|
|
||||||
;; completion; we put them here rather than in mu4e-compose, as mu4e-utils needs
|
;; completion; we put them here rather than in mu4e-compose, as mu4e-utils needs
|
||||||
|
|
|
@ -138,12 +138,15 @@ The first letter of NAME is used as a shortcut character.")
|
||||||
"A mapping of user-visible attachment number to the actual part index.")
|
"A mapping of user-visible attachment number to the actual part index.")
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e-view-message-with-msgid (msgid)
|
(defun mu4e-view-message-with-msgid (msgid)
|
||||||
"View message with MSGID. This is meant for external programs
|
"View message with MSGID. This is meant for external programs
|
||||||
wanting to show specific messages - for example, `mu4e-org'."
|
wanting to show specific messages - for example, `mu4e-org'."
|
||||||
(mu4e~proc-view msgid mu4e-show-images))
|
;; note: hackish; if mu4e-decryption-policy is non-nil (ie., t or 'ask), we
|
||||||
|
;; decrpt the message. Since here we don't know if message is encrypted or
|
||||||
|
;; not, when the policy is 'ask'. we simply assume the user said yes... the
|
||||||
|
;; alternative would be to ask for each message, encrypted or not. maybe we
|
||||||
|
;; need an extra policy...
|
||||||
|
(mu4e~proc-view msgid mu4e-show-images mu4e-decryption-policy))
|
||||||
|
|
||||||
(defun mu4e-view-message-text (msg)
|
(defun mu4e-view-message-text (msg)
|
||||||
"Return the message to display (as a string), based on the MSG
|
"Return the message to display (as a string), based on the MSG
|
||||||
|
|
Loading…
Reference in New Issue