(save-excursion
(save-restriction
(message-narrow-to-headers-or-head)
- (let ((token (message-fetch-field "x-hashcash")))
+ (let ((token (message-fetch-field "x-hashcash"))
+ (case-fold-search t))
(and (stringp token)
(string-match (regexp-quote recipient) token))))))
(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
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.
(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"