(defvar wl-refile-subject-alist nil)
(defvar wl-refile-subject-alist-file-name "refile-subject-alist")
+(defvar wl-refile-default-from-folder-path-separator "/")
+
(defvar wl-refile-alist-max-length 1000)
(defun wl-refile-alist-setup ()
(downcase (wl-address-header-extract-address entity))))
(wl-parse-addresses
(concat
- (elmo-msgdb-overview-entity-get-to entity) ","
- (elmo-msgdb-overview-entity-get-cc entity)))))
+ (elmo-message-entity-field entity 'to) ","
+ (elmo-message-entity-field entity 'cc)))))
(while tocc-list
(if (wl-string-member
(car tocc-list)
(setq from
(downcase
(wl-address-header-extract-address
- (elmo-msgdb-overview-entity-get-from
- entity)))))
+ (elmo-message-entity-field entity 'from)))))
(setq key from))
(if (or wl-refile-msgid-alist
(memq 'wl-refile-guess-by-msgid
wl-refile-alist)))))
(defun wl-refile-msgid-learn (entity dst)
- (let ((key (elmo-msgdb-overview-entity-get-id entity))
+ (let ((key (elmo-message-entity-field entity 'message-id))
hit)
(setq dst (elmo-string dst))
(if key
(defun wl-refile-subject-learn (entity dst)
(let ((subject (funcall wl-summary-subject-filter-function
- (elmo-msgdb-overview-entity-get-subject entity)))
+ (elmo-message-entity-field entity 'subject 'decode)))
hit)
(setq dst (elmo-string dst))
(if (and subject (not (string= subject "")))
'(wl-refile-guess-by-rule
wl-refile-guess-by-msgid
wl-refile-guess-by-subject
- wl-refile-guess-by-history)
+ wl-refile-guess-by-history
+ wl-refile-guess-by-from)
"*Functions in this list are used for guessing refile destination folder.")
;; 2000-11-05: *-func-list -> *-functions
(elmo-define-obsolete-variable 'wl-refile-guess-func-list
'wl-refile-guess-functions)
-(defun wl-refile-guess (entity)
- (let ((flist wl-refile-guess-functions) guess)
+(defun wl-refile-guess (entity &optional functions)
+ (let ((flist (or functions wl-refile-guess-functions))
+ guess)
(while flist
(if (setq guess (funcall (car flist) entity))
(setq flist nil)
(defun wl-refile-get-field-value (entity field)
"Get FIELD value from ENTITY."
- (let ((field (downcase field))
- (fixed-fields '("from" "subject" "to" "cc")))
- (if (member field fixed-fields)
- (funcall (symbol-function
- (intern (concat
- "elmo-msgdb-overview-entity-get-"
- field)))
- entity)
- (elmo-msgdb-overview-entity-get-extra-field entity field))))
+ (elmo-message-entity-field entity (intern (downcase field)) 'decode))
(defun wl-refile-guess-by-rule (entity)
(let ((rules wl-refile-rule-alist)
(downcase (wl-address-header-extract-address entity))))
(wl-parse-addresses
(concat
- (elmo-msgdb-overview-entity-get-to entity) ","
- (elmo-msgdb-overview-entity-get-cc entity)))))
+ (elmo-message-entity-field entity 'to) ","
+ (elmo-message-entity-field entity 'cc)))))
ret-val)
- (setq tocc-list (elmo-list-delete
- (or wl-user-mail-address-list
- (list (wl-address-header-extract-address wl-from)))
- tocc-list))
+ (setq tocc-list (wl-address-delete-user-mail-addresses tocc-list))
(while tocc-list
(if (setq ret-val (cdr (assoc (car tocc-list) wl-refile-alist)))
(setq tocc-list nil)
(setq tocc-list (cdr tocc-list))))
- (or ret-val
- (wl-refile-guess-by-from entity))))
+ ret-val))
(defun wl-refile-get-account-part-from-address (address)
(if (string-match "\\([^@]+\\)@[^@]+" address)
address))
(defun wl-refile-guess-by-from (entity)
- (let ((from
- (downcase (wl-address-header-extract-address
- (elmo-msgdb-overview-entity-get-from entity)))))
+ (let ((from (downcase (wl-address-header-extract-address
+ (elmo-message-entity-field entity 'from))))
+ (folder (elmo-make-folder wl-refile-default-from-folder))
+ (elmo-path-sep wl-refile-default-from-folder-path-separator))
;; search from alist
(or (cdr (assoc from wl-refile-alist))
- (format "%s/%s" wl-refile-default-from-folder
- (wl-refile-get-account-part-from-address from)))))
+ (concat
+ (elmo-folder-prefix-internal folder)
+ (elmo-concat-path
+ (substring wl-refile-default-from-folder
+ (length (elmo-folder-prefix-internal folder)))
+ (wl-refile-get-account-part-from-address from))))))
(defun wl-refile-guess-by-msgid (entity)
- (cdr (assoc (elmo-msgdb-overview-entity-get-references entity)
+ (cdr (assoc (elmo-message-entity-field entity 'references)
wl-refile-msgid-alist)))
(defun wl-refile-guess-by-subject (entity)
(cdr (assoc (funcall wl-summary-subject-filter-function
- (elmo-msgdb-overview-entity-get-subject entity))
+ (elmo-message-entity-field entity 'subject 'decode))
wl-refile-subject-alist)))
(require 'product)