diff options
author | Ken Raeburn <raeburn@raeburn.org> | 2015-11-01 01:42:21 -0400 |
---|---|---|
committer | Ken Raeburn <raeburn@raeburn.org> | 2015-11-01 01:42:21 -0400 |
commit | 39372e1a1032521be74575bb06f95a3898fbae30 (patch) | |
tree | 754bd242a23d2358ea116126fcb0a629947bd9ec /lisp/mail/hashcash.el | |
parent | 6a3121904d76e3b2f63007341d48c5c1af55de80 (diff) | |
parent | e11aaee266da52937a3a031cb108fe13f68958c3 (diff) | |
download | emacs-39372e1a1032521be74575bb06f95a3898fbae30.tar.gz |
merge from trunk
Diffstat (limited to 'lisp/mail/hashcash.el')
-rw-r--r-- | lisp/mail/hashcash.el | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el index b6df075f7ef..70170654f67 100644 --- a/lisp/mail/hashcash.el +++ b/lisp/mail/hashcash.el @@ -1,6 +1,6 @@ ;;; hashcash.el --- Add hashcash payments to email -;; Copyright (C) 2003-2005, 2007-2013 Free Software Foundation, Inc. +;; Copyright (C) 2003-2005, 2007-2015 Free Software Foundation, Inc. ;; Written by: Paul Foley <mycroft@actrix.gen.nz> (1997-2002) ;; Maintainer: Paul Foley <mycroft@actrix.gen.nz> @@ -47,10 +47,6 @@ ;;; Code: -;; For Emacs <22.2 and XEmacs. -(eval-and-compile - (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) - (eval-when-compile (require 'cl)) ; for case (defgroup hashcash nil @@ -89,20 +85,25 @@ present, is the string to be hashed; if not present ADDR will be used." Resources named here are to be accepted in incoming payments. If the corresponding AMOUNT is NIL, the value of `hashcash-default-accept-payment' is used instead." + :type 'alist :group 'hashcash) -(defcustom hashcash-path (executable-find "hashcash") - "The path to the hashcash binary." +(define-obsolete-variable-alias 'hashcash-path 'hashcash-program "24.4") +(defcustom hashcash-program "hashcash" + "The name of the hashcash executable. +If this is not in your PATH, specify an absolute file name." + :type '(choice (const nil) file) :group 'hashcash) (defcustom hashcash-extra-generate-parameters nil - "A list of parameter strings passed to `hashcash-path' when minting. + "A list of parameter strings passed to `hashcash-program' when minting. For example, you may want to set this to '(\"-Z2\") to reduce header length." :type '(repeat string) :group 'hashcash) (defcustom hashcash-double-spend-database "hashcash.db" - "The path to the double-spending database." + "The name of the double-spending database file." + :type 'file :group 'hashcash) (defcustom hashcash-in-news nil @@ -159,10 +160,10 @@ For example, you may want to set this to '(\"-Z2\") to reduce header length." (defun hashcash-generate-payment (str val) "Generate a hashcash payment by finding a VAL-bit collison on STR." (if (and (> val 0) - hashcash-path) + hashcash-program) (with-current-buffer (get-buffer-create " *hashcash*") (erase-buffer) - (apply 'call-process hashcash-path nil t nil + (apply 'call-process hashcash-program nil t nil "-m" "-q" "-b" (number-to-string val) str hashcash-extra-generate-parameters) (goto-char (point-min)) @@ -173,9 +174,9 @@ For example, you may want to set this to '(\"-Z2\") to reduce header length." "Generate a hashcash payment by finding a VAL-bit collison on STR. Return immediately. Call CALLBACK with process and result when ready." (if (and (> val 0) - hashcash-path) + hashcash-program) (let ((process (apply 'start-process "hashcash" nil - hashcash-path "-m" "-q" + hashcash-program "-m" "-q" "-b" (number-to-string val) str hashcash-extra-generate-parameters))) (setq hashcash-process-alist (cons @@ -187,8 +188,8 @@ Return immediately. Call CALLBACK with process and result when ready." (defun hashcash-check-payment (token str val) "Check the validity of a hashcash payment." - (if hashcash-path - (zerop (call-process hashcash-path nil nil nil "-c" + (if hashcash-program + (zerop (call-process hashcash-program nil nil nil "-c" "-d" "-f" hashcash-double-spend-database "-b" (number-to-string val) "-r" str |