Gnus development mailing list
 help / color / mirror / Atom feed
* hashcash: duplicate payments
@ 2006-03-26 17:53 Andreas Seltenreich
  2006-03-26 20:01 ` Andreas Seltenreich
  2006-03-27  9:40 ` Simon Josefsson
  0 siblings, 2 replies; 6+ messages in thread
From: Andreas Seltenreich @ 2006-03-26 17:53 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

Hi,

I just noticed that mail-add-payment (called from message-send-message)
doesn't recognise asynchronously generated payments for addresses that
contain uppercase characters. Attached is a patch that makes the test
case-insensitive.

An alternative solution would be to supply the "-C" option to the
external hashcash program, but IMHO this would unnecessarily restrict
the user in his customisation needs (hashcash-extra-generate-parameters).

Thanks,
andreas

2006-03-26  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>

	* hashcash.el (hashcash-already-paid-p): Bind case-fold-search
	when searching for already-paid recipients.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: hashcash.el.patch --]
[-- Type: text/x-patch, Size: 824 bytes --]

Index: hashcash.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/hashcash.el,v
retrieving revision 7.14
diff -c -r7.14 hashcash.el
*** hashcash.el	6 Jul 2005 06:42:01 -0000	7.14
--- hashcash.el	26 Mar 2006 16:49:17 -0000
***************
*** 210,216 ****
    (save-excursion
      (save-restriction
        (message-narrow-to-headers-or-head)
!       (let ((token (message-fetch-field "x-hashcash")))
  	(and (stringp token)
  	     (string-match (regexp-quote recipient) token))))))
  
--- 210,217 ----
    (save-excursion
      (save-restriction
        (message-narrow-to-headers-or-head)
!       (let ((token (message-fetch-field "x-hashcash"))
! 	    (case-fold-search t))
  	(and (stringp token)
  	     (string-match (regexp-quote recipient) token))))))
  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: hashcash: duplicate payments
  2006-03-26 17:53 hashcash: duplicate payments Andreas Seltenreich
@ 2006-03-26 20:01 ` Andreas Seltenreich
  2006-03-27  9:43   ` Simon Josefsson
  2006-03-27  9:40 ` Simon Josefsson
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Seltenreich @ 2006-03-26 20:01 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 478 bytes --]

Andreas Seltenreich schrob:

> X-Hashcash: 1:24:060326:ding@gnus.org::S1H1LHoTY/UosfJN:0000ymPT
> X-Hashcash: 1:24:060326:ding@gnus.org::bZhXJcbr0RqrGqAV:00008EL9

Apparently, the hashcash code is also run on temporary buffers during
resending. Is binding message-generate-hashcash at those places an
acceptable solution?

regards,
andreas

2006-03-26  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>

	* message.el (message-resend): Bind message-generate-hashcash to
	to nil.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: message.el.patch --]
[-- Type: text/x-patch, Size: 878 bytes --]

Index: message.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v
retrieving revision 7.135
diff -c -r7.135 message.el
*** message.el	15 Mar 2006 18:03:48 -0000	7.135
--- message.el	26 Mar 2006 19:57:40 -0000
***************
*** 6507,6512 ****
--- 6507,6513 ----
  	(set-buffer (get-buffer-create " *message resend*"))
  	(erase-buffer))
        (let ((message-this-is-mail t)
+ 	    message-generate-hashcash
  	    message-setup-hook)
  	(message-setup `((To . ,address))))
        ;; Insert our usual headers.
***************
*** 6544,6549 ****
--- 6545,6551 ----
        ;; Send it.
        (let ((message-inhibit-body-encoding t)
  	    message-required-mail-headers
+ 	    message-generate-hashcash
  	    rfc2047-encode-encoded-words)
  	(message-send-mail))
        (kill-buffer (current-buffer)))

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: hashcash: duplicate payments
  2006-03-26 17:53 hashcash: duplicate payments Andreas Seltenreich
  2006-03-26 20:01 ` Andreas Seltenreich
@ 2006-03-27  9:40 ` Simon Josefsson
  1 sibling, 0 replies; 6+ messages in thread
From: Simon Josefsson @ 2006-03-27  9:40 UTC (permalink / raw)
  Cc: ding

Andreas Seltenreich <andreas+ding@gate450.dyndns.org> writes:

> Hi,
>
> I just noticed that mail-add-payment (called from message-send-message)
> doesn't recognise asynchronously generated payments for addresses that
> contain uppercase characters. Attached is a patch that makes the test
> case-insensitive.
>
> An alternative solution would be to supply the "-C" option to the
> external hashcash program, but IMHO this would unnecessarily restrict
> the user in his customisation needs (hashcash-extra-generate-parameters).
>
> Thanks,
> andreas
>
> 2006-03-26  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>
>
> 	* hashcash.el (hashcash-already-paid-p): Bind case-fold-search
> 	when searching for already-paid recipients.

Applied, thanks!

> Index: hashcash.el
> ===================================================================
> RCS file: /usr/local/cvsroot/gnus/lisp/hashcash.el,v
> retrieving revision 7.14
> diff -c -r7.14 hashcash.el
> *** hashcash.el	6 Jul 2005 06:42:01 -0000	7.14
> --- hashcash.el	26 Mar 2006 16:49:17 -0000
> ***************
> *** 210,216 ****
>     (save-excursion
>       (save-restriction
>         (message-narrow-to-headers-or-head)
> !       (let ((token (message-fetch-field "x-hashcash")))
>   	(and (stringp token)
>   	     (string-match (regexp-quote recipient) token))))))
>   
> --- 210,217 ----
>     (save-excursion
>       (save-restriction
>         (message-narrow-to-headers-or-head)
> !       (let ((token (message-fetch-field "x-hashcash"))
> ! 	    (case-fold-search t))
>   	(and (stringp token)
>   	     (string-match (regexp-quote recipient) token))))))
>   



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: hashcash: duplicate payments
  2006-03-26 20:01 ` Andreas Seltenreich
@ 2006-03-27  9:43   ` Simon Josefsson
  2006-03-29  4:16     ` Andreas Seltenreich
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Josefsson @ 2006-03-27  9:43 UTC (permalink / raw)
  Cc: ding

Andreas Seltenreich <andreas+ding@gate450.dyndns.org> writes:

> Andreas Seltenreich schrob:
>
>> X-Hashcash: 1:24:060326:ding@gnus.org::S1H1LHoTY/UosfJN:0000ymPT
>> X-Hashcash: 1:24:060326:ding@gnus.org::bZhXJcbr0RqrGqAV:00008EL9
>
> Apparently, the hashcash code is also run on temporary buffers during
> resending. Is binding message-generate-hashcash at those places an
> acceptable solution?

It seems slightly out of place, but I can't think of a better
solution, so I installed it.  Thanks!

> regards,
> andreas
>
> 2006-03-26  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>
>
> 	* message.el (message-resend): Bind message-generate-hashcash to
> 	to nil.
>
> Index: message.el
> ===================================================================
> RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v
> retrieving revision 7.135
> diff -c -r7.135 message.el
> *** message.el	15 Mar 2006 18:03:48 -0000	7.135
> --- message.el	26 Mar 2006 19:57:40 -0000
> ***************
> *** 6507,6512 ****
> --- 6507,6513 ----
>   	(set-buffer (get-buffer-create " *message resend*"))
>   	(erase-buffer))
>         (let ((message-this-is-mail t)
> + 	    message-generate-hashcash
>   	    message-setup-hook)
>   	(message-setup `((To . ,address))))
>         ;; Insert our usual headers.
> ***************
> *** 6544,6549 ****
> --- 6545,6551 ----
>         ;; Send it.
>         (let ((message-inhibit-body-encoding t)
>   	    message-required-mail-headers
> + 	    message-generate-hashcash
>   	    rfc2047-encode-encoded-words)
>   	(message-send-mail))
>         (kill-buffer (current-buffer)))



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: hashcash: duplicate payments
  2006-03-27  9:43   ` Simon Josefsson
@ 2006-03-29  4:16     ` Andreas Seltenreich
  2006-03-29  7:49       ` Simon Josefsson
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Seltenreich @ 2006-03-29  4:16 UTC (permalink / raw)
  Cc: ding

Simon Josefsson schrob:

> Andreas Seltenreich <andreas+ding@gate450.dyndns.org> writes:
>
>> Apparently, the hashcash code is also run on temporary buffers during
>> resending. Is binding message-generate-hashcash at those places an
>> acceptable solution?
>
> It seems slightly out of place, but I can't think of a better
> solution, so I installed it.

Yeah, I had an uneasy feeling when I first saw that the hashcash stuff
was hardcoded into message.el, too.  And it went even uneasier now
that I realised that the draft code also uses scratch message buffers.

It does bind the message hooks to nil when it does this, as does the
resend code.  So I'm wondering if it wouldn't be more appropriate to
resort to using hooks for hashcash.el, which would IMHO result in a
more deterministic behaviour.

regards,
andreas



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: hashcash: duplicate payments
  2006-03-29  4:16     ` Andreas Seltenreich
@ 2006-03-29  7:49       ` Simon Josefsson
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Josefsson @ 2006-03-29  7:49 UTC (permalink / raw)
  Cc: ding

Andreas Seltenreich <andreas+ding@gate450.dyndns.org> writes:

> Simon Josefsson schrob:
>
>> Andreas Seltenreich <andreas+ding@gate450.dyndns.org> writes:
>>
>>> Apparently, the hashcash code is also run on temporary buffers during
>>> resending. Is binding message-generate-hashcash at those places an
>>> acceptable solution?
>>
>> It seems slightly out of place, but I can't think of a better
>> solution, so I installed it.
>
> Yeah, I had an uneasy feeling when I first saw that the hashcash stuff
> was hardcoded into message.el, too.  And it went even uneasier now
> that I realised that the draft code also uses scratch message buffers.
>
> It does bind the message hooks to nil when it does this, as does the
> resend code.  So I'm wondering if it wouldn't be more appropriate to
> resort to using hooks for hashcash.el, which would IMHO result in a
> more deterministic behaviour.

That seems better, yes.  Would you like to work on it?



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-03-29  7:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-26 17:53 hashcash: duplicate payments Andreas Seltenreich
2006-03-26 20:01 ` Andreas Seltenreich
2006-03-27  9:43   ` Simon Josefsson
2006-03-29  4:16     ` Andreas Seltenreich
2006-03-29  7:49       ` Simon Josefsson
2006-03-27  9:40 ` Simon Josefsson

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).