* crypto/mu4e: support signature check in mu4e (part 1)

This commit is contained in:
djcb 2012-07-18 17:53:04 +03:00
parent 3322464564
commit 548ada3032
2 changed files with 40 additions and 2 deletions

View File

@ -399,6 +399,11 @@ headers)."
:shortname "Path"
:help "Full filesystem path to the message"
:sortable t))
(:signature .
( :name "Signature"
:shortname "Sgn"
:help "Check for the cryptographic signature"
:sortable nil))
(:subject .
( :name "Subject"
:shortname "Subject"
@ -415,6 +420,22 @@ list, and the fields the message view). Most fields should be
self-explanatory. A special one is `:from-or-to', which is equal to
`:from' unless `:from' matches `mu4e-user-mail-address-regexp', in
which case it will be equal to `:to'.")
(defvar mu4e-custom-header-info nil
"A list like `mu4e-custom-header-info', but for
custom (user-specified) headers. Each of the list items is a
property list with :name (the full-name, as displayed in the
message view), :shortname (the name as displayed in the headers
view), :help (some help information, which shows up in the
tooltip). Furthermore, there are two special fields:
:headers-func and :message-func, and the values should be functions
that take a MSG property list as argument, and return a string as
result.
Note, :sortable does not work for custom header fields.")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -47,7 +47,7 @@
:group 'mu4e)
(defcustom mu4e-view-fields
'(:from :to :cc :subject :flags :date :maildir :attachments)
'(:from :to :cc :subject :flags :date :maildir :attachments :signature)
"Header fields to display in the message view buffer. For the
complete list of available headers, see `mu4e-header-info'."
:type (list 'symbol)
@ -193,7 +193,8 @@ plist."
(if sizestr (mu4e~view-construct-header field sizestr))))
;; attachments
(:attachments (mu4e~view-construct-attachments-header msg))
(t (mu4e-error "Unsupported field: %S" field)))))
(:signature (mu4e~view-construct-signature-header msg))
(t (mu4e-error "Unsupported field: %S" field)))))
mu4e-view-fields "")
"\n"
(mu4e-body-text msg)))
@ -331,6 +332,22 @@ at POINT, or if nil, at (point)."
flags
(propertize ", " 'face 'mu4e-view-header-value-face)) t))
(defun mu4e~view-construct-signature-header (msg)
"Construct a Signature: header, if there are any signed parts."
(let* ((parts (plist-get msg :parts))
(verdicts
(remove-if 'null
(mapcar (lambda (part) (plist-get part :signature)) parts)))
(val (when verdicts
(mapconcat (lambda (v) (symbol-name v)) verdicts ", ")))
(btn (when val
(with-temp-buffer
(insert-text-button "Details") (buffer-string))))
(val (when val
(concat (propertize val 'face 'mu4e-view-special-header-value-face)
" (" btn ")"))))
(mu4e~view-construct-header :signature val t)))
(defun mu4e~view-open-save-attach-func (msg attachnum is-open)
"Return a function that offers to save attachment NUM. If IS-OPEN
is nil, and otherwise open it."