Function: epa-mail-default-recipients

epa-mail-default-recipients is a byte-compiled function defined in epa-mail.el.gz.

Signature

(epa-mail-default-recipients)

Documentation

Return the default list of encryption recipients for a mail buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/epa-mail.el.gz
(defun epa-mail-default-recipients ()
  "Return the default list of encryption recipients for a mail buffer."
  (let ((config (epg-find-configuration 'OpenPGP))
	recipients-string real-recipients)
    (save-excursion
      (goto-char (point-min))
      (save-restriction
	(narrow-to-region (point)
                          (progn (rfc822-goto-eoh) (point)))
	(setq recipients-string
	      (mapconcat #'identity
			 (nconc (mail-fetch-field "to" nil nil t)
				(mail-fetch-field "cc" nil nil t)
				(mail-fetch-field "bcc" nil nil t))
			 ","))
	(setq recipients-string
	      (mail-strip-quoted-names
	       (with-temp-buffer
		 (insert "to: " recipients-string "\n")
		 (expand-mail-aliases (point-min) (point-max))
		 (car (mail-fetch-field "to" nil nil t))))))

      (setq real-recipients
	    (split-string recipients-string "," t "[ \t\n]*"))

      ;; Process all the recipients thru the list of GnuPG groups.
      ;; Expand GnuPG group names to what they stand for.
      (setq real-recipients
	    (apply #'nconc
		   (mapcar
		    (lambda (recipient)
		      (or (epg-expand-group config recipient)
			  (list recipient)))
		    real-recipients)))

      ;; Process all the recipients thru the user's list
      ;; of encryption aliases.
      (setq real-recipients
	    (apply #'nconc
		   (mapcar
		    (lambda (recipient)
		      (let ((tem (assoc (downcase recipient) epa-mail-aliases)))
			(if tem (copy-sequence (cdr tem))
			  (list recipient))))
		    real-recipients)))
      )))