* hashcash.el problems
@ 2003-05-28 23:30 Katsumi Yamaoka
2003-05-29 1:34 ` Paul Foley
0 siblings, 1 reply; 2+ messages in thread
From: Katsumi Yamaoka @ 2003-05-28 23:30 UTC (permalink / raw)
Cc: ding
[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]
Hi,
I'm using hashcash.el bundled with the Gnus distribution and the
hashcash v0.25 binary under the linux system. I've modified
hashcash.el a bit since I got the following error. Is it
reasonable or do I need any other requirement?
Signaling: (error "Unknown hashcash format version")
(cond ((equal ... ?:) 1.2) ((equal ... ?:) 1.1) (t (error "Unknown hashcash format version")))
hashcash-version("hashcash token: 0:030528:yamaoka@jpl.org:8bdd14129fd11df5")
(number-to-string (hashcash-version pay))
(insert-before-markers "X-Payment: hashcash " (number-to-string (hashcash-version pay)) " " pay "\n")
[...]
hashcash-insert-payment("yamaoka@jpl.org")
I think we need to use the -q option to call the hashcash binary:
sh-2.05b$ hashcash -b 1 x|cat -
hashcash token: 0:030528:x:d657059d895c6292
0:030528:x:d657059d895c6292
sh-2.05b$ hashcash -q -b 1 x|cat -
0:030528:x:50c32261071a29c0
In addition, hashcash.el uses three cl run-time functions;
subseq, mapc, and caddr, though mapc is built-in in the recent
Emacs and cl provides a compiler macro for caddr. I made a
complete patch to hashcash.el to meet Gnus' policy that it
should never use cl run-time functions and still supports Emacs
20. How about it?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1775 bytes --]
--- hashcash.el~ 2003-04-16 22:33:29 +0000
+++ hashcash.el 2003-05-28 23:29:01 +0000
@@ -70,17 +70,15 @@
(defun hashcash-strip-quoted-names (addr)
(setq addr (mail-strip-quoted-names addr))
- (if (and addr (string-match "^[^+@]+\\(\\+[^@]*\\)@" addr))
- (concat (subseq addr 0 (match-beginning 1)) (subseq addr (match-end 1)))
+ (if (and addr (string-match "\\`\\([^+@]+\\)\\+[^@]*\\(@.+\\)" addr))
+ (concat (match-string 1 addr) (match-string 2 addr))
addr))
(defun hashcash-payment-required (addr)
"Return the hashcash payment value required for the given address."
(let ((val (assoc addr hashcash-payment-alist)))
(if val
- (if (cddr val)
- (caddr val)
- (cadr val))
+ (or (nth 2 val) (nth 1 val))
hashcash-default-payment)))
(defun hashcash-payment-to (addr)
@@ -99,7 +97,7 @@
(set-buffer (get-buffer-create " *hashcash*"))
(erase-buffer)
(call-process hashcash-path nil t nil
- (concat "-b " (number-to-string val)) str)
+ "-q" "-b" (number-to-string val) str)
(goto-char (point-min))
(buffer-substring (hashcash-point-at-bol) (hashcash-point-at-eol)))
nil))
@@ -145,7 +143,7 @@
"Verify a hashcash payment"
(let ((key (if (< (hashcash-version token) 1.2)
(cadr (split-string token ":"))
- (caddr (split-string token ":")))))
+ (nth 2 (split-string token ":")))))
(cond ((null resource)
(let ((elt (assoc key hashcash-accept-resources)))
(and elt (hashcash-check-payment token (car elt)
@@ -180,7 +178,7 @@
(when (and hashcash-in-news ng)
(setq addrlist (nconc addrlist (split-string ng ",[ \t\n]*")))))
(when addrlist
- (mapc #'hashcash-insert-payment addrlist)))))
+ (mapcar #'hashcash-insert-payment addrlist)))))
t)
;;;###autoload
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: hashcash.el problems
2003-05-28 23:30 hashcash.el problems Katsumi Yamaoka
@ 2003-05-29 1:34 ` Paul Foley
0 siblings, 0 replies; 2+ messages in thread
From: Paul Foley @ 2003-05-29 1:34 UTC (permalink / raw)
Cc: ding
On Thu, 29 May 2003 08:30:44 +0900, Katsumi Yamaoka wrote:
> Hi,
> I'm using hashcash.el bundled with the Gnus distribution and the
> hashcash v0.25 binary under the linux system. I've modified
> hashcash.el a bit since I got the following error. Is it
> reasonable or do I need any other requirement?
Looks good to me. Thanks.
[I tidied up a couple of other things, too]
--
There is no reason for any individual to have a computer in their home.
-- Ken Olson, President of DEC
(setq reply-to
(concatenate 'string "Paul Foley " "<mycroft" '(#\@) "actrix.gen.nz>"))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-05-29 1:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-28 23:30 hashcash.el problems Katsumi Yamaoka
2003-05-29 1:34 ` Paul Foley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).