Gnus development mailing list
 help / color / mirror / Atom feed
* [Eric Knauel] spam.el and spamoracle
@ 2003-05-06 15:57 Lars Magne Ingebrigtsen
  2003-05-08 13:44 ` Ted Zlatanov
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-05-06 15:57 UTC (permalink / raw)


[-- Attachment #1: Type: message/rfc822, Size: 4914 bytes --]

[-- Attachment #1.1.1: Type: text/plain, Size: 260 bytes --]


Hi Lars,

here is a little patch that adds support for Xavier Leroy's spamoracle
(see <http://pauillac.inria.fr/~xleroy/software.html>) to spam.el.  I
found it quite useful when using IMAP server or other servers where I
can't start spamoracle via procmail.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: spamoracle for spam.el --]
[-- Type: text/x-patch, Size: 2767 bytes --]

--- 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)
 

[-- Attachment #1.1.3: Type: text/plain, Size: 82 bytes --]


-Eric
-- 
"Excuse me --- Di Du Du Duuuuh Di Dii --- Huh Weeeheeee" (Albert King)

[-- Attachment #2: Type: text/plain, Size: 105 bytes --]



-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-06-09 23:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-06 15:57 [Eric Knauel] spam.el and spamoracle Lars Magne Ingebrigtsen
2003-05-08 13:44 ` Ted Zlatanov
2003-05-13 17:50   ` Lars Magne Ingebrigtsen
2003-05-13 20:08   ` Eric Knauel
2003-05-13 22:44     ` Lars Magne Ingebrigtsen
2003-05-20 17:41     ` Ted Zlatanov
2003-06-05  9:32       ` Eric Knauel
2003-06-09 20:53         ` Ted Zlatanov
2003-06-09 23:08           ` Jesper Harder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).