/usr/share/emacs/site-lisp/wl/elmo/elsp-spamoracle.el is in wl-beta 2.15.9+0.20130701-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | ;;; elsp-spamoracle.el --- SpamOracle support for elmo-spam.
;; Copyright (C) 2004 Daishi Kato <daishi@axlight.com>
;; Author: Daishi Kato <daishi@axlight.com>
;; Keywords: mail, net news, spam
;; This file is part of Wanderlust (Yet Another Message Interface on Emacsen).
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;; Commentary:
;;
;;; Code:
;;
(require 'elmo-spam)
(defgroup elmo-spam-spamoracle nil
"Spam spamoracle configuration."
:group 'elmo-spam)
(defcustom elmo-spam-spamoracle-program "spamoracle"
"Program name of the SpamOracle."
:type '(string :tag "Program name of the SpamOracle")
:group 'elmo-spam-spamoracle)
(defcustom elmo-spam-spamoracle-config-filename nil
"Filename of the SpamOracle config."
:type '(file :tag "Filename of the SpamOracle config")
:group 'elmo-spam-spamoracle)
(defcustom elmo-spam-spamoracle-database-filename
(expand-file-name ".spamoracle.db" elmo-msgdb-directory)
"Filename of the SpamOracle database."
:type '(file :tag "Filename of the SpamOracle database")
:group 'elmo-spam-spamoracle)
(defcustom elmo-spam-spamoracle-spam-header-regexp "^X-Spam: yes;"
"Regexp of the SpamOracle spam header."
:type '(string :tag "Regexp of the SpamOracle spam header")
:group 'elmo-spam-spamoracle)
(eval-and-compile
(luna-define-class elsp-spamoracle (elsp-generic)))
(defsubst elmo-spam-spamoracle-call (type)
(let ((args (cond
((eq type 'check)
(list "mark"))
((eq type 'add-spam)
(list "add" "-v" "-spam"))
((eq type 'add-good)
(list "add" "-v" "-good"))))
(output-buffer (get-buffer-create "*Output ELMO SpamOracle*")))
(with-current-buffer output-buffer
(erase-buffer))
(apply #'call-process-region
(point-min) (point-max)
elmo-spam-spamoracle-program
nil output-buffer
nil (delq nil
(append (if elmo-spam-spamoracle-config-filename
(list "-config"
elmo-spam-spamoracle-config-filename))
(if elmo-spam-spamoracle-database-filename
(list "-f"
elmo-spam-spamoracle-database-filename))
args)))
(if (eq type 'check)
(with-current-buffer output-buffer
(goto-char (point-min))
(let ((body-point (re-search-forward "^$" nil t)))
(goto-char (point-min))
(re-search-forward elmo-spam-spamoracle-spam-header-regexp
body-point t)))
t)))
(luna-define-method elmo-spam-buffer-spam-p ((processor elsp-spamoracle)
buffer &optional register)
(let ((result (with-current-buffer buffer
(elmo-spam-spamoracle-call 'check))))
(when register
(if result
(elmo-spam-register-spam-buffer processor buffer)
(elmo-spam-register-good-buffer processor buffer)))
result))
(luna-define-method elmo-spam-register-spam-buffer ((processor elsp-spamoracle)
buffer &optional restore)
(with-current-buffer buffer
(elmo-spam-spamoracle-call 'add-spam)))
(luna-define-method elmo-spam-register-good-buffer ((processor elsp-spamoracle)
buffer &optional restore)
(with-current-buffer buffer
(elmo-spam-spamoracle-call 'add-good)))
(require 'product)
(product-provide (provide 'elsp-spamoracle) (require 'elmo-version))
;;; elsp-spamoracle.el ends here
|