emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/openpgp 59f2277a72 03/30: Added rmail and mu4e integrat


From: ELPA Syncer
Subject: [elpa] externals/openpgp 59f2277a72 03/30: Added rmail and mu4e integration functions
Date: Sun, 26 Mar 2023 10:59:26 -0400 (EDT)

branch: externals/openpgp
commit 59f2277a7280271b5566c63473042ad348e720ce
Author: Philip Kaludercic <philip.kaludercic@fau.de>
Commit: Philip Kaludercic <philip.kaludercic@fau.de>

    Added rmail and mu4e integration functions
---
 openpgp.el | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/openpgp.el b/openpgp.el
index 797ee62171..6a92d31a83 100644
--- a/openpgp.el
+++ b/openpgp.el
@@ -1,4 +1,4 @@
-;;; $Id: openpgp.el,v 1.1 2020/03/04 14:36:51 oj14ozun Exp oj14ozun $
+;;; $Id: openpgp.el,v 1.2 2020/03/04 14:40:53 oj14ozun Exp oj14ozun $
 ;;; Implementation of the keys.openpgp.org protocol as specified by
 ;;; https://keys.openpgp.org/about/api
 
@@ -8,6 +8,8 @@
 NOTE: currently the default value is the only working keyserver,
 as federation hasn't been implemented yet.")
 
+ ;; FETCHING KEYS
+
 (defsubst openpgp--api-url (endpoint &optional arg)
   "Construct VKS request querying ENDPOINT.
 
@@ -43,6 +45,8 @@ URL, if non-nil."
   (url-retrieve (openpgp--api-url "by-email" email)
                #'openpgp--process-key))
 
+ ;; UPLOADING KEYS
+
 (defun openpgp--verify-callback (status)
   (when (plist-get status :error)
     (error "Request failed: %s"
@@ -95,3 +99,29 @@ key."
   (with-temp-buffer
     (insert-file-contents key-file)
     (openpgp-upload-key email (buffer-string))))
+
+ ;; MAIL CLIENT SUPPORT
+
+(with-eval-after-load 'rmail
+  (defun openpgp-rmail-fetch-key ()
+    "Fetch key for the sender of the current message."
+    (interactive)
+    (when (or (null rmail-current-message)
+             (zerop rmail-current-message))
+      (error "There is no message to fetch a key for"))
+    (let ((email (or (mail-fetch-field "mail-reply-to" nil t)
+                    (mail-fetch-field "reply-to" nil t)
+                    (mail-fetch-field "from"))))
+      (when (yes-or-no-p (format "Attempt to fetch key for %s? " email))
+       (openpgp-fetch-key-by-email email)))))
+
+(with-eval-after-load 'mu4
+  (defun openpgp-mu4e-fetch-key ()
+    "Fetch key for the sender of the current message."
+    (interactive)
+    (when (mu4e-message-at-point 'noerror)
+      (error "There is no message to fetch a key for"))
+    (let ((email (or (mu4e-message-field msg :reply-to)
+                    (mu4e-message-field msg :from))))
+      (when (yes-or-no-p (format "Attempt to fetch key for %s? " email))
+       (openpgp-fetch-key-by-email email)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]