X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fhashcash.el;h=7382345dfe2c8ad58c466c278aa48e181dd95c2c;hb=b719a6d1d90bb76a5f2cb4072064606b9bc0ca06;hp=ac2e4a46c4e4e1cb9ea11b0bb89abdbf0682a6f6;hpb=fd04e2e478e7d90a55c8ef906c54be1cdf6a94b1;p=gnus diff --git a/lisp/hashcash.el b/lisp/hashcash.el index ac2e4a46c..7382345df 100644 --- a/lisp/hashcash.el +++ b/lisp/hashcash.el @@ -223,9 +223,6 @@ Return immediately. Call CALLBACK with process and result when ready." (let ((pay (hashcash-generate-payment (hashcash-payment-to arg) (hashcash-payment-required arg)))) (when pay - ;; (insert-before-markers "X-Payment: hashcash " - ;; (number-to-string (hashcash-version pay)) " " - ;; pay "\n") (insert-before-markers "X-Hashcash: " pay "\n"))))) ;;;###autoload @@ -234,26 +231,23 @@ Return immediately. Call CALLBACK with process and result when ready." Only start calculation. Results are inserted when ready." (interactive "sPay to: ") (unless (hashcash-already-paid-p arg) - (hashcash-generate-payment-async (hashcash-payment-to arg) - (hashcash-payment-required arg) - `(lambda (process payment) - (hashcash-insert-payment-async-2 ,(current-buffer) process payment))))) + (hashcash-generate-payment-async + (hashcash-payment-to arg) + (hashcash-payment-required arg) + `(lambda (process payment) + (hashcash-insert-payment-async-2 ,(current-buffer) process payment))))) (defun hashcash-insert-payment-async-2 (buffer process pay) - (with-current-buffer buffer - (save-excursion - (save-restriction - (setq hashcash-process-alist (delq - (assq process hashcash-process-alist) - hashcash-process-alist)) - (goto-char (point-min)) - (search-forward mail-header-separator) - (beginning-of-line) - (when pay -;; (insert-before-markers "X-Payment: hashcash " -;; (number-to-string (hashcash-version pay)) " " -;; pay "\n") - (insert-before-markers "X-Hashcash: " pay)))))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (save-excursion + (save-restriction + (setq hashcash-process-alist (delq + (assq process hashcash-process-alist) + hashcash-process-alist)) + (message-goto-eoh) + (when pay + (insert-before-markers "X-Hashcash: " pay))))))) (defun hashcash-cancel-async (&optional buffer) "Delete any hashcash processes associated with BUFFER. @@ -318,10 +312,7 @@ Set ASYNC to t to start asynchronous calculation. (See (addrlist nil)) (save-excursion (save-restriction - (goto-char (point-min)) - (search-forward mail-header-separator) - (beginning-of-line) - (narrow-to-region (point-min) (point)) + (message-narrow-to-headers) (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"