Synch with Oort Gnus.
authoryamaoka <yamaoka>
Thu, 16 Jan 2003 00:12:48 +0000 (00:12 +0000)
committeryamaoka <yamaoka>
Thu, 16 Jan 2003 00:12:48 +0000 (00:12 +0000)
lisp/spam.el

index 6517cf8..a3a13f6 100644 (file)
@@ -226,11 +226,9 @@ your main source of newsgroup names."
 ;;; Key bindings for spam control.
 
 (gnus-define-keys gnus-summary-mode-map
-;;; bogofilter scores don't work yet
-;;;  "St" spam-bogofilter-score
+  "St" spam-bogofilter-score
   "Sx" gnus-summary-mark-as-spam
-;;; bogofilter scores don't work yet
-;;;  "Mst" spam-bogofilter-score
+  "Mst" spam-bogofilter-score
   "Msx" gnus-summary-mark-as-spam
   "\M-d" gnus-summary-mark-as-spam)
 
@@ -765,18 +763,25 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
 \f
 ;;;; Bogofilter
 
-(defun spam-check-bogofilter-headers ()
+(defun spam-check-bogofilter-headers (&optional score)
   (let ((header (message-fetch-field spam-bogofilter-header)))
-      (if (and header
+      (when (and header
               (string-match "^Yes" header))
-         spam-split-group
-       nil)))
+         (if score
+             (when (string-match "spamicity=\\([0-9.]+\\)" header)
+               (match-string 1 header))
+           spam-split-group))))
          
 
-(defun spam-check-bogofilter ()
+;; return something sensible if the score can't be determined
+(defun spam-bogofilter-score ()
+  (or (spam-check-bogofilter t)
+      0))
+
+(defun spam-check-bogofilter (&optional score)
   "Check the Bogofilter backend for the classification of this message"
   (let ((article-buffer-name (buffer-name)) 
-       return bogorun)
+       return)
     (with-temp-buffer
       (let ((temp-buffer-name (buffer-name)))
        (save-excursion
@@ -788,8 +793,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)."
                                   "-d" spam-bogofilter-database-directory)
            (call-process-region (point-min) (point-max) spam-bogofilter-path
                                 nil temp-buffer-name nil "-v")))
-       (when (spam-check-bogofilter-headers)
-         (setq return spam-split-group))))
+       (setq return (spam-check-bogofilter-headers score))))
     return))
 
 (defun spam-bogofilter-register-with-bogofilter (article-string spam)