Merge pull request #500 from zakkak/decryption_field
Add decryption field
This commit is contained in:
@ -435,7 +435,7 @@ I.e. a message with the draft flag set."
|
||||
'((t :inherit font-lock-preprocessor-face))
|
||||
"Face for the mark in the headers list."
|
||||
:group 'mu4e-faces)
|
||||
|
||||
|
||||
(defface mu4e-header-key-face
|
||||
'((t :inherit message-header-name-face :bold t))
|
||||
"Face for a header key (such as \"Foo\" in \"Subject:\ Foo\")."
|
||||
@ -625,6 +625,11 @@ mu4e-compose-mode."
|
||||
:shortname "Sgn"
|
||||
:help "Check for the cryptographic signature"
|
||||
:sortable nil))
|
||||
(:decryption .
|
||||
( :name "Decryption"
|
||||
:shortname "Dec"
|
||||
:help "Check the cryptographic decryption status"
|
||||
:sortable nil))
|
||||
(:size .
|
||||
( :name "Size"
|
||||
:shortname "Size"
|
||||
|
||||
@ -50,7 +50,8 @@
|
||||
:group 'mu4e)
|
||||
|
||||
(defcustom mu4e-view-fields
|
||||
'(:from :to :cc :subject :flags :date :maildir :mailing-list :tags :attachments :signature)
|
||||
'(:from :to :cc :subject :flags :date :maildir :mailing-list :tags
|
||||
:attachments :signature :decryption)
|
||||
"Header fields to display in the message view buffer.
|
||||
For the complete list of available headers, see `mu4e-header-info'."
|
||||
:type (list 'symbol)
|
||||
@ -227,6 +228,8 @@ found."
|
||||
(:attachments (mu4e~view-construct-attachments-header msg))
|
||||
;; pgp-signatures
|
||||
(:signature (mu4e~view-construct-signature-header msg))
|
||||
;; pgp-decryption
|
||||
(:decryption (mu4e~view-construct-decryption-header msg))
|
||||
(t (mu4e~view-construct-header field
|
||||
(mu4e~view-custom-field msg field))))))
|
||||
mu4e-view-fields "")
|
||||
@ -403,6 +406,28 @@ add text-properties to VAL."
|
||||
(val (when val (concat val " (" btn ")"))))
|
||||
(mu4e~view-construct-header :signature val t)))
|
||||
|
||||
(defun mu4e~view-construct-decryption-header (msg)
|
||||
"Construct a Decryption: header, if there are any encrypted parts."
|
||||
(let* ((parts (mu4e-message-field msg :parts))
|
||||
(verdicts
|
||||
(remove-if 'null
|
||||
(mapcar (lambda (part) (mu4e-message-part-field part :decryption))
|
||||
parts)))
|
||||
(succeeded (remove-if (lambda (v) (eq v 'failed)) verdicts))
|
||||
(failed (remove-if (lambda (v) (eq v 'succeeded)) verdicts))
|
||||
(succ (when succeeded
|
||||
(propertize
|
||||
(concat (number-to-string (length succeeded))
|
||||
" part(s) decrypted")
|
||||
'face 'mu4e-ok-face)))
|
||||
(fail (when failed
|
||||
(propertize
|
||||
(concat (number-to-string (length failed))
|
||||
" part(s) failed")
|
||||
'face 'mu4e-warning-face)))
|
||||
(val (concat succ fail)))
|
||||
(mu4e~view-construct-header :decryption val t)))
|
||||
|
||||
(defun mu4e~view-open-attach-from-binding ()
|
||||
"Open the attachement at point, or click location."
|
||||
(interactive)
|
||||
@ -1299,9 +1324,12 @@ or message-at-point."
|
||||
(interactive)
|
||||
(let* ((msg (or msg (mu4e-message-at-point)))
|
||||
(path (mu4e-message-field msg :path))
|
||||
(cmd (format "%s verify --verbose %s"
|
||||
(cmd (format "%s verify --verbose %s %s"
|
||||
mu4e-mu-binary
|
||||
(shell-quote-argument path)))
|
||||
(shell-quote-argument path)
|
||||
(if mu4e-decryption-policy
|
||||
"--decrypt --use-agent"
|
||||
"")))
|
||||
(output (shell-command-to-string cmd))
|
||||
;; create a new one
|
||||
(buf (get-buffer-create mu4e~verify-buffer-name))
|
||||
|
||||
Reference in New Issue
Block a user