+2006-06-17 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * modb-entity.el (modb-entity-field-extractor-alist): Add 3rd
+ field `real field' into each element of list.
+ (elmo-msgdb-create-message-entity-from-buffer): Follow the above change.
+ (elmo-msgdb-message-entity-field): Ditto.
+ (modb-entity-ml-info-real-fields): New function.
+
+ * elmo-msgdb.el (elmo-msgdb-extra-fields): New function.
+
+ * elmo-imap4.el (elmo-folder-msgdb-create-plugged): Use function
+ `elmo-msgdb-extra-fields'.
+
2006-05-30 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
* elmo-util.el (elmo-passwd-alist-load): Move point to min
(when numbers
(let ((session (elmo-imap4-get-session folder))
(headers
- (append
- '("Subject" "From" "To" "Cc" "Date"
- "Message-Id" "References" "In-Reply-To")
- elmo-msgdb-extra-fields))
+ (elmo-uniq-list
+ (append
+ '("Subject" "From" "To" "Cc" "Date"
+ "Message-Id" "References" "In-Reply-To")
+ (mapcar #'capitalize (elmo-msgdb-extra-fields 'non-virtual)))))
(total 0)
(length (length numbers))
print-length print-depth
: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
msgdb
:group 'elmo)
(defcustom modb-entity-field-extractor-alist
- '((ml-info . modb-entity-extract-mailing-list-info))
+ '((ml-info modb-entity-extract-mailing-list-info
+ modb-entity-ml-info-real-fields))
"*An alist of field name and function to extract field body from buffer."
- :type '(repeat (cons (symbol :tag "Field Name")
- (function :tag "Function")))
+ :type '(repeat (list (symbol :tag "Field Name")
+ (function :tag "Extractor")
+ (choice :tag "Real Field"
+ (repeat :tag "Field Name List" string)
+ (function :tag "Function"))))
:group 'elmo)
(defvar modb-entity-default-cache-internal nil)
(let (field-name field-body extractor)
(dolist (extra (cons "newsgroups" elmo-msgdb-extra-fields))
(setq field-name (intern (downcase extra))
- extractor (cdr (assq field-name
- modb-entity-field-extractor-alist))
+ extractor (nth 1 (assq field-name
+ modb-entity-field-extractor-alist))
field-body (if extractor
(funcall extractor field-name)
(elmo-decoded-field-body extra 'summary)))
(when (or name count)
(cons name (and count (string-to-number count))))))
+(defun modb-entity-ml-info-real-fields (field)
+ (elmo-uniq-list
+ (mapcar (lambda (entry)
+ (symbol-name (if (consp entry) (car entry) entry)))
+ (append elmo-mailing-list-name-spec-list
+ elmo-mailing-list-count-spec-list))))
+
(defun modb-entity-make-mailing-list-info-string (field value)
(when (car value)
(format (if (cdr value) "(%s %05.0f)" "(%s)")
(if (memq field '(number :number))
(car (cdr entity))
(with-current-buffer (cdr (cdr entity))
- (let ((extractor (cdr (assq field
- modb-entity-field-extractor-alist))))
+ (let ((extractor
+ (nth 1 (assq field modb-entity-field-extractor-alist))))
(if extractor
(funcall extractor field)
(mapconcat