;; according to the definition of `elmo-split-rule'.
;;
+;;; Code:
(require 'elmo)
-;;; Code:
+(eval-when-compile
+ ;; Avoid compile warnings
+ (require 'elmo-spam))
+
(defcustom elmo-split-rule nil
"Split rule for the command `elmo-split'.
The format of this variable is a list of RULEs which has form like:
`or' ... True if one of the argument returns true.
`and' ... True if all of the arguments return true.
-4. A symbol.
+`spam-p' ... True if contents of the message is guessed as spam.
+ Rest arguments are property list which consists
+ following.
+
+ `:register' ... If this value is non-nil,
+ Register according to
+ the classification.
+
+5. A symbol.
When a symbol is specified, it is evaluated.
:group 'elmo)
(defcustom elmo-split-default-action 'noop
- "Default action for messages which pass all rules."
+ "Default action for messages which pass all rules.
+It can be some ACTION as in `elmo-split-rule'."
:type '(choice (const :tag "do not touch" noop)
(const :tag "delete" delete)
(string :tag "folder name")
(symbol-name field)))))
(equal field-value value))))
+(defun elmo-split-spam-p (buffer &rest plist)
+ (require 'elmo-spam)
+ (elmo-spam-buffer-spam-p (elmo-spam-processor)
+ buffer
+ (plist-get plist :register)))
+
(defun elmo-split-match (buffer field value)
(with-current-buffer buffer
(let ((field-value (and elmo-split-message-entity
(format "%d messages are splitted" count)))
(if (eq fcount 0)
"."
- (format " (%d failure)." fcount))))))
+ (format " (%d failure)." fcount))))
+ count))
(defun elmo-split-subr (folder &optional reharsal)
(let ((elmo-inhibit-display-retrieval-progress t)
(elmo-message-fetch folder msg
(elmo-make-fetch-strategy 'entire)
nil (current-buffer) 'unread))
+ (run-hooks 'elmo-split-fetch-hook)
(setq elmo-split-message-entity (mime-parse-buffer))
(catch 'terminate
(dolist (rule (append elmo-split-rule default-rule))
action)))
(elmo-folder-create target-folder)))
(elmo-folder-open-internal target-folder)
- (elmo-folder-append-buffer target-folder 'unread)
+ (elmo-folder-append-buffer target-folder)
(elmo-folder-close-internal target-folder))
(error (setq failure t)
(incf fcount)))
" Test: do nothing\n")
((function action)
(format " Test: function:%s\n"
- (symbol-name action)))
+ (prin1-to-string action)))
(t
" ERROR: wrong action specified\n"))
(cond