Function: mail-add-payment

mail-add-payment is an interactive and byte-compiled function defined in hashcash.el.gz.

Signature

(mail-add-payment &optional ARG ASYNC)

Documentation

Add X-Payment: and X-Hashcash: headers with a hashcash payment for each recipient address. Prefix arg sets default payment temporarily. Set ASYNC to t to start asynchronous calculation. (See mail-add-payment-async).

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/hashcash.el.gz
;;;###autoload
(defun mail-add-payment (&optional arg async)
  "Add X-Payment: and X-Hashcash: headers with a hashcash payment
for each recipient address.  Prefix arg sets default payment temporarily.
Set ASYNC to t to start asynchronous calculation.  (See
`mail-add-payment-async')."
  (interactive "P")
  (let ((hashcash-default-payment (if arg (prefix-numeric-value arg)
				    hashcash-default-payment))
	(addrlist nil))
    (save-excursion
      (save-restriction
	(message-narrow-to-headers)
        (goto-char (point-max))
	(let ((to (hashcash-strip-quoted-names (mail-fetch-field "To" nil t)))
	      (cc (hashcash-strip-quoted-names (mail-fetch-field "Cc" nil t)))
	      (ng (hashcash-strip-quoted-names (mail-fetch-field "Newsgroups"
								 nil t))))
	  (when to
	    (setq addrlist (split-string to ",[ \t\n]*")))
	  (when cc
	    (setq addrlist (nconc addrlist (split-string cc ",[ \t\n]*"))))
	  (when (and hashcash-in-news ng)
	    (setq addrlist (nconc addrlist (split-string ng ",[ \t\n]*")))))
	(when addrlist
	  (mapc (if async
		    #'hashcash-insert-payment-async
		  #'hashcash-insert-payment)
		addrlist)))))
  t)