From: yamaoka Date: Sat, 8 Mar 2003 09:45:29 +0000 (+0000) Subject: Synch to Oort Gnus. X-Git-Tag: t-gnus-6_15_17-00-quimby~17 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=8a56f0a9a38a5c8f98c05c349f2da268144acf77;p=elisp%2Fgnus.git- Synch to Oort Gnus. --- diff --git a/contrib/ChangeLog b/contrib/ChangeLog index da6cafd..f10609a 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,15 @@ +2003-03-07 Simon Josefsson + + * gnus-idna.el (gnus-idna-to-ascii-rhs-1): Narrow to + head (otherwise forwarded mail break havoc). + +2003-03-07 Teodor Zlatanov + + * hashcash.el: New version from Paul Foley with better variable + names, executable-find support, and no errors in GNU Emacs + (hashcash-version): return nil when invoked with a + nil token + 2003-02-21 Simon Josefsson * hashcash.el (hashcash-point-at-bol): diff --git a/contrib/gnus-idna.el b/contrib/gnus-idna.el index e11d3a0..32eb2f8 100644 --- a/contrib/gnus-idna.el +++ b/contrib/gnus-idna.el @@ -68,24 +68,27 @@ (defun gnus-idna-to-ascii-rhs-1 (header) (save-excursion - (let (address header-data new-header-data rhs ace) - (setq header-data (message-fetch-field header)) - (when header-data - (dolist (element (message-tokenize-header header-data)) - (setq address (car (rfc822-addresses element))) - (when (string-match "\\(.*\\)@\\([^@]+\\)" address) - (setq ace (if (setq rhs (match-string 2 address)) - (idna-to-ascii rhs))) - (push (if (string= rhs ace) - element - (gnus-replace-in-string element (regexp-quote rhs) ace t)) - new-header-data))) - (message-remove-header header) - (message-position-on-field header) - (dolist (addr (reverse new-header-data)) - (insert addr ", ")) - (when new-header-data - (delete-backward-char 2)))))) + (save-restriction + (let (address header-data new-header-data rhs ace) + (message-narrow-to-head) + (setq header-data (message-fetch-field header)) + (when header-data + (dolist (element (message-tokenize-header header-data)) + (setq address (car (rfc822-addresses element))) + (when (string-match "\\(.*\\)@\\([^@]+\\)" address) + (setq ace (if (setq rhs (match-string 2 address)) + (idna-to-ascii rhs))) + (push (if (string= rhs ace) + element + (gnus-replace-in-string + element (regexp-quote rhs) ace t)) + new-header-data))) + (message-remove-header header) + (message-position-on-field header) + (dolist (addr (reverse new-header-data)) + (insert addr ", ")) + (when new-header-data + (delete-backward-char 2))))))) (defun gnus-idna-to-ascii-rhs () (gnus-idna-to-ascii-rhs-1 "From") diff --git a/contrib/hashcash.el b/contrib/hashcash.el index 8dbc769..7eef651 100644 --- a/contrib/hashcash.el +++ b/contrib/hashcash.el @@ -1,11 +1,13 @@ ;;; hashcash.el --- Add hashcash payments to email -;; Copyright (C) 1997,2001 Paul E. Foley +;; Copyright (C) 1997--2002 Paul E. Foley +;; Copyright (C) 2003 Free Software Foundation ;; Maintainer: Paul Foley ;; Keywords: mail, hashcash ;; Released under the GNU General Public License +;; (http://www.gnu.org/licenses/gpl.html) ;;; Commentary: @@ -21,6 +23,9 @@ (eval-when-compile (require 'cl)) +(eval-and-compile + (autoload 'executable-find "executable")) + (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. @@ -38,13 +43,13 @@ present, is the string to be hashed; if not present ADDR will be used.") "*The default minimum number of bits to accept on incoming payments." :type 'integer) -(defcustom hashcash-accept-resources `((,(user-mail-address) nil)) +(defcustom hashcash-accept-resources `((,user-mail-address nil)) "*An association list mapping hashcash resources to payment amounts. Resources named here are to be accepted in incoming payments. If the corresponding AMOUNT is NIL, the value of `hashcash-default-accept-payment' is used instead.") -(defcustom hashcash "/usr/local/bin/hashcash" +(defcustom hashcash-path (executable-find "hashcash") "*The path to the hashcash binary.") (defcustom hashcash-double-spend-database "hashcash.db" @@ -57,14 +62,14 @@ is used instead.") (require 'mail-utils) (defalias 'hashcash-point-at-bol - (if (fboundp 'point-at-bol) - 'point-at-bol - 'line-beginning-position)) + (if (fboundp 'point-at-bol) + 'point-at-bol + 'line-beginning-position)) (defalias 'hashcash-point-at-eol - (if (fboundp 'point-at-eol) - 'point-at-eol - 'line-end-position)) + (if (fboundp 'point-at-eol) + 'point-at-eol + 'line-end-position)) (defun hashcash-strip-quoted-names (addr) (setq addr (mail-strip-quoted-names addr)) @@ -97,34 +102,56 @@ is used instead.") (save-excursion (set-buffer (get-buffer-create " *hashcash*")) (erase-buffer) - (call-process hashcash nil t nil (concat "-b " (number-to-string val)) - str) + (call-process hashcash-path nil t nil + (concat "-b " (number-to-string val)) str) (goto-char (point-min)) (buffer-substring (hashcash-point-at-bol) (hashcash-point-at-eol))) nil)) (defun hashcash-check-payment (token str val) "Check the validity of a hashcash payment." - (zerop (call-process hashcash nil nil nil "-c" + (zerop (call-process hashcash-path nil nil nil "-c" "-d" "-f" hashcash-double-spend-database "-b" (number-to-string val) "-r" str token))) +(defun hashcash-version (token) + "Find the format version of a hashcash token." + ;; Version 1.2 looks like n:yymmdd:rrrrr:xxxxxxxxxxxxxxxx + ;; This carries its own version number embedded in the token, + ;; so no further format number changes should be necessary + ;; in the X-Payment header. + ;; + ;; Version 1.1 looks like yymmdd:rrrrr:xxxxxxxxxxxxxxxx + ;; You need to upgrade your hashcash binary. + ;; + ;; Version 1.0 looked like nnnnnrrrrrxxxxxxxxxxxxxxxx + ;; This is no longer supported. + (if token + (cond ((equal (aref token 1) ?:) 1.2) + ((equal (aref token 6) ?:) 1.1) + (t (error "Unknown hashcash format version"))) + nil)) + ;;;###autoload (defun hashcash-insert-payment (arg) "Insert X-Payment and X-Hashcash headers with a payment for ARG" (interactive "sPay to: ") - (let ((pay (hashcash-generate-payment (hashcash-payment-to arg) - (hashcash-payment-required arg)))) + (let* ((pay (hashcash-generate-payment (hashcash-payment-to arg) + (hashcash-payment-required arg))) + (version (hashcash-version pay))) (when pay - (insert-before-markers "X-Payment: hashcash 1.1 " pay "\n") + (insert-before-markers "X-Payment: hashcash " + (number-to-string version) " " pay "\n") (insert-before-markers "X-Hashcash: " pay "\n")))) ;;;###autoload (defun hashcash-verify-payment (token &optional resource amount) "Verify a hashcash payment" - (let ((key (cadr (split-string-by-char token ?:)))) + (let ((key (if (< (hashcash-version token) 1.2) + (cadr (split-string token ":")) + (caddr (split-string token ":"))))) (cond ((null resource) (let ((elt (assoc key hashcash-accept-resources))) (and elt (hashcash-check-payment token (car elt) @@ -170,17 +197,21 @@ for each recipient address. Prefix arg sets default payment temporarily." Prefix arg sets default accept amount temporarily." (interactive "P") (let ((hashcash-default-accept-payment (if arg (prefix-numeric-value arg) - hashcash-default-accept-payment))) + hashcash-default-accept-payment)) + (version (hashcash-version (hashcash-generate-payment "x" 1)))) (save-excursion (goto-char (point-min)) - (search-forward mail-header-separator) + (search-forward "\n\n") (beginning-of-line) (let ((end (point)) (ok nil)) (goto-char (point-min)) - (while (and (not ok) (search-forward "X-Payment: hashcash 1.1 " end t)) - (setq ok (hashcash-verify-payment - (buffer-substring (point) (hashcash-point-at-eol))))) + (while (and (not ok) (search-forward "X-Payment: hashcash " end t)) + (let ((value (split-string + (buffer-substring (point) (hashcash-point-at-eol)) + " "))) + (when (equal (car value) (number-to-string version)) + (setq ok (hashcash-verify-payment (cadr value)))))) (goto-char (point-min)) (while (and (not ok) (search-forward "X-Hashcash: " end t)) (setq ok (hashcash-verify-payment @@ -190,5 +221,3 @@ Prefix arg sets default accept amount temporarily." ok)))) (provide 'hashcash) - -;;; hashcash.el ends here diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7e261c6..35d8dbf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,27 @@ +2003-03-07 Teodor Zlatanov + + * spam.el: load nnimap.el when compiling + (spam-setup-widening): use + nnimap-split-download-body-default instead of + nnimap-split-download-body which is a user-customizable variable + + +2003-03-07 Simon Josefsson + + * nnimap.el (nnimap-split-download-body-default): New, holds + default for n-s-d-b. + (nnimap-split-download-body): Add new setting (symbol default), + which uses contents of n-s-d-b-d, and made it the default. + +2003-03-07 Teodor Zlatanov + + * spam.el (spam-use-hashcash): new variable + (spam-list-of-checks): added spam-use-hashcash with associated + spam-check-hashcash + (spam-check-hashcash): new function, installed iff hashcash.el is + loaded + (spam-setup-widening): don't use (return) + 2003-03-06 Kevin Greiner * gnus-agent.el (gnus-agent-fetch-group-1): Added default @@ -560,7 +584,7 @@ * mm-decode.el (mm-path-name-rewrite-functions): Doc fix: don't use "path name". -2003-02-21 Teodor Zlatanov +2003-02-21 Teodor Zlatanov * gnus-sum.el (gnus-summary-move-article) (gnus-summary-expire-articles): send data header for article, not @@ -695,7 +719,7 @@ * gnus-util.el (gnus-faces-at): Simplify. -2003-02-13 Teodor Zlatanov +2003-02-13 Teodor Zlatanov * spam.el (spam-ham-move-routine) (spam-mark-spam-as-expired-and-move-routine): made the article diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 48c1b55..0ae687c 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -198,13 +198,22 @@ RFC2060 section 6.4.4." :group 'nnimap :type 'sexp) -(defcustom nnimap-split-download-body nil +(defvar nnimap-split-download-body-default nil + "Internal variable with default value for `nnimap-split-download-body'.") + +(defcustom nnimap-split-download-body 'default "Whether to download entire articles during splitting. This is generally not required, and will slow things down considerably. You may need it if you want to use an advanced splitting function that -analyses the body before splitting the article." +analyses the body before splitting the article. +If this variable is nil, bodies will not be downloaded; if this +variable is the symbol `default' the default behaviour is +used (which currently is nil, unless you use a statistical +spam.el test); if this variable is another non-nil value bodies +will be downloaded." :group 'nnimap - :type 'boolean) + :type '(choice (const :tag "Let system decide" deault) + boolean)) ;; Performance / bug workaround variables diff --git a/lisp/spam.el b/lisp/spam.el index eccdea9..9b2f0ac 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -42,6 +42,9 @@ (require 'gnus) ; for the definitions of group content classification and spam processors (require 'message) ;for the message-fetch-field functions +;; for nnimap-split-download-body-default +(eval-when-compile (require 'nnimap)) + ;; autoload query-dig (eval-and-compile (autoload 'query-dig "dig")) @@ -109,6 +112,11 @@ are considered spam." :type 'boolean :group 'spam) +(defcustom spam-use-hashcash nil + "Whether hashcash payments should be detected by spam-split." + :type 'boolean + :group 'spam) + (defcustom spam-use-regex-headers nil "Whether a header regular expression match should be used by spam-split. Also see the variable `spam-spam-regex-headers' and `spam-ham-regex-headers'." @@ -555,6 +563,7 @@ your main source of newsgroup names." (spam-use-ifile . spam-check-ifile) (spam-use-stat . spam-check-stat) (spam-use-blackholes . spam-check-blackholes) + (spam-use-hashcash . spam-check-hashcash) (spam-use-bogofilter-headers . spam-check-bogofilter-headers) (spam-use-bogofilter . spam-check-bogofilter)) "The spam-list-of-checks list contains pairs associating a parameter @@ -603,8 +612,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (defun spam-setup-widening () (dolist (check spam-list-of-statistical-checks) (when (symbol-value check) - (setq nnimap-split-download-body t) - (return)))) + (setq nnimap-split-download-body-default t)))) (add-hook 'gnus-get-new-news-hook 'spam-setup-widening) @@ -667,6 +675,20 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (when matches spam-split-group))) +;;;; Hashcash. + +(condition-case nil + (progn + (require 'hashcash) + + (defun spam-check-hashcash () + "Check the headers for hashcash payments." + (mail-check-payment))) ;mail-check-payment returns a boolean + + (file-error (progn + (defalias 'mail-check-payment 'ignore) + (defalias 'spam-check-hashcash 'ignore)))) + ;;;; BBDB ;;; original idea for spam-check-BBDB from Alexander Kotelnikov diff --git a/texi/ChangeLog b/texi/ChangeLog index c1e66a1..4b6cb75 100644 --- a/texi/ChangeLog +++ b/texi/ChangeLog @@ -1,3 +1,7 @@ +2003-03-08 Jesper Harder + + * gnusref.tex: Update. + 2003-03-03 Reiner Steib * gnus.texi (Mail and Post): Updated `gnus-user-agent'. diff --git a/texi/gnusref.tex b/texi/gnusref.tex index abb47eb..208c8e4 100644 --- a/texi/gnusref.tex +++ b/texi/gnusref.tex @@ -586,9 +586,8 @@ W d & Treat {\bf dumbquotes}.\\ W e & Treat {\bf emphasized} text.\\ W h & Treat {\bf HTML}.\\ - W k & Deuglify broken Outlook (Express) articles and redisplay.\\ W l & (w) Remove page breaks ({\bf\^{}L}) from the article.\\ - W m & Toggle {\bf MIME} processing.\\ + W m & {\bf Morse} decode article.\\ W o & Treat {\bf overstrike} or underline (\^{}H\_) in the article.\\ W p & Verify X-{\bf PGP}-Sig header.\\ W q & Treat {\bf quoted}-printable in the article.\\ @@ -606,6 +605,11 @@ W G u & {\bf Unfold} folded header lines.\\ W G f & {\bf Fold} all header lines.\\ W G n & Unfold {\bf Newsgroups:} and Follow-Up-To:.\\ + % + W Y c & Repair broken {\bf citations}.\\ + W Y a & Repair broken {\bf attribution} lines.\\ + W Y u & {\bf Unwrap} broken citation lines.\\ + W Y f & Do a {\bf full} deuglification (W Y c, W Y a, W Y u).\\ \end{keys} } } @@ -632,6 +636,7 @@ \begin{keys}{W D D} W D s & (W g) Display {\bf smilies}.\\ W D x & (W f) Look for and display any X-{\bf Face} headers.\\ + W D d & Display any Face headers.\\ W D n & Toggle picons in {\bf Newsgroups} and Followup-To.\\ W D m & Toggle picons in {\bf mail} headers (To and Cc).\\ W D f & Toggle picons in {\bf From}.\\ @@ -668,9 +673,6 @@ W W c & Hide {\bf citation}.\\ W W C-c & Hide {\bf citation} using a more intelligent algorithm.\\ W W C & Hide cited text in articles that aren't roots.\\ - % - W e & {\bf Emphasize} article.\\ - % W H a & Highlight {\bf all} parts. Calls W b, W H c, W H h, W H s.\\ W H c & Highlight article {\bf citations}.\\ W H h & Highlight article {\bf headers}.\\ @@ -682,9 +684,9 @@ \newcommand{\MIMEArticleMode}{% {\esamepage - \begin{keys}{M-RET} + \begin{keys}{RET} RET & (BUTTON-2) Toggle display of the MIME object.\\ - v & (M-RET) Prompt for a method and then view object using this method.\\ + v & Prompt for a method and then view object using this method.\\ o & Prompt for a filename and save the MIME object.\\ C-o & Prompt for a filename to save the MIME object to and remove it.\\ c & {\bf Copy} the MIME object to a new buffer and display this buffer.\\