From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/52906 Path: main.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: hashcash.el problems Date: Thu, 29 May 2003 08:30:44 +0900 Organization: Emacsen advocacy group Sender: ding-owner@lists.math.uh.edu Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1054164936 19721 80.91.224.249 (28 May 2003 23:35:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 28 May 2003 23:35:36 +0000 (UTC) Cc: ding@gnus.org Original-X-From: ding-owner+M1450@lists.math.uh.edu Thu May 29 01:35:33 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19LAS9-00057L-00 for ; Thu, 29 May 2003 01:35:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 19LAQP-0005Hc-00; Wed, 28 May 2003 18:33:41 -0500 Original-Received: from util1.math.uh.edu ([129.7.128.22]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 19LAQG-0005HU-00 for ding@lists.math.uh.edu; Wed, 28 May 2003 18:33:32 -0500 Original-Received: from sclp3.sclp.com ([64.157.176.121]) by util1.math.uh.edu with smtp (Exim 4.10) id 19LAQE-0001UM-00 for ding@lists.math.uh.edu; Wed, 28 May 2003 18:33:30 -0500 Original-Received: (qmail 71207 invoked by alias); 28 May 2003 23:30:27 -0000 Original-Received: (qmail 71202 invoked from network); 28 May 2003 23:30:27 -0000 Original-Received: from unknown (HELO washington.hostforweb.net) (139.81.176.2) by sclp3.sclp.com with SMTP; 28 May 2003 23:30:27 -0000 Original-Received: from yamaoka by washington.hostforweb.net with local (Exim 3.36 #1) id 19LANF-0003L2-00; Wed, 28 May 2003 19:30:25 -0400 Original-To: Paul Foley X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.1003 (Gnus v5.10.3) XEmacs/21.4 (Rational FORTRAN, linux) Cancel-Lock: sha1:F1Sr1aDFmrTMV2L3CmjFmSkQJJw= X-Payment: hashcash 1.2 0:030528:mycroft@actrix.gen.nz:a6f3f00dd3f603de X-Hashcash: 0:030528:mycroft@actrix.gen.nz:a6f3f00dd3f603de X-Payment: hashcash 1.2 0:030528:ding@gnus.org:f155b9e39bbc5163 X-Hashcash: 0:030528:ding@gnus.org:f155b9e39bbc5163 X-Virus-Scanned-By: Amavis with CLAM Anti Virus on washington.hostforweb.net X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - washington.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [32041 32041] / [32041 32041] X-AntiAbuse: Sender Address Domain - washington.hostforweb.net Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:52906 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:52906 --=-=-= 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? --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- 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 --=-=-=--