Synch to Gnus 200312102120.
authoryamaoka <yamaoka>
Wed, 10 Dec 2003 22:11:56 +0000 (22:11 +0000)
committeryamaoka <yamaoka>
Wed, 10 Dec 2003 22:11:56 +0000 (22:11 +0000)
lisp/ChangeLog
lisp/message.el
lisp/spam.el

index 87f2585..e08e58d 100644 (file)
@@ -1,3 +1,19 @@
+2003-12-10  Jesper Harder  <harder@ifa.au.dk>
+
+       * message.el (message-get-reply-headers): Narrow to headers.
+
+2003-12-10  Teodor Zlatanov  <tzz@lifelogs.com> 
+
+       * spam.el (spam-disable-spam-split-during-ham-respool): new
+       variable.  From lorentey@elte.hu (L\e,Bu\e(Brentey K\e,Ba\e(Broly)
+       (spam-ham-copy-or-move-routine): respect
+       spam-disable-spam-split-during-ham-respool.  From
+       lorentey@elte.hu (L\e,Bu\e(Brentey K\e,Ba\e(Broly)
+       (spam-split-disabled): new variable.  From
+       lorentey@elte.hu (L\e,Bu\e(Brentey K\e,Ba\e(Broly)
+       (spam-split): respect spam-split-disabled.  From
+       lorentey@elte.hu (L\e,Bu\e(Brentey K\e,Ba\e(Broly)
+
 2003-12-10  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * nnheaderxm.el (nnheader-xmas-run-at-time): Make it work
index 39831a6..02e3a24 100644 (file)
@@ -6219,20 +6219,22 @@ OTHER-HEADERS is an alist of header/value pairs."
 (defun message-get-reply-headers (wide &optional to-address address-headers)
   (let (follow-to mct never-mct to cc author mft recipients)
     ;; Find all relevant headers we need.
-    (let ((mrt (when message-use-mail-reply-to
-                (message-fetch-field "mail-reply-to")))
-         (reply-to (message-fetch-field "reply-to")))
-      (setq to (message-fetch-field "to")
-           cc (message-fetch-field "cc")
-           mct (when message-use-mail-copies-to
-                 (message-fetch-field "mail-copies-to"))
-           author (or mrt
-                      reply-to
-                      (message-fetch-field "from")
-                      "")
-           mft (when (and (not (or to-address mrt reply-to))
-                          message-use-mail-followup-to)
-                 (message-fetch-field "mail-followup-to"))))
+    (save-restriction
+      (message-narrow-to-headers-or-head)
+      (let ((mrt (when message-use-mail-reply-to
+                  (message-fetch-field "mail-reply-to")))
+           (reply-to (message-fetch-field "reply-to")))
+       (setq to (message-fetch-field "to")
+             cc (message-fetch-field "cc")
+             mct (when message-use-mail-copies-to
+                   (message-fetch-field "mail-copies-to"))
+             author (or mrt
+                        reply-to
+                        (message-fetch-field "from")
+                        "")
+             mft (when (and (not (or to-address mrt reply-to))
+                            message-use-mail-followup-to)
+                   (message-fetch-field "mail-followup-to")))))
 
     (save-match-data
       ;; Handle special values of Mail-Copies-To.
index 483fef3..a8c1bc6 100644 (file)
@@ -116,6 +116,15 @@ Competition."
   :type 'boolean
   :group 'spam)
 
+(defcustom spam-disable-spam-split-during-ham-respool nil
+  "Whether spam-split should be ignored while resplitting ham in
+a process destination.  This is useful to prevent ham from ending
+up in the same spam group after the resplit.  Don't set this to t
+if you have spam-split as the last rule in your split
+configuration."
+  :type 'boolean
+  :group 'spam)
+
 (defcustom spam-whitelist (expand-file-name "whitelist" spam-directory)
   "The location of the whitelist.
 The file format is one regular expression per line.
@@ -693,8 +702,11 @@ spam-use-* variable.")
            (gnus-summary-mark-article article gnus-unread-mark))
          (gnus-summary-set-process-mark article))
 
-       (if respool                ; respooling is with a "fake" group
-           (gnus-summary-respool-article nil respool-method)
+       (if respool                        ; respooling is with a "fake" group
+           (let ((spam-split-disabled
+                  (or spam-split-disabled
+                      spam-disable-spam-split-during-ham-respool)))
+             (gnus-summary-respool-article nil respool-method))
          (if (or (not backend-supports-deletions) ; else, we are not respooling
                  (> (length groups) 1))
              (progn                ; if copying, copy and set deletep
@@ -823,6 +835,9 @@ definitely a spam.")
   "The spam-list-of-statistical-checks list contains all the mail
 splitters that need to have the full message body available.")
 
+(defvar spam-split-disabled nil
+  "If non-nil, spam-split is disabled, and always returns nil.")
+
 ;;;TODO: modify to invoke self with each check if invoked without specifics
 (defun spam-split (&rest specific-checks)
   "Split this message into the `spam' group if it is spam.
@@ -833,35 +848,36 @@ spam-split-group to that string.
 
 See the Info node `(gnus)Fancy Mail Splitting' for more details."
   (interactive)
-  (let ((spam-split-group-choice spam-split-group))
-    (dolist (check specific-checks)
-      (when (stringp check)
-       (setq spam-split-group-choice check)
-       (setq specific-checks (delq check specific-checks))))
-
-    (let ((spam-split-group spam-split-group-choice))
-      (save-excursion
-       (save-restriction
-         (dolist (check spam-list-of-statistical-checks)
-           (when (and (symbolp check) (symbol-value check))
-             (widen)
-             (gnus-message 8 "spam-split: widening the buffer (%s requires it)"
-                           (symbol-name check))
-             (return)))
-         ;;   (progn (widen) (debug (buffer-string)))
-         (let ((list-of-checks spam-list-of-checks)
-               decision)
-           (while (and list-of-checks (not decision))
-             (let ((pair (pop list-of-checks)))
-               (when (and (symbol-value (car pair))
-                          (or (null specific-checks)
-                              (memq (car pair) specific-checks)))
-                 (gnus-message 5 "spam-split: calling the %s function" 
-                               (symbol-name (cdr pair)))
-                 (setq decision (funcall (cdr pair))))))
-           (if (eq decision t)
-               nil
-             decision)))))))
+  (unless spam-split-disabled
+    (let ((spam-split-group-choice spam-split-group))
+      (dolist (check specific-checks)
+       (when (stringp check)
+         (setq spam-split-group-choice check)
+         (setq specific-checks (delq check specific-checks))))
+      
+      (let ((spam-split-group spam-split-group-choice))
+       (save-excursion
+         (save-restriction
+           (dolist (check spam-list-of-statistical-checks)
+             (when (and (symbolp check) (symbol-value check))
+               (widen)
+               (gnus-message 8 "spam-split: widening the buffer (%s requires it)"
+                             (symbol-name check))
+               (return)))
+           ;;   (progn (widen) (debug (buffer-string)))
+           (let ((list-of-checks spam-list-of-checks)
+                 decision)
+             (while (and list-of-checks (not decision))
+               (let ((pair (pop list-of-checks)))
+                 (when (and (symbol-value (car pair))
+                            (or (null specific-checks)
+                                (memq (car pair) specific-checks)))
+                   (gnus-message 5 "spam-split: calling the %s function" 
+                                 (symbol-name (cdr pair)))
+                   (setq decision (funcall (cdr pair))))))
+             (if (eq decision t)
+                 nil
+               decision))))))))
 
 (defvar spam-registration-functions
   ;; first the ham register, second the spam register function