`wl-spam-folder-guess-domain'.
(wl-summary-exec-action-spam): Register as spam if domain of the
source folder is good.
(wl-summary-exec-action-refile-with-register): Register message if
domain of the source folder is not undecided.
* elsp-spamfilter.el (elsp-spamfilter-decode-buffer): Renamed from
`elmo-spam-spamfilter-decode-buffer'.
(elsp-spamfilter-register-buffer-internal): New internal function.
(elmo-spam-buffer-spam-p): Use it; Follow the API change.
(elmo-spam-register-spam-buffer): Ditto.
(elmo-spam-register-good-buffer): Ditto.
* elsp-bogofilter.el (elmo-spam-buffer-spam-p): Follow the API
change.
(elmo-spam-bogofilter-register-buffer): Added argument `restore'.
(elmo-spam-register-spam-buffer): Follow the API change.
(elmo-spam-register-good-buffer): Ditto.
* elmo-split.el (toplevel): Require elmo-spam when copmile.
(elmo-split-spam-p): Added argument plist; Call
`elmo-spam-buffer-spam-p' with new argument register.
* elmo-spam.el (elmo-spam-buffer-spam-p): Added optional argument
`register'.
(elmo-spam-message-spam-p): Ditto.
(elmo-spam-register-spam-buffer): Added optional argument
`restore'.
(elmo-spam-register-good-buffer): Ditto.
(elmo-spam-register-spam-messages): Ditto.
(elmo-spam-register-good-messages): Ditto.
+2003-11-02 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * elsp-spamfilter.el (elsp-spamfilter-decode-buffer): Renamed from
+ `elmo-spam-spamfilter-decode-buffer'.
+ (elsp-spamfilter-register-buffer-internal): New internal function.
+ (elmo-spam-buffer-spam-p): Use it; Follow the API change.
+ (elmo-spam-register-spam-buffer): Ditto.
+ (elmo-spam-register-good-buffer): Ditto.
+
+ * elsp-bogofilter.el (elmo-spam-buffer-spam-p): Follow the API
+ change.
+ (elmo-spam-bogofilter-register-buffer): Added argument `restore'.
+ (elmo-spam-register-spam-buffer): Follow the API change.
+ (elmo-spam-register-good-buffer): Ditto.
+
+ * elmo-split.el (toplevel): Require elmo-spam when copmile.
+ (elmo-split-spam-p): Added argument plist; Call
+ `elmo-spam-buffer-spam-p' with new argument register.
+
+ * elmo-spam.el (elmo-spam-buffer-spam-p): Added optional argument
+ `register'.
+ (elmo-spam-message-spam-p): Ditto.
+ (elmo-spam-register-spam-buffer): Added optional argument
+ `restore'.
+ (elmo-spam-register-good-buffer): Ditto.
+ (elmo-spam-register-spam-messages): Ditto.
+ (elmo-spam-register-good-messages): Ditto.
+
2003-10-27 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elsp-spamfilter.el (elmo-spam-register-spam-buffer): Fixed to
(luna-define-class elsp-generic ()))
;; required method
-(luna-define-generic elmo-spam-buffer-spam-p (processor buffer)
+(luna-define-generic elmo-spam-buffer-spam-p (processor buffer
+ &optional register)
"Return non-nil if contents of BUFFER is spam.
-PROCESSOR is spam processor structure.")
+PROCESSOR is spam processor structure.
+If optional augument REGISTER is non-nil,
+register according to the classification.")
-(luna-define-generic elmo-spam-register-spam-buffer (processor buffer)
+(luna-define-generic elmo-spam-register-spam-buffer (processor
+ buffer
+ &optional restore)
"Register contents of BUFFER as spam.
-PROCESSOR is spam processor structure.")
+PROCESSOR is spam processor structure.
+If optional argument RESTORE is non-nil, unregister from non-spam list.")
-(luna-define-generic elmo-spam-register-good-buffer (processor buffer)
- "Register contents of BUFFER as non spam.
-PROCESSOR is spam processor structure.")
+(luna-define-generic elmo-spam-register-good-buffer (processor
+ buffer
+ &optional restore)
+ "Register contents of BUFFER as non-spam.
+PROCESSOR is spam processor structure.
+If optional argument RESTORE is non-nil, unregister from spam list.")
+;; optional method
(luna-define-generic elmo-spam-modified-p (processor)
"Return non-nil if status of PROCESSOR is modified.")
(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)
+(luna-define-generic elmo-spam-message-spam-p (processor folder number
+ &optional register)
"Return non-nil if the message in the FOLDER with NUMBER is spam.
-PROCESSOR is spam processor structure.")
+PROCESSOR is spam processor structure.
+If optional augument REGISTER is non-nil,
+register according to the classification.")
(luna-define-generic elmo-spam-list-spam-messages (processor
folder &optional numbers)
(luna-define-generic elmo-spam-register-spam-messages (processor
folder
- &optional numbers)
+ &optional
+ numbers restore)
"Register contents of messages as spam.
PROCESSOR is spam processor structure.
FOLDER is the ELMO folder structure.
If optional argument NUMBERS is specified and is a list of message numbers,
-messages are searched from the list.")
+messages are searched from the list.
+If optional argument RESTORE is non-nil, unregister from non-spam list.")
(luna-define-generic elmo-spam-register-good-messages (processor
folder
- &optional numbers)
+ &optional
+ numbers restore)
"Register contents of messages as non spam.
PROCESSOR is spam processor structure.
FOLDER is the ELMO folder structure.
If optional argument NUMBERS is specified and is a list of message numbers,
-messages are searched from the list.")
+messages are searched from the list.
+If optional argument RESTORE is non-nil, unregister from spam list.")
;; for internal use
(defun elmo-spam-message-fetch (folder number)
;; generic implement
(luna-define-method elmo-spam-message-spam-p ((processor elsp-generic)
- folder number)
+ folder number &optional register)
(with-temp-buffer
(elmo-spam-message-fetch folder number)
- (elmo-spam-buffer-spam-p processor (current-buffer))))
+ (elmo-spam-buffer-spam-p processor (current-buffer) register)))
(luna-define-method elmo-spam-list-spam-messages ((processor elsp-generic)
folder &optional numbers)
(nreverse spam-list)))
(luna-define-method elmo-spam-register-spam-messages ((processor elsp-generic)
- folder &optional numbers)
+ folder
+ &optional
+ numbers restore)
(let ((numbers (or numbers (elmo-folder-list-messages folder t t))))
(with-temp-buffer
(buffer-disable-undo (current-buffer))
(dolist (number numbers)
(erase-buffer)
(elmo-spam-message-fetch folder number)
- (elmo-spam-register-spam-buffer processor (current-buffer))
+ (elmo-spam-register-spam-buffer processor (current-buffer) restore)
(elmo-progress-notify 'elmo-spam-register)))))
(luna-define-method elmo-spam-register-good-messages ((processor elsp-generic)
- folder &optional numbers)
+ folder
+ &optional
+ numbers restore)
(let ((numbers (or numbers (elmo-folder-list-messages folder t t))))
(with-temp-buffer
(buffer-disable-undo (current-buffer))
(dolist (number numbers)
(erase-buffer)
(elmo-spam-message-fetch folder number)
- (elmo-spam-register-good-buffer processor (current-buffer))
+ (elmo-spam-register-good-buffer processor (current-buffer) restore)
(elmo-progress-notify 'elmo-spam-register)))))
(provide 'elsp-generic)
(eval-when-compile
;; Avoid compile warnings
- (defun-maybe elmo-spam-processor ())
- (defun-maybe elmo-spam-buffer-spam-p (processor buffer)))
+ (require 'elmo-spam))
(defcustom elmo-split-rule nil
"Split rule for the command `elmo-split'.
(symbol-name field)))))
(equal field-value value))))
-(defun elmo-split-spam-p (buffer)
+(defun elmo-split-spam-p (buffer &rest plist)
(require 'elmo-spam)
- (elmo-spam-buffer-spam-p (elmo-spam-processor) buffer))
+ (elmo-spam-buffer-spam-p (elmo-spam-processor)
+ buffer
+ (plist-get plist :register)))
(defun elmo-split-match (buffer field value)
(with-current-buffer buffer
(luna-define-class elsp-bogofilter (elsp-generic)))
(luna-define-method elmo-spam-buffer-spam-p ((processor elsp-bogofilter)
- buffer)
+ buffer &optional register)
(let ((args `("-v" "-2"
+ ,@(if register (list "-u"))
,@(if elmo-spam-bogofilter-database-directory
(list "-d" elmo-spam-bogofilter-database-directory)))))
(with-current-buffer buffer
elmo-spam-bogofilter-program
nil nil nil args)))))
-(defsubst elmo-spam-bogofilter-register-buffer (buffer spam)
+(defsubst elmo-spam-bogofilter-register-buffer (buffer spam restore)
(let ((args `("-v"
,(if spam
elmo-spam-bogofilter-spam-switch
elmo-spam-bogofilter-good-switch)
+ ,@(if restore (list (if spam "-N" "-S")))
,@(if elmo-spam-bogofilter-database-directory
(list "-d" elmo-spam-bogofilter-database-directory)))))
(with-current-buffer buffer
nil nil nil args))))
(luna-define-method elmo-spam-register-spam-buffer ((processor elsp-bogofilter)
- buffer)
- (elmo-spam-bogofilter-register-buffer buffer t))
+ buffer &optional restore)
+ (elmo-spam-bogofilter-register-buffer buffer t restore))
(luna-define-method elmo-spam-register-good-buffer ((processor elsp-bogofilter)
- buffer)
- (elmo-spam-bogofilter-register-buffer buffer nil))
+ buffer &optional restore)
+ (elmo-spam-bogofilter-register-buffer buffer nil restore))
(require 'product)
(product-provide (provide 'elsp-bogofilter) (require 'elmo-version))
(elsp-spamfilter-bad-corpus-internal processor))
(elsp-spamfilter-set-modified-internal processor nil))
-(defun elmo-spam-spamfilter-decode-buffer (buffer)
+(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)
+ buffer &optional register)
(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))))
+ (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 buffer spam))
+ spam)))
(luna-define-method elmo-spam-register-spam-buffer ((processor elsp-spamfilter)
- buffer)
+ buffer &optional restore)
(with-temp-buffer
- (elmo-spam-spamfilter-decode-buffer buffer)
- (spamf-register-spam-buffer
- (current-buffer)
- (elsp-spamfilter-bad-corpus-internal processor))
- (elsp-spamfilter-set-modified-internal processor t)))
+ (elsp-spamfilter-decode-buffer buffer)
+ (elsp-spamfilter-register-buffer-internal processor buffer t)))
(luna-define-method elmo-spam-register-good-buffer ((processor elsp-spamfilter)
- buffer)
+ buffer &optional restore)
(with-temp-buffer
- (elmo-spam-spamfilter-decode-buffer buffer)
- (spamf-register-good-buffer
- (current-buffer)
- (elsp-spamfilter-good-corpus-internal processor))
- (elsp-spamfilter-set-modified-internal processor t)))
+ (elsp-spamfilter-decode-buffer buffer)
+ (elsp-spamfilter-register-buffer-internal processor buffer nil)))
(require 'product)
(product-provide (provide 'elsp-spamfilter) (require 'elmo-version))
+2003-11-02 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * wl-spam.el (wl-spam-domain): Renamed from
+ `wl-spam-folder-guess-domain'.
+ (wl-summary-exec-action-spam): Register as spam if domain of the
+ source folder is good.
+ (wl-summary-exec-action-refile-with-register): Register message if
+ domain of the source folder is not undecided.
+
2003-10-31 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* wl-summary.el (wl-summary-insert-thread): Fixed the logic to
(string :tag "Document string"))
:group 'wl-spam)
-(defun wl-spam-folder-guess-domain (folder-name)
+(defun wl-spam-domain (folder-name)
(cond ((string= folder-name wl-spam-folder-name)
'spam)
((wl-string-match-member folder-name
(wl-summary-mark-spam)))
(defun wl-summary-exec-action-spam (mark-list)
- (let ((folder wl-summary-buffer-elmo-folder)
+ (let ((domain (wl-spam-domain (elmo-folder-name-internal
+ wl-summary-buffer-elmo-folder)))
(total (length mark-list)))
- (when (eq (wl-spam-folder-guess-domain (elmo-folder-name-internal folder))
- 'undecided)
+ (when (memq domain '(undecided good))
(message "Registering spam...")
(elmo-with-progress-display (> total elmo-display-progress-threshold)
(elmo-spam-register total "Registering spam...")
(elmo-spam-register-spam-messages (elmo-spam-processor)
- folder
- (mapcar #'car mark-list)))
+ wl-summary-buffer-elmo-folder
+ (mapcar #'car mark-list)
+ (eq domain 'good)))
(message "Registering spam...done"))
(wl-summary-move-mark-list-messages mark-list
wl-spam-folder-name
"Refiling spam...")))
(defun wl-summary-exec-action-refile-with-register (mark-list)
- (let ((processor (elmo-spam-processor))
- (folder wl-summary-buffer-elmo-folder)
- spam-list good-list total)
- (when (eq (wl-spam-folder-guess-domain
- (elmo-folder-name-internal folder))
- 'undecided)
- (message "Registering spam...")
+ (let* ((processor (elmo-spam-processor))
+ (folder wl-summary-buffer-elmo-folder)
+ (domain (wl-spam-domain (elmo-folder-name-internal folder)))
+ spam-list good-list total)
+ (unless (eq domain 'ignore)
(dolist (info mark-list)
- (case (wl-spam-folder-guess-domain (nth 2 info))
+ (case (wl-spam-domain (nth 2 info))
(spam
(setq spam-list (cons (car info) spam-list)))
(good
(setq good-list (cons (car info) good-list)))))
- (setq total (+ (length spam-list) (length good-list)))
- (elmo-with-progress-display (> total elmo-display-progress-threshold)
- (elmo-spam-register total "Registering spam...")
- (when spam-list
- (elmo-spam-register-spam-messages processor folder spam-list))
- (when good-list
- (elmo-spam-register-good-messages processor folder good-list)))
- (message "Registering spam...done"))
+ (case domain
+ (spam (setq spam-list nil))
+ (good (setq good-list nil)))
+ (when (or spam-list good-list)
+ (message "Registering spam...")
+ (setq total (+ (length spam-list) (length good-list)))
+ (elmo-with-progress-display (> total elmo-display-progress-threshold)
+ (elmo-spam-register total "Registering spam...")
+ (when spam-list
+ (elmo-spam-register-spam-messages processor folder spam-list
+ (eq domain 'good)))
+ (when good-list
+ (elmo-spam-register-good-messages processor folder good-list
+ (eq domain 'spam))))
+ (message "Registering spam...done")))
;; execute refile messages
(wl-summary-exec-action-refile mark-list)))