(spam-stat-strip-xref): New function.
authorJesper Harder <harder@ifa.au.dk>
Thu, 22 Jan 2004 06:36:40 +0000 (06:36 +0000)
committerJesper Harder <harder@ifa.au.dk>
Thu, 22 Jan 2004 06:36:40 +0000 (06:36 +0000)
(spam-stat-process-directory): Use it.

lisp/ChangeLog
lisp/spam-stat.el

index 1a7acc6..2b35e2a 100644 (file)
@@ -1,5 +1,8 @@
 2004-01-22  Jesper Harder  <harder@ifa.au.dk>
 
+       * spam-stat.el (spam-stat-strip-xref): New function.
+       (spam-stat-process-directory): Use it.
+
        * gnus-util.el (gnus-fetch-field): Don't bind case-fold-search
        here -- it's done in message-fetch-field.
 
index 3602a69..b7b7cd2 100644 (file)
 \f
 
 ;;; Code:
+(require 'mail-parse)
 
 (defgroup spam-stat nil
   "Statistical spam detection for Emacs.
@@ -471,6 +472,13 @@ check the variable `spam-stat-score-data'."
 
 ;; Testing
 
+(defun spam-stat-strip-xref ()
+  "Strip the the Xref header."
+  (save-restriction
+    (mail-narrow-to-head)
+    (when (re-search-forward "^Xref:.*\n" nil t)
+      (delete-region (match-beginning 0) (match-end 0)))))
+
 (defun spam-stat-process-directory (dir func)
   "Process all the regular files in directory DIR using function FUNC."
   (let* ((files (directory-files dir t "^[^.]"))
@@ -484,6 +492,7 @@ check the variable `spam-stat-score-data'."
          (setq count (1+ count))
          (message "Reading %s: %.2f%%" dir (/ count max))
          (insert-file-contents f)
+         (spam-stat-strip-xref)
          (funcall func)
          (erase-buffer))))))