(spam-bogofilter-score): check bogofilter headers before
[gnus] / lisp / spam.el
index d4c8627..e39524b 100644 (file)
@@ -473,8 +473,8 @@ your main source of newsgroup names."
     (when (stringp group)              ; this routine will do nothing
                                        ; without a valid group
       (dolist (article articles)
-       (when (spam-group-spam-mark-p gnus-newsgroup-name
-                                     (gnus-summary-article-mark article))
+       (when (spam-group-ham-mark-p gnus-newsgroup-name
+                                    (gnus-summary-article-mark article))
          (push article tomove)))
 
       ;; now do the actual move
@@ -495,7 +495,7 @@ your main source of newsgroup names."
     (while articles
       (setq article (pop articles)
            mark (gnus-summary-article-mark article))
-      (cond ((spam-group-spam-mark-p nus-newsgroup-name mark) 
+      (cond ((spam-group-spam-mark-p gnus-newsgroup-name mark) 
             (push article spam-articles))
            ((memq article gnus-newsgroup-saved))
            ((spam-group-ham-mark-p gnus-newsgroup-name mark)
@@ -595,25 +595,26 @@ example like this: (: spam-split)
 
 See the Info node `(gnus)Fancy Mail Splitting' for more details."
   (interactive)
-
-  (dolist (check spam-list-of-statistical-checks)
-    (when (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 (symbol-value (car pair))
-         (gnus-message 5 "spam-split: calling the %s function" (symbol-name (cdr pair)))
-         (setq decision (funcall (cdr pair))))))
-    (if (eq decision t)
-       nil
-      decision)))
-
+  (save-excursion
+    (save-restriction
+      (dolist (check spam-list-of-statistical-checks)
+       (when (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 (symbol-value (car pair))
+             (gnus-message 5 "spam-split: calling the %s function" (symbol-name (cdr pair)))
+             (setq decision (funcall (cdr pair))))))
+       (if (eq decision t)
+           nil
+         decision)))))
+  
 (defun spam-setup-widening ()
   (dolist (check spam-list-of-statistical-checks)
     (when (symbol-value check)
@@ -979,7 +980,8 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
   (save-window-excursion
     (gnus-summary-show-article t)
     (set-buffer gnus-article-buffer)
-    (let ((score (spam-check-bogofilter t)))
+    (let ((score (or (spam-check-bogofilter-headers t)
+                    (spam-check-bogofilter t))))
       (message "Spamicity score %s" score)
       (or score "0"))))