diff options
Diffstat (limited to 'lisp/gnus/message.el')
| -rw-r--r-- | lisp/gnus/message.el | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index ab625be9e37..07ff4890385 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -2751,16 +2751,17 @@ OpenPGP header will be left out. If all the values are nil, | |||
| 2751 | or `message-openpgp-header' is itself nil, the OpenPGP header | 2751 | or `message-openpgp-header' is itself nil, the OpenPGP header |
| 2752 | will not be inserted." | 2752 | will not be inserted." |
| 2753 | :type '(choice | 2753 | :type '(choice |
| 2754 | (const nil :tag "Don't add OpenPGP header") | 2754 | (const :tag "Don't add OpenPGP header" nil) |
| 2755 | (list (choice (string :tag "ID") | 2755 | (list :tag "Use OpenPGP header" |
| 2756 | (const nil :tag "No ID")) | 2756 | (choice (string :tag "ID") |
| 2757 | (const :tag "No ID" nil)) | ||
| 2757 | (choice (string :tag "Key") | 2758 | (choice (string :tag "Key") |
| 2758 | (const nil :tag "No Key")) | 2759 | (const :tag "No Key" nil)) |
| 2759 | (choice (other nil :tag "None") | 2760 | (choice (other :tag "None" nil) |
| 2760 | (const "unprotected" :tag "Unprotected") | 2761 | (const :tag "Unprotected" "unprotected") |
| 2761 | (const "sign" :tag "Sign") | 2762 | (const :tag "Sign" "sign") |
| 2762 | (const "encrypt" :tag "Encrypt") | 2763 | (const :tag "Encrypt" "encrypt") |
| 2763 | (const "signencrypt" :tag "Sign and Encrypt")))) | 2764 | (const :tag "Sign and Encrypt" "signencrypt")))) |
| 2764 | :version "28.1") | 2765 | :version "28.1") |
| 2765 | 2766 | ||
| 2766 | (defun message-add-openpgp-header () | 2767 | (defun message-add-openpgp-header () |
| @@ -2768,32 +2769,34 @@ will not be inserted." | |||
| 2768 | 2769 | ||
| 2769 | Header will be constructed as specified in `message-openpgp-header'. | 2770 | Header will be constructed as specified in `message-openpgp-header'. |
| 2770 | 2771 | ||
| 2771 | Consider adding this function to `message-send-hook'." | 2772 | Consider adding this function to `message-header-setup-hook'" |
| 2772 | ;; See https://tools.ietf.org/html/draft-josefsson-openpgp-mailnews-header | 2773 | ;; See https://tools.ietf.org/html/draft-josefsson-openpgp-mailnews-header |
| 2773 | (when (and message-openpgp-header | 2774 | (when (and message-openpgp-header |
| 2774 | (or (nth 0 message-openpgp-header) | 2775 | (or (nth 0 message-openpgp-header) |
| 2775 | (nth 1 message-openpgp-header) | 2776 | (nth 1 message-openpgp-header) |
| 2776 | (nth 2 message-openpgp-header))) | 2777 | (nth 2 message-openpgp-header))) |
| 2777 | (with-temp-buffer | 2778 | (message-add-header |
| 2778 | (insert "OpenPGP: ") | 2779 | (with-temp-buffer |
| 2779 | ;; add ID | 2780 | (insert "OpenPGP: ") |
| 2780 | (let (need-sep) | 2781 | ;; add ID |
| 2781 | (when (nth 0 message-openpgp-header) | 2782 | (let (need-sep) |
| 2782 | (insert "id=" (nth 0 message-openpgp-header)) | 2783 | (when (nth 0 message-openpgp-header) |
| 2783 | (setq need-sep t)) | 2784 | (insert "id=" (nth 0 message-openpgp-header)) |
| 2784 | ;; add URL | 2785 | (setq need-sep t)) |
| 2785 | (when (nth 1 message-openpgp-header) | 2786 | ;; add URL |
| 2786 | (when need-sep (insert "; ")) | 2787 | (when (nth 1 message-openpgp-header) |
| 2787 | (if (string-match-p ";") | 2788 | (when need-sep (insert "; ")) |
| 2788 | (insert "url=\"" (nth 1 message-openpgp-header) "\"") | 2789 | (if (string-match-p ";") |
| 2789 | (insert "url=\"" (nth 1 message-openpgp-header) "\"")) | 2790 | (insert "url=\"" (nth 1 message-openpgp-header) "\"") |
| 2790 | (setq need-sep t)) | 2791 | (insert "url=\"" (nth 1 message-openpgp-header) "\"")) |
| 2791 | ;; add preference | 2792 | (setq need-sep t)) |
| 2792 | (when (nth 2 message-openpgp-header) | 2793 | ;; add preference |
| 2793 | (when need-sep (insert "; ")) | 2794 | (when (nth 2 message-openpgp-header) |
| 2794 | (insert "preference=" (nth 2 message-openpgp-header)))) | 2795 | (when need-sep (insert "; ")) |
| 2795 | ;; insert header | 2796 | (insert "preference=" (nth 2 message-openpgp-header)))) |
| 2796 | (message-add-header (buffer-string))))) | 2797 | ;; insert header |
| 2798 | (buffer-string))) | ||
| 2799 | (message-sort-headers))) | ||
| 2797 | 2800 | ||
| 2798 | 2801 | ||
| 2799 | 2802 | ||