GNU bug report logs - #39964
[PATCH] Add support for creating OpenPGP header

Previous Next

Package: emacs;

Reported by: Philip K <philip <at> warpmail.net>

Date: Sat, 7 Mar 2020 00:12:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39964 in the body.
You can then email your comments to 39964 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#39964; Package emacs. (Sat, 07 Mar 2020 00:12:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Philip K <philip <at> warpmail.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 07 Mar 2020 00:12:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Philip K <philip <at> warpmail.net>
To: bug-gnu-emacs <at> gnu.org
Cc: Philip K <philip.kaludercic <at> fau.de>
Subject: [PATCH] Add support for creating OpenPGP header
Date: Sat,  7 Mar 2020 01:11:28 +0100
From: Philip K <philip.kaludercic <at> fau.de>

See [0] for more details on it's usage and interpretation.

[0]: https://tools.ietf.org/html/draft-josefsson-openpgp-mailnews-header
---
 lisp/gnus/message.el | 57 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index adefa0efd6..1c9c99afbe 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2730,6 +2730,63 @@ message-sign-encrypt-if-all-keys-available
   (when (message-all-epg-keys-available-p)
     (mml-secure-message-sign-encrypt)))
 
+(defcustom message-openpgp-header nil
+  "Specification for \"OpenPGP\" header.
+
+Otherwise, the variable must be a
+list with three elements, all strings:
+- Key ID, in hexadecimal form
+- Key URL or ASCII armoured key.
+- Protection preference, one of: \"unprotected\", \"sign\",
+  \"encrypt\" or \"signencrypt\".
+
+Each value may be nil, in which case it won't be inserted. If all
+the values are nil, or `message-openpgp-header' is nil itself,
+don't insert any header."
+  :type '(choice
+	  (const nil :tag "Don't add OpenPGP header")
+	  (list (choice (string :tag "ID")
+			(const nil :tag "No ID"))
+		(choice (string :tag "Key")
+			(const nil :tag "No Key"))
+		(choice (other nil :tag "None")
+			(const "unprotected" :tag "Unprotected")
+			(const "sign" :tag "Sign")
+			(const "encrypt" :tag "Encrypt")
+			(const "signencrypt" :tag "Sign and Encrypt")))))
+
+(defun messasge-add-openpgp-header ()
+  "Add OpenPGP header to point to public key.
+
+Header will be constructed as specified in `message-openpgp-header'.
+
+Consider adding this function to `message-send-hook'."
+  ;; See https://tools.ietf.org/html/draft-josefsson-openpgp-mailnews-header
+  (when (and message-openpgp-header
+	     (or (nth 0 message-openpgp-header)
+		 (nth 1 message-openpgp-header)
+		 (nth 2 message-openpgp-header)))
+    (with-temp-buffer
+      (insert "OpenPGP: ")
+      ;; add ID
+      (let (need-sep)
+	(when (nth 0 message-openpgp-header)
+	  (insert "id=" (nth 0 message-openpgp-header))
+	  (setq need-sep t))
+	;; add URL
+	(when (nth 1 message-openpgp-header)
+	  (when need-sep (insert "; "))
+	  (if (string-match-p ";")
+	      (insert "url=\"" (nth 1 message-openpgp-header) "\"")
+	    (insert "url=\"" (nth 1 message-openpgp-header) "\""))
+	  (setq need-sep t))
+	;; add preference
+	(when (nth 2 message-openpgp-header)
+	  (when need-sep (insert "; "))
+	  (insert "preference=" (nth 2 message-openpgp-header))))
+      ;; insert header
+      (message-add-header (buffer-string)))))
+
 
 
 ;;;
-- 
2.20.1





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39964; Package emacs. (Sat, 07 Mar 2020 07:54:01 GMT) Full text and rfc822 format available.

Message #8 received at 39964 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Philip K <philip <at> warpmail.net>
Cc: philip.kaludercic <at> fau.de, 39964 <at> debbugs.gnu.org
Subject: Re: bug#39964: [PATCH] Add support for creating OpenPGP header
Date: Sat, 07 Mar 2020 09:53:12 +0200
> From: Philip K <philip <at> warpmail.net>
> Date: Sat,  7 Mar 2020 01:11:28 +0100
> Cc: Philip K <philip.kaludercic <at> fau.de>
> 
> +(defcustom message-openpgp-header nil
> +  "Specification for \"OpenPGP\" header.

This defcustom lacks the :version tag.

Also, please always accompany user-visible changes with a suitable
NEWS entry and changes for the relevant Info manual.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#39964; Package emacs. (Sat, 08 Aug 2020 13:51:01 GMT) Full text and rfc822 format available.

Message #11 received at 39964 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Philip K <philip <at> warpmail.net>
Cc: Philip K <philip.kaludercic <at> fau.de>, 39964 <at> debbugs.gnu.org
Subject: Re: bug#39964: [PATCH] Add support for creating OpenPGP header
Date: Sat, 08 Aug 2020 15:50:33 +0200
Philip K <philip <at> warpmail.net> writes:

> From: Philip K <philip.kaludercic <at> fau.de>
>
> See [0] for more details on it's usage and interpretation.
>
> [0]: https://tools.ietf.org/html/draft-josefsson-openpgp-mailnews-header

[...]

> +(defcustom message-openpgp-header nil
> +  "Specification for \"OpenPGP\" header.

Thanks; I've applied your patch to Emacs 28 (along with additions
suggested by Eli).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Aug 2020 13:51:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 39964 <at> debbugs.gnu.org and Philip K <philip <at> warpmail.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 08 Aug 2020 13:51:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 06 Sep 2020 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 232 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.