(spam-setup-widening): new function to set
authorTeodor Zlatanov <tzz@lifelogs.com>
Fri, 28 Feb 2003 21:33:47 +0000 (21:33 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Fri, 28 Feb 2003 21:33:47 +0000 (21:33 +0000)
nnimap-split-download-body, we add it to gnus-get-new-news-hook
(spam-list-of-statistical-checks): list of statistical splitter
checks
(spam-split): added a widen call when a statistical check is
enabled

lisp/ChangeLog
lisp/spam.el

index 1825d1c..4f2ddb5 100644 (file)
@@ -1,3 +1,12 @@
+2003-02-28  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam.el (spam-setup-widening): new function to set
+       nnimap-split-download-body, we add it to gnus-get-new-news-hook
+       (spam-list-of-statistical-checks): list of statistical splitter
+       checks
+       (spam-split): added a widen call when a statistical check is
+       enabled
+
 2003-02-28  Reiner Steib  <Reiner.Steib@gmx.de>
 
        * gnus-msg.el (gnus-user-agent): Changed default to
index aa46c67..338183f 100644 (file)
@@ -562,6 +562,11 @@ should go, and further checks are also inhibited.  The usual mailgroup
 name is the value of `spam-split-group', meaning that the message is
 definitely a spam.")
 
+(defvar spam-list-of-statistical-checks
+  '(spam-use-ifile spam-use-stat spam-use-bogofilter)
+"The spam-list-of-statistical-checks list contains all the mail
+splitters that need to have the full message body available.")
+
 (defun spam-split ()
   "Split this message into the `spam' group if it is spam.
 This function can be used as an entry in `nnmail-split-fancy', for
@@ -569,7 +574,14 @@ 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))
@@ -580,6 +592,15 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
     (if (eq decision t)
        nil
       decision)))
+
+(defun spam-setup-widening ()
+  (dolist (check spam-list-of-statistical-checks)
+    (when (symbol-value check)
+      (setq nnimap-split-download-body t)
+      (return))))
+
+(add-hook 'gnus-get-new-news-hook 'spam-setup-widening)
+
 \f
 ;;;; Regex headers