;;; MSGDB interface.
;;
-;; MSGDB elmo-load-msgdb PATH
+;; MSGDB elmo-load-msgdb PATH MIME-CHARSET
;; MSGDB elmo-make-msgdb LOCATION TYPE
;; elmo-msgdb-sort-by-date MSGDB
;;; Helper functions for MSGDB
;;
-(defun elmo-load-msgdb (location)
+(defun elmo-load-msgdb (location mime-charset)
"Load the MSGDB from PATH."
- (let ((msgdb (elmo-make-msgdb location elmo-msgdb-default-type))
+ (let ((msgdb (elmo-make-msgdb location elmo-msgdb-default-type mime-charset))
priorities loaded temp-modb)
(unless (elmo-msgdb-load msgdb)
(setq priorities
(copy-sequence elmo-msgdb-load-priorities)))
(while (and priorities
(not loaded))
- (setq temp-modb (elmo-make-msgdb location (car priorities))
+ (setq temp-modb (elmo-make-msgdb location
+ (car priorities)
+ mime-charset)
loaded (elmo-msgdb-load temp-modb)
priorities (cdr priorities)))
(when loaded
(setq msgdb temp-modb))))
msgdb))
-(defun elmo-make-msgdb (&optional location type)
+(defun elmo-make-msgdb (&optional location type mime-charset)
"Make a MSGDB."
(let* ((type (or type elmo-msgdb-default-type))
(class (intern (format "modb-%s" type))))
(require class)
(luna-make-entity class
- :location location)))
+ :location location
+ :mime-charset mime-charset)))
+
+(defun elmo-msgdb-extra-fields (&optional non-virtual)
+ (if non-virtual
+ (apply
+ #'nconc
+ (mapcar
+ (lambda (extra)
+ (let ((spec (assq (intern extra) modb-entity-field-extractor-alist)))
+ (if spec
+ (let ((real-fields (nth 2 spec)))
+ (cond ((functionp real-fields)
+ (funcall real-fields extra))
+ ((listp real-fields)
+ real-fields)))
+ (list extra))))
+ elmo-msgdb-extra-fields))
+ elmo-msgdb-extra-fields))
(defun elmo-msgdb-sort-by-date (msgdb)
(elmo-msgdb-sort-entities