* hashcash.el (hashcash-generate-payment)
authorTeodor Zlatanov <tzz@lifelogs.com>
Tue, 28 Sep 2004 14:03:12 +0000 (14:03 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Tue, 28 Sep 2004 14:03:12 +0000 (14:03 +0000)
(hashcash-check-payment): do the right thing if hashcash-path is
nil (because the hashcash program could not be found)

* spam.el (spam-use-hashcash): remove comment

lisp/ChangeLog
lisp/hashcash.el
lisp/spam.el

index 08327c0..2deb846 100644 (file)
@@ -1,3 +1,11 @@
+2004-09-28  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * hashcash.el (hashcash-generate-payment)
+       (hashcash-check-payment): do the right thing if hashcash-path is
+       nil (because the hashcash program could not be found)
+
+       * spam.el (spam-use-hashcash): remove comment
+
 2004-09-27  Jesper Harder  <harder@ifa.au.dk>
 
        * gnus-cache.el (gnus-cache-possibly-remove-articles-1)
index 11702c0..d87c5cd 100644 (file)
@@ -111,7 +111,8 @@ is used instead.")
 
 (defun hashcash-generate-payment (str val)
   "Generate a hashcash payment by finding a VAL-bit collison on STR."
-  (if (> val 0)
+  (if (and (> val 0) 
+          hashcash-path)
       (save-excursion
        (set-buffer (get-buffer-create " *hashcash*"))
        (erase-buffer)
@@ -119,15 +120,23 @@ is used instead.")
                      "-m" "-q" "-b" (number-to-string val) str)
        (goto-char (point-min))
        (hashcash-token-substring))
-    nil))
+    (progn
+      (message "No hashcash binary found")
+      (sleep-for 1)
+      nil)))
 
 (defun hashcash-check-payment (token str val)
   "Check the validity of a hashcash payment."
-  (zerop (call-process hashcash-path nil nil nil "-c"
-                      "-d" "-f" hashcash-double-spend-database
-                      "-b" (number-to-string val)
-                      "-r" str
-                      token)))
+  (if hashcash-path
+      (zerop (call-process hashcash-path nil nil nil "-c"
+                          "-d" "-f" hashcash-double-spend-database
+                          "-b" (number-to-string val)
+                          "-r" str
+                          token))
+    (progn
+      (message "No hashcash binary found")
+      (sleep-for 1)
+      nil)))
 
 (defun hashcash-version (token)
   "Find the format version of a hashcash token."
index e586095..9777d1a 100644 (file)
@@ -966,7 +966,6 @@ backends)."
 (spam-install-checkonly-backend 'spam-use-blackholes
                                'spam-check-blackholes)
 
-;; TODO: does anyone use hashcash?  We should remove it if not.
 (spam-install-checkonly-backend 'spam-use-hashcash
                                'spam-check-hashcash)