From d10f4964173ae644077de91b56a98d48f7253ce8 Mon Sep 17 00:00:00 2001 From: Alexander Adolf Date: Fri, 25 Mar 2022 14:13:28 +0100 Subject: [PATCH] emacs/smime: render decrypted MIME entities in notmuch-show When processing encrypted S/MIME messages, after decryption the "last resort" handler notmuch-show-insert-part-*/* was called, because there was no application/pkcs7-mime handler, resulting in the decrypted contents not being displayed. This commit adds a new function notmuch-show-insert-part-application/pkcs7-mime (and an alias notmuch-show-insert-part-application/x-pkcs7-mime for the legacy MIME type) to render the S/MIME protected part after decryption. --- emacs/notmuch-show.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 7c1f02c9..b7edfc98 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -712,6 +712,23 @@ will return nil if the CID is unknown or cannot be retrieved." (defun notmuch-show-insert-part-application/pgp-encrypted (_msg _part _content-type _nth _depth _button) t) +(defun notmuch-show-insert-part-application/pkcs7-mime (msg part _content-type _nth depth _button) + "Render S/MIME protected content after decryption. + +An alias for this function is also defined to handle entities +using the legacy application/x-pkcs7-mime MIME type." + (let* ((encstatus (car (plist-get part :encstatus))) + (inner-part (car (plist-get part :content)))) + ;; Insert a button detailing the encryption status. + (notmuch-crypto-insert-encstatus-button encstatus) + (if (not (string= (plist-get encstatus :status) "bad")) + ;; Show all decrypted parts. + (notmuch-show-insert-bodypart msg inner-part depth)))) + +;; Support for the legacy "x-" type. +(fset 'notmuch-show-insert-part-application/x-pkcs7-mime + 'notmuch-show-insert-part-application/pkcs7-mime) + (defun notmuch-show-insert-part-multipart/* (msg part _content-type _nth depth _button) (let ((inner-parts (plist-get part :content)) (start (point))) -- 2.35.1