From: yamaoka Date: Tue, 25 Jun 2002 23:50:31 +0000 (+0000) Subject: Synch with Oort Gnus (the node `Pay Hashcash' in gnus-ja.texi has not been X-Git-Tag: t-gnus-6_15_8-00-quimby~47 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=c89e237c21430bccf34d8c3ca85dffcb6a9ef720;p=elisp%2Fgnus.git- Synch with Oort Gnus (the node `Pay Hashcash' in gnus-ja.texi has not been translated yet). --- diff --git a/contrib/ChangeLog b/contrib/ChangeLog index b31b39b..124ce41 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,17 @@ +2002-06-22 Simon Josefsson + + * hashcash.el: New file. + (hashcash-default-payment, hashcash-payment-alist, hashcash): + Defcustom. + (hashcash-generate-payment): Update to recent hashcode command + line syntax. + (hashcash-insert-payment): Use X-Hashcode:. + (mail-add-payment): Also look at Newsgroups. + (top-level): Add provide and EOF comment. + (mail-add-payment): Autoload. + (hashcash-insert-payment): s/Hashcode/Hashcash/ + (mail-add-payment): Doc fix. + 2002-05-20 Lars Magne Ingebrigtsen * gnus-mdrtn.el (gnus-moderated-groups): Removed (require 'gnus-load). diff --git a/contrib/hashcash.el b/contrib/hashcash.el new file mode 100644 index 0000000..893211a --- /dev/null +++ b/contrib/hashcash.el @@ -0,0 +1,115 @@ +;;; hashcash.el --- Add hashcash payments to email + +;; $Revision: 1.1.2.1 $ +;; Copyright (C) 1997,2001 Paul E. Foley + +;; Maintainer: Paul Foley +;; Keywords: mail, hashcash + +;; Released under the GNU General Public License + +;;; Commentary: + +;; The hashcash binary is at http://www.cypherspace.org/hashcash/ +;; +;; Call mail-add-payment to add a hashcash payment to a mail message +;; in the current buffer. +;; +;; To automatically add payments to all outgoing mail: +;; (add-hook 'message-send-hook 'mail-add-payment) + +;;; Code: + +(defcustom hashcash-default-payment 0 + "*The default number of bits to pay to unknown users. +If this is zero, no payment header will be generated. +See `hashcash-payment-alist'." + :type 'integer) + +(defcustom hashcash-payment-alist nil + "*An association list mapping email addresses to payment amounts. +Elements may consist of (ADDR AMOUNT) or (ADDR STRING AMOUNT), where +ADDR is the email address of the intended recipient and AMOUNT is +the value of hashcash payment to be made to that user. STRING, if +present, is the string to be hashed; if not present ADDR will be used.") + +(defcustom hashcash "hashcash" + "*The path to the hashcash binary.") + +(require 'mail-utils) + +(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))) + 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)) + hashcash-default-payment))) + +(defun hashcash-payment-to (addr) + "Return the string with which hashcash payments should collide." + (let ((val (assoc addr hashcash-payment-alist))) + (if val + (if (cddr val) + (cadr val) + (car val)) + addr))) + +(defun hashcash-generate-payment (str val) + "Generate a hashcash payment by finding a VAL-bit collison on STR." + (if (> val 0) + (save-excursion + (set-buffer (get-buffer-create " *hashcash*")) + (erase-buffer) + (call-process hashcash nil t nil (concat "-b " (number-to-string val)) + str) + (goto-char (point-min)) + (buffer-substring (point-at-bol) (point-at-eol))) + nil)) + +(defun hashcash-insert-payment (arg) + "Insert an X-Hashcash header with a payment for ARG" + (interactive "sPay to: ") + (let ((pay (hashcash-generate-payment (hashcash-payment-to arg) + (hashcash-payment-required arg)))) + (when pay + (insert-before-markers "X-Hashcash: " pay "\n")))) + +;;;###autoload +(defun mail-add-payment (&optional arg) + "Add an X-Hashcash: header with a hashcash payment for each recipient address +Prefix arg sets default payment temporarily." + (interactive "P") + (let ((hashcash-default-payment (if arg (prefix-numeric-value arg) + hashcash-default-payment)) + (addrlist nil)) + (save-excursion + (save-restriction + (goto-char (point-min)) + (search-forward mail-header-separator) + (beginning-of-line) + (narrow-to-region (point-min) (point)) + (let ((to (hashcash-strip-quoted-names (mail-fetch-field "To" nil t))) + (cc (hashcash-strip-quoted-names (mail-fetch-field "Cc" nil t))) + (ng (hashcash-strip-quoted-names + (mail-fetch-field "Newsgroups" nil t)))) + (when to + (setq addrlist (split-string to ",[ \t\n]*"))) + (when cc + (setq addrlist (nconc addrlist (split-string cc ",[ \t\n]*")))) + (when ng + (setq addrlist (nconc addrlist (split-string ng ",[ \t\n]*"))))) + (when addrlist + (mapc #'hashcash-insert-payment addrlist))))) + t) + +(provide 'hashcash) + +;;; hashcash.el ends here diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e494477..65bc8b6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,23 @@ +2002-06-24 Kai Gro,b_(Bjohann + + * message.el (message-font-lock-keywords): Put colon in header + name match. + +2002-06-22 Kai Gro,b_(Bjohann + + * message.el (message-font-lock-keywords): Don't use header faces + in the body. Thanks to Stefan Monnier for the hint on the + implementation. + +2002-05-09 Miles Bader + + * gnus-cite.el (gnus-cite-blank-line-after-header): New variable. + (gnus-article-hide-citation): Respect it. + +2002-04-12 Juanma Barranquero + + * pop3.el (pop3-open-server): Fix typo. + 2002-06-18 Josh Huber * gnus.el (gnus-find-subscribed-addresses): Use add-to-list diff --git a/lisp/gnus-cite.el b/lisp/gnus-cite.el index 65ce313..927abba 100644 --- a/lisp/gnus-cite.el +++ b/lisp/gnus-cite.el @@ -1,6 +1,6 @@ ;;; gnus-cite.el --- parse citations in articles for Gnus -;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001 +;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 ;; Free Software Foundation, Inc. ;; Author: Per Abhiddenware @@ -260,6 +260,11 @@ This should make it easier to see who wrote what." :group 'gnus-cite :type 'integer) +(defcustom gnus-cite-blank-line-after-header t + "If non-nil, put a blank line between the citation header and the button." + :group 'gnus-cite + :type 'boolean) + ;;; Internal Variables: (defvar gnus-cite-article nil) @@ -519,7 +524,8 @@ always hide." end (set-marker (make-marker) end)) (gnus-add-text-properties-when 'article-type nil beg end props) (goto-char beg) - (unless (save-excursion (search-backward "\n\n" nil t)) + (when (and gnus-cite-blank-line-after-header + (not (save-excursion (search-backward "\n\n" nil t)))) (insert "\n")) (put-text-property (setq start (point-marker)) diff --git a/lisp/message.el b/lisp/message.el index 0f54a4e..2528999 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -1170,26 +1170,27 @@ candidates: (defvar message-font-lock-keywords (let ((content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?")) `((,(concat "^\\([Tt]o:\\)" content) - (1 'message-header-name-face) - (2 'message-header-to-face nil t)) + (1 (if (message-point-in-header-p) 'message-header-name-face)) + (2 (if (message-point-in-header-p) 'message-header-to-face) nil t)) (,(concat "^\\([GBF]?[Cc][Cc]:\\|[Rr]eply-[Tt]o:\\|" "[Mm]ail-[Cc]opies-[Tt]o:\\|" "[Mm]ail-[Rr]eply-[Tt]o:\\|" "[Mm]ail-[Ff]ollowup-[Tt]o:\\)" content) - (1 'message-header-name-face) - (2 'message-header-cc-face nil t)) + (1 (if (message-point-in-header-p) 'message-header-name-face)) + (2 (if (message-point-in-header-p) 'message-header-cc-face) nil t)) (,(concat "^\\([Ss]ubject:\\)" content) - (1 'message-header-name-face) - (2 'message-header-subject-face nil t)) + (1 (if (message-point-in-header-p) 'message-header-name-face)) + (2 (if (message-point-in-header-p) 'message-header-subject-face) nil t)) (,(concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content) - (1 'message-header-name-face) - (2 'message-header-newsgroups-face nil t)) + (1 (if (message-point-in-header-p) 'message-header-name-face)) + (2 (if (message-point-in-header-p) 'message-header-newsgroups-face) + nil t)) (,(concat "^\\([A-Z][^: \n\t]+:\\)" content) - (1 'message-header-name-face) - (2 'message-header-other-face nil t)) + (1 (if (message-point-in-header-p) 'message-header-name-face)) + (2 (if (message-point-in-header-p) 'message-header-other-face) nil t)) (,(concat "^\\(X-[A-Za-z0-9-]+\\|In-Reply-To\\):" content) - (1 'message-header-name-face) - (2 'message-header-name-face)) + (1 (if (message-point-in-header-p) 'message-header-name-face)) + (2 (if (message-point-in-header-p) 'message-header-name-face))) ,@(if (and mail-header-separator (not (equal mail-header-separator ""))) `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$") diff --git a/texi/ChangeLog b/texi/ChangeLog index a29f48f..f856348 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,12 @@ +2002-06-25 Kai Gro,b_(Bjohann + + * gnus.texi (Fancy Mail Splitting): Include all necessary + variables in the Lisp example. + +2002-06-22 Simon Josefsson + + * gnus.texi (Pay Hashcash): Add. + 2002-06-03 Simon Josefsson * gnus.texi (Splitting Mail): Add. diff --git a/texi/gnus-ja.texi b/texi/gnus-ja.texi index 8240292..49fd7b0 100644 --- a/texi/gnus-ja.texi +++ b/texi/gnus-ja.texi @@ -935,6 +935,7 @@ Various * Image Enhancements:: $B:G?7$N(B Emacs/XEmacs $B$O3($rI=<($G$-$k(B * Fuzzy Matching:: $BBg$-$JLJLS$C$F2?(B? * Thwarting Email Spam:: $BM>7W$J>&6HE*EE;R%a!<%k$rHr$1$kJ}K!(B +* Pay Hashcash:: CPU $B;~4V$rHq$d$7$F(B spam $BB`<#$9$k(B * Various Various:: $BK\Ev$K$$$m$$$m$J$b$N(B Formatting Variables @@ -12613,7 +12614,9 @@ table) $B$K=>$C$F40A4$K9gCW$7$J$1$l$P$J$j$^$;$s!#@55,I=8=$G%U%#!<%k%IL>$+(B $B$i(B @code{nnmail-split-fancy-with-parent} $B$r;H$C$F$_$F$/$@$5$$!#%3%m%s$r(B $B;H$C$F$3$s$JIw$K=q$-$^$9(B: @lisp -(setq nnmail-split-fancy +(setq nnmail-treat-duplicates 'warn ; $B$^$?$O(B 'delete + nnmail-cache-accepted-message-ids t + nnmail-split-fancy '(| (: nnmail-split-fancy-with-parent) ;; $B;D$j$N?6$jJ,$1J}$O$3$3$K=q$/(B )) @@ -18456,6 +18459,7 @@ Gnus $B$O0lF|$K0l2s%9%3%"$rIeGT$5$;$h$&$H$7$^$9!#Nc$($P!"$b$7(B gnus $B$r;MF| * Image Enhancements:: $B:G?7$N(B Emacs/XEmacs $B$O3($rI=<($G$-$k(B * Fuzzy Matching:: $BBg$-$JLJLS$C$F2?(B? * Thwarting Email Spam:: $BM>7W$J>&6HE*EE;R%a!<%k$rHr$1$kJ}K!(B +* Pay Hashcash:: CPU $B;~4V$rHq$d$7$F(B spam $BB`<#$9$k(B * Various Various:: $BK\Ev$K$$$m$$$m$J$b$N(B @end menu @@ -20258,6 +20262,67 @@ Gnus $B$O!"%9%3%"IU$1!"%9%l%C%I$N7A@.!"%9%l%C%IHf3S$J$I$r9T$&$H$-$K!"(B $B$3$H$OA4$/$"$j$^$;$s!#F@!9>uBV$G$9!#;d$N0U8+$H$7$F$O!"(B@code{From} $B%X%C%@!<(B $B$K56B$$7$FB8:_$7$J$$%I%a%$%s$KAw$i$;$k$N$O%-%?%J%$$G$9!#(B +@node Pay Hashcash +@section Pay Hashcash +@cindex hashcash +@cindex spam + +A novel technique to fight spam is to require senders to do something +costly for each message they send. This has the obvious drawback that +you cannot rely on that everyone uses this technique, since it is +optional, but it may be useful in smaller communities. + +@cindex X-Hashcash +The ``something costly'' is to burn CPU time, more specifically to +compute a hash collision up to a certain number of bits. The +resulting hashcash cookie is inserted in a @samp{X-Hashcash:} +header. For more details, and for the external application +@code{hashcash} you need to install to use this feature, see +@uref{http://www.cypherspace.org/~adam/hashcash/}. Even more +information can be found at @uref{http://www.camram.org/}. + +If you wish to call hashcash for each message you send, say something +like: + +@lisp +(require 'hashcash) +(add-hook 'message-send-hook 'mail-add-payment) +@end lisp + +The @code{hashcash.el} library can be found at +@uref{http://users.actrix.gen.nz/mycroft/hashcash.el}, or in the Gnus +development contrib directory. + +You will need to set up some additional variables as well: + +@table @code + +@item hashcash-default-payment +@vindex hashcash-default-payment +This variable indicates the default number of bits the hash collision +should consist of. By default this is 0, meaning nothing will be +done. Suggested useful values include 17 to 29. + +@item hashcash-payment-alist +@vindex hashcash-payment-alist +Some receivers may require you to spend burn more CPU time than the +default. This variable contains a list of @samp{(ADDR AMOUNT)} cells, +where ADDR is the receiver (email address or newsgroup) and AMOUNT is +the number of bits in the collision that is needed. It can also +contain @samp{(ADDR STRING AMOUNT)} cells, where the STRING is the +string to use (normally the email address or newsgroup name is used). + +@item hashcash +@vindex hashcash +Where the @code{hashcash} binary is installed. + +@end table + +Currently there is no built in functionality in Gnus to verify +hashcash cookies, it is expected that this is performed by your hand +customized mail filtering scripts. Improvements in this area would be +a useful contribution, however. + @node Various Various @section $B$$$m$$$m$N$$$m$$$m(B @cindex mode lines diff --git a/texi/gnus.texi b/texi/gnus.texi index fe131c4..0ce0f67 100644 --- a/texi/gnus.texi +++ b/texi/gnus.texi @@ -819,6 +819,7 @@ Various * Image Enhancements:: Modern versions of Emacs/XEmacs can display images. * Fuzzy Matching:: What's the big fuzz? * Thwarting Email Spam:: A how-to on avoiding unsolicited commercial email. +* Pay Hashcash:: Reduce spam by burning CPU time. * Various Various:: Things that are really various. Formatting Variables @@ -13191,7 +13192,9 @@ To use this feature, you have to set @code{nnmail-treat-duplicates} and you can include @code{nnmail-split-fancy-with-parent} using the colon feature, like so: @lisp -(setq nnmail-split-fancy +(setq nnmail-treat-duplicates 'warn ; or 'delete + nnmail-cache-accepted-message-ids t + nnmail-split-fancy '(| (: nnmail-split-fancy-with-parent) ;; other splits go here )) @@ -18817,6 +18820,7 @@ four days, Gnus will decay the scores four times, for instance. * Image Enhancements:: Modern versions of Emacs/XEmacs can display images. * Fuzzy Matching:: What's the big fuzz? * Thwarting Email Spam:: A how-to on avoiding unsolicited commercial email. +* Pay Hashcash:: Reduce spam by burning CPU time. * Various Various:: Things that are really various. @end menu @@ -20703,6 +20707,68 @@ spam. It's a win-win situation. Forging @code{From} headers to point to non-existent domains is yucky, in my opinion. + +@node Pay Hashcash +@section Pay Hashcash +@cindex hashcash +@cindex spam + +A novel technique to fight spam is to require senders to do something +costly for each message they send. This has the obvious drawback that +you cannot rely on that everyone uses this technique, since it is +optional, but it may be useful in smaller communities. + +@cindex X-Hashcash +The ``something costly'' is to burn CPU time, more specifically to +compute a hash collision up to a certain number of bits. The +resulting hashcash cookie is inserted in a @samp{X-Hashcash:} +header. For more details, and for the external application +@code{hashcash} you need to install to use this feature, see +@uref{http://www.cypherspace.org/~adam/hashcash/}. Even more +information can be found at @uref{http://www.camram.org/}. + +If you wish to call hashcash for each message you send, say something +like: + +@lisp +(require 'hashcash) +(add-hook 'message-send-hook 'mail-add-payment) +@end lisp + +The @code{hashcash.el} library can be found at +@uref{http://users.actrix.gen.nz/mycroft/hashcash.el}, or in the Gnus +development contrib directory. + +You will need to set up some additional variables as well: + +@table @code + +@item hashcash-default-payment +@vindex hashcash-default-payment +This variable indicates the default number of bits the hash collision +should consist of. By default this is 0, meaning nothing will be +done. Suggested useful values include 17 to 29. + +@item hashcash-payment-alist +@vindex hashcash-payment-alist +Some receivers may require you to spend burn more CPU time than the +default. This variable contains a list of @samp{(ADDR AMOUNT)} cells, +where ADDR is the receiver (email address or newsgroup) and AMOUNT is +the number of bits in the collision that is needed. It can also +contain @samp{(ADDR STRING AMOUNT)} cells, where the STRING is the +string to use (normally the email address or newsgroup name is used). + +@item hashcash +@vindex hashcash +Where the @code{hashcash} binary is installed. + +@end table + +Currently there is no built in functionality in Gnus to verify +hashcash cookies, it is expected that this is performed by your hand +customized mail filtering scripts. Improvements in this area would be +a useful contribution, however. + @node Various Various @section Various Various @cindex mode lines