X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fhashcash.el;h=70170654f67b51fd1d724222c7d767e0745c6fc6;hb=851278bf56a0156a4dd5896e9959f63e33d07ee2;hp=fd8d2633818e01ad0e665d05d10431975d479032;hpb=935af32fa5a3d22163b9b626d770f5c16a766837;p=gnus diff --git a/lisp/hashcash.el b/lisp/hashcash.el index fd8d26338..70170654f 100644 --- a/lisp/hashcash.el +++ b/lisp/hashcash.el @@ -1,6 +1,6 @@ ;;; hashcash.el --- Add hashcash payments to email -;; Copyright (C) 2003-2005, 2007-2012 Free Software Foundation, Inc. +;; Copyright (C) 2003-2005, 2007-2015 Free Software Foundation, Inc. ;; Written by: Paul Foley (1997-2002) ;; Maintainer: Paul Foley @@ -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