+2007-01-30 Daiki Ueno <ueno@unixuser.org>
+
+ * epg.el (epg-last-status): New variable.
+ (epg--process-filter): Set epg-last-status after calling a status
+ handler.
+ (epg--prompt-GET_BOOL): New function.
+ (epg--prompt-GET_BOOL-untrusted_key.override): New function.
+ (epg--status-GET_BOOL): Call epg--prompt-GET_BOOL-* instead of
+ y-or-n-p.
+
2007-01-29 Daiki Ueno <ueno@unixuser.org>
* EasyPG: Version 0.0.10 released.
(defvar epg-user-id-alist nil
"An alist mapping from key ID to user ID.")
+(defvar epg-last-status nil)
(defvar epg-read-point nil)
(defvar epg-process-filter-running nil)
(defvar epg-pending-status-list nil)
(setq epg-pending-status-list nil))
(if (and symbol
(fboundp symbol))
- (funcall symbol epg-context string))))
+ (funcall symbol epg-context string))
+ (setq epg-last-status (cons status string))))
(forward-line)
(setq epg-read-point (point))))
(setq epg-process-filter-running nil))))))
(if encoded-passphrase-with-new-line
(epg--clear-string encoded-passphrase-with-new-line))))))
+(defun epg--prompt-GET_BOOL (context string)
+ (let ((entry (assoc string epg-prompt-alist)))
+ (y-or-n-p (if entry (cdr entry) (concat string "? ")))))
+
+(defun epg--prompt-GET_BOOL-untrusted_key.override (context string)
+ (if (and (equal (car epg-last-status) "USERID_HINT")
+ (string-match "\\`\\([^ ]+\\) \\(.*\\)" (cdr epg-last-status)))
+ (y-or-n-p (format "Untrusted key %s %s. Trust this key anyway? "
+ (match-string 1 string)
+ (match-string 2 string)))))
+
(defun epg--status-GET_BOOL (context string)
- (let ((entry (assoc string epg-prompt-alist))
- inhibit-quit)
+ (let (inhibit-quit)
(condition-case nil
- (if (y-or-n-p (if entry (cdr entry) (concat string "? ")))
- (process-send-string (epg-context-process context) "y\n")
- (process-send-string (epg-context-process context) "n\n"))
+ (if (funcall (or (intern-soft (concat "epg--prompt-GET_BOOL-" string))
+ #'epg--prompt-GET_BOOL)
+ context string)
+ (process-send-string (epg-context-process context) "y\n")
+ (process-send-string (epg-context-process context) "n\n"))
(quit
(epg-context-set-result-for
context 'error