--- spam.el.orig Tue Apr 29 00:36:31 2003 +++ spam.el Tue May 6 16:22:39 2003 @@ -182,6 +182,11 @@ :type 'boolean :group 'spam) +(defcustom spam-use-spamoracle nil + "Whether spamoracle should be used by spam-split." + :type 'boolean + :group 'spam) + (defcustom spam-split-group "spam" "Group name where incoming spam should be put by spam-split." :type 'string @@ -290,6 +295,18 @@ (const :tag "Use the default")) :group 'spam-ifile) +(defcustom spam-spamoracle-database nil + "Location of spamoracle database file." + :type '(choice (directory :tag "Location of spamoracle database file.") + (cons :tag "Use the default")) + :group 'spam-spamoracle) + +(defcustom spam-spamoracle-binary "spamoracle" + "Location of the spamoracle binary." + :type '(choice (directory :tag "Location of the spamoracle binary") + (const :tag "Use the default")) + :group 'spam-spamoracle) + ;;; Key bindings for spam control. (gnus-define-keys gnus-summary-mode-map @@ -593,7 +610,8 @@ (spam-use-blackholes . spam-check-blackholes) (spam-use-hashcash . spam-check-hashcash) (spam-use-bogofilter-headers . spam-check-bogofilter-headers) - (spam-use-bogofilter . spam-check-bogofilter)) + (spam-use-bogofilter . spam-check-bogofilter) + (spam-use-spamoracle . spam-check-spamoracle)) "The spam-list-of-checks list contains pairs associating a parameter variable with a spam checking function. If the parameter variable is true, then the checking function is called, and its value decides what @@ -607,7 +625,7 @@ definitely a spam.") (defvar spam-list-of-statistical-checks - '(spam-use-ifile spam-use-stat spam-use-bogofilter) + '(spam-use-ifile spam-use-stat spam-use-bogofilter spam-use-spamoracle) "The spam-list-of-statistical-checks list contains all the mail splitters that need to have the full message body available.") @@ -1062,6 +1080,25 @@ (lambda (article) (spam-bogofilter-register-with-bogofilter (spam-get-article-as-string article) nil)))) + +^L +;;; spamoracle +(defun spam-check-spamoracle () + "Run spamoracle on an article to determine whether it's spam." + (let ((article-buffer-name (buffer-name))) + (with-temp-buffer + (let ((temp-buffer-name (buffer-name))) + (save-excursion + (set-buffer article-buffer-name) + (when (zerop (apply 'call-process-region (point-min) (point-max) + spam-spamoracle-binary nil temp-buffer-name nil + (if spam-spamoracle-database + `("-f" ,spam-spamoracle-database "mark") + "mark"))) + (set-buffer temp-buffer-name) + (goto-char (point-min)) + (when (re-search-forward "^X-Spam: yes;" nil t) + spam-split-group))))))) (provide 'spam)