/usr/share/emacs/site-lisp/wl/elmo/elsp-spamfilter.el is in wl-beta 2.15.9+0.20171209-1.
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 117 118 119 120 | ;;; elsp-spamfilter.el --- Spamfilter support for elmo-spam.
;; Copyright (C) 2003 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
;; Copyright (C) 2003 Yuuichi Teranishi <teranisi@gohome.org>
;; Author: Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
;; 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)
(require 'luna)
(require 'mime-view)
(require 'spamfilter)
(defgroup elmo-spam-spamfilter nil
"Spam spamfilter configuration."
:group 'elmo-spam)
(defcustom elmo-spam-spamfilter-corpus-filename
(expand-file-name ".spamfilter" elmo-msgdb-directory)
"Filename of the Spamfilter corpus."
:type '(file :tag "Filename of the Spamfilter corpus")
:group 'elmo-spam-spamfilter)
(eval-and-compile
(luna-define-class elsp-spamfilter (elsp-generic)
(good-corpus bad-corpus modified))
(luna-define-internal-accessors 'elsp-spamfilter))
(luna-define-method initialize-instance :around ((processor elsp-spamfilter)
&rest init-args)
(luna-call-next-method)
(let ((spamf-good-corpus (make-spamf-corpus
:name "spamf-good-corpus"
:table (make-hash-table :test #'eq)
:message-count 0))
(spamf-bad-corpus (make-spamf-corpus
:name "spamf-bad-corpus"
:table (make-hash-table :test #'eq)
:message-count 0)))
(spamf-load-corpus-from-file elmo-spam-spamfilter-corpus-filename)
(elsp-spamfilter-set-good-corpus-internal processor spamf-good-corpus)
(elsp-spamfilter-set-bad-corpus-internal processor spamf-bad-corpus)
processor))
(luna-define-method elmo-spam-modified-p ((processor elsp-spamfilter))
(elsp-spamfilter-modified-internal processor))
(luna-define-method elmo-spam-save-status ((processor elsp-spamfilter))
(spamf-save-corpus-to-file
elmo-spam-spamfilter-corpus-filename
(elsp-spamfilter-good-corpus-internal processor)
(elsp-spamfilter-bad-corpus-internal processor))
(elsp-spamfilter-set-modified-internal processor nil))
(defun elsp-spamfilter-decode-buffer (buffer)
(mime-display-message
(mime-open-entity 'elmo-buffer buffer)
(current-buffer)))
(defsubst elsp-spamfilter-register-buffer-internal (processor buffer spam)
(spamf-register-words-buffer
(if spam
(elsp-spamfilter-bad-corpus-internal processor)
(elsp-spamfilter-good-corpus-internal processor))
buffer)
(elsp-spamfilter-set-modified-internal processor t))
(luna-define-method elmo-spam-buffer-spam-p ((processor elsp-spamfilter)
buffer &optional register)
(with-temp-buffer
(elsp-spamfilter-decode-buffer buffer)
(let ((spam (spamf-spam-buffer-p
(current-buffer)
(elsp-spamfilter-good-corpus-internal processor)
(elsp-spamfilter-bad-corpus-internal processor))))
(when register
(elsp-spamfilter-register-buffer-internal
processor (current-buffer) spam))
spam)))
(luna-define-method elmo-spam-register-spam-buffer ((processor elsp-spamfilter)
buffer &optional restore)
(with-temp-buffer
(elsp-spamfilter-decode-buffer buffer)
(elsp-spamfilter-register-buffer-internal processor (current-buffer) t)))
(luna-define-method elmo-spam-register-good-buffer ((processor elsp-spamfilter)
buffer &optional restore)
(with-temp-buffer
(elsp-spamfilter-decode-buffer buffer)
(elsp-spamfilter-register-buffer-internal processor (current-buffer) nil)))
(require 'product)
(product-provide (provide 'elsp-spamfilter) (require 'elmo-version))
;;; elsp-spamfilter.el ends here
|