(wl-save-status): Call wl-spam-save-status.
* wl-spam.el (wl-spam-register-spam-messages): New function.
(wl-spam-register-good-messages): Ditto.
(wl-spam-save-status): Ditto.
(wl-summary-mode-map): Bind
wl-summary-target-mark-register-as-spam to "ms" and
wl-summary-target-mark-register-as-good to "mn".
(wl-summary-register-as-spam): Abolish optional argument; Use
wl-spam-register-spam-messages.
(wl-summary-register-as-spam-all): Use
wl-spam-register-spam-messages.
(wl-summary-register-as-good): Abolish optional argument; Use
wl-spam-register-good-messages.
(wl-summary-register-as-good-all): Use
wl-spam-register-good-messages.
(wl-summary-target-mark-register-as-spam): New funtion.
(wl-summary-target-mark-register-as-good): Ditto.
* elmo-spam.el (elmo-spam-save-status): New API.
* elsp-spamfilter.el: New file.
* WL-ELS (ELMO-MODULES): Added elsp-spamfilter only if spamfilter
is installed.
+2003-10-21 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * WL-ELS (ELMO-MODULES): Added elsp-spamfilter only if spamfilter
+ is installed.
+
2003-10-20 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* WL-ELS (WL-MODULES): Added wl-spam.
(if (module-installed-p 'shimbun)
(add-to-list 'ELMO-MODULES 'elmo-shimbun))
+(if (module-installed-p 'spamfilter)
+ (add-to-list 'ELMO-MODULES 'elsp-spamfilter))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; SEMI
+2003-10-21 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * elmo-spam.el (elmo-spam-save-status): New API.
+
+ * elsp-spamfilter.el: New file.
+
2003-10-21 TAKAHASHI Kaoru <kaoru@kaisei.org>
* elmo-split.el (toplevel): Add `elmo-spam-processor' args.
"Register contents of BUFFER as non spam.
PROCESSOR is spam processor structure.")
+(luna-define-generic elmo-spam-save-status (processor)
+ "Save status of the PROCESSOR.")
+
;; optional method
(luna-define-generic elmo-spam-message-spam-p (processor folder number)
"Return non-nil if the message in the FOLDER with NUMBER is spam.
--- /dev/null
+;;; 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))
+ (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-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)))
+
+(defun elmo-spam-spamfilter-decode-buffer (buffer)
+ (mime-display-message
+ (mime-open-entity 'elmo-buffer buffer)
+ (current-buffer)))
+
+(luna-define-method elmo-spam-buffer-spam-p ((processor elsp-spamfilter)
+ buffer)
+ (with-temp-buffer
+ (elmo-spam-spamfilter-decode-buffer buffer)
+ (spamf-spam-buffer-p
+ (current-buffer)
+ (elsp-spamfilter-good-corpus-internal processor)
+ (elsp-spamfilter-bad-corpus-internal processor))))
+
+(luna-define-method elmo-spam-register-spam-buffer ((processor elsp-spamfilter)
+ buffer)
+ (with-temp-buffer
+ (elmo-spam-spamfilter-decode-buffer buffer)
+ (spamf-register-good-buffer
+ (current-buffer)
+ (elsp-spamfilter-good-corpus-internal processor))))
+
+(luna-define-method elmo-spam-register-good-buffer ((processor elsp-spamfilter)
+ buffer)
+ (with-temp-buffer
+ (elmo-spam-spamfilter-decode-buffer buffer)
+ (spamf-register-spam-buffer
+ (current-buffer)
+ (elsp-spamfilter-bad-corpus-internal processor))))
+
+(require 'product)
+(product-provide (provide 'elsp-spamfilter) (require 'elmo-version))
+
+;;; elsp-spamfilter.el ends here
+2003-10-21 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * wl.el (toplevel): Require wl-spam when compile.
+ (wl-save-status): Call wl-spam-save-status.
+
+ * wl-spam.el (wl-spam-register-spam-messages): New function.
+ (wl-spam-register-good-messages): Ditto.
+ (wl-spam-save-status): Ditto.
+ (wl-summary-mode-map): Bind
+ wl-summary-target-mark-register-as-spam to "ms" and
+ wl-summary-target-mark-register-as-good to "mn".
+ (wl-summary-register-as-spam): Abolish optional argument; Use
+ wl-spam-register-spam-messages.
+ (wl-summary-register-as-spam-all): Use
+ wl-spam-register-spam-messages.
+ (wl-summary-register-as-good): Abolish optional argument; Use
+ wl-spam-register-good-messages.
+ (wl-summary-register-as-good-all): Use
+ wl-spam-register-good-messages.
+ (wl-summary-target-mark-register-as-spam): New funtion.
+ (wl-summary-target-mark-register-as-good): Ditto.
+
2003-10-20 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* wl-spam.el: New file.
(const :tag "none" nil))))
:group 'wl-spam)
-
(defun wl-spam-folder-guess-domain (folder-name)
(cond ((string= folder-name wl-spam-folder-name)
'spam)
(apply function number args)))
(message "Checking spam...done")))
+(defun wl-spam-register-spam-messages (folder numbers)
+ (let ((total (length numbers)))
+ (elmo-with-progress-display (> total elmo-display-progress-threshold)
+ (elmo-spam-register total "Register spam messages...")
+ (elmo-spam-register-spam-messages (elmo-spam-processor)
+ wl-summary-buffer-elmo-folder
+ numbers))
+ (message "Register spam messages...done")))
+
+(defun wl-spam-register-good-messages (folder numbers)
+ (let ((total (length numbers)))
+ (elmo-with-progress-display (> total elmo-display-progress-threshold)
+ (elmo-spam-register total "Register good messages...")
+ (elmo-spam-register-good-messages (elmo-spam-processor)
+ wl-summary-buffer-elmo-folder
+ numbers))
+ (message "Register good messages...done")))
+
+(defun wl-spam-save-status ()
+ (interactive)
+ (elmo-spam-save-status (elmo-spam-processor)))
+
;; insinuate into summary mode
(defvar wl-summary-spam-map nil)
(define-key map "S" 'wl-summary-register-as-spam-all)
(define-key map "n" 'wl-summary-register-as-good)
(define-key map "N" 'wl-summary-register-as-good-all)
- (setq wl-summary-spam-map map)
- (define-key wl-summary-mode-map "k" wl-summary-spam-map)))
+ (setq wl-summary-spam-map map)))
+
+(define-key wl-summary-mode-map "k" wl-summary-spam-map)
+
+(define-key wl-summary-mode-map "ms" 'wl-summary-target-mark-register-as-spam)
+(define-key wl-summary-mode-map "mn" 'wl-summary-target-mark-register-as-good)
(eval-when-compile
;; Avoid compile warnings
#'wl-summary-refile
wl-spam-folder-name))
-(defun wl-summary-register-as-spam (&optional all)
- (interactive "P")
- (let ((numbers (if all
- wl-summary-buffer-number-list
- (list (wl-summary-message-number)))))
- (elmo-spam-register-spam-messages (elmo-spam-processor)
- wl-summary-buffer-elmo-folder
- numbers)))
+(defun wl-summary-register-as-spam ()
+ (interactive)
+ (let ((number (wl-summary-message-number)))
+ (when number
+ (wl-spam-register-spam-messages wl-summary-buffer-elmo-folder
+ (list number)))))
(defun wl-summary-register-as-spam-all ()
(interactive)
- (wl-summary-register-as-spam 'all))
+ (wl-spam-register-spam-messages wl-summary-buffer-elmo-folder
+ wl-summary-buffer-number-list))
-(defun wl-summary-register-as-good (&optional all)
- (interactive "P")
- (let ((numbers (if all
- wl-summary-buffer-number-list
- (list (wl-summary-message-number)))))
- (elmo-spam-register-good-messages (elmo-spam-processor)
- wl-summary-buffer-elmo-folder
- numbers)))
+(defun wl-summary-target-mark-register-as-spam ()
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (let ((inhibit-read-only t)
+ (buffer-read-only nil)
+ wl-summary-buffer-disp-msg)
+ (wl-spam-register-spam-messages wl-summary-buffer-elmo-folder
+ wl-summary-buffer-target-mark-list)
+ (dolist (number wl-summary-buffer-target-mark-list)
+ (wl-summary-unset-mark number)))))
+
+(defun wl-summary-register-as-good ()
+ (interactive)
+ (let ((number (wl-summary-message-number)))
+ (when number
+ (wl-spam-register-good-messages wl-summary-buffer-elmo-folder
+ (list number)))))
(defun wl-summary-register-as-good-all ()
(interactive)
- (wl-summary-register-as-good 'all))
+ (wl-spam-register-good-messages wl-summary-buffer-elmo-folder
+ wl-summary-buffer-number-list))
+
+(defun wl-summary-target-mark-register-as-good ()
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (let ((inhibit-read-only t)
+ (buffer-read-only nil)
+ wl-summary-buffer-disp-msg)
+ (wl-spam-register-good-messages wl-summary-buffer-elmo-folder
+ wl-summary-buffer-target-mark-list)
+ (dolist (number wl-summary-buffer-target-mark-list)
+ (wl-summary-unset-mark number)))))
;; hook functions and other
(defun wl-summary-auto-check-spam ()
(require 'smtp)
(require 'wl-score)
(require 'wl-fldmgr)
- (require 'wl-mime))
+ (require 'wl-mime)
+ (require 'wl-spam))
(defun wl-plugged-init (&optional make-alist)
(setq elmo-plugged wl-plugged)
(wl-refile-alist-save)
(wl-folder-info-save)
(and (featurep 'wl-fldmgr) (wl-fldmgr-exit))
+ (and (featurep 'wl-spam) (wl-spam-save-status))
(elmo-crosspost-message-alist-save)
(message "Saving summary and folder status...done"))