From: hmurata Date: Sat, 17 Jun 2006 14:06:32 +0000 (+0000) Subject: * modb-entity.el (modb-entity-field-extractor-alist): Add 3rd X-Git-Tag: wl-2_15_4~28 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=4f64e5a159c23e9f43b2b7292602e17980213ed8;p=elisp%2Fwanderlust.git * 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'. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 8bd50d9..2603d6f 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,16 @@ +2006-06-17 Hiroya Murata + + * 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 * elmo-util.el (elmo-passwd-alist-load): Move point to min diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 89ced71..ce4b708 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -2362,10 +2362,11 @@ If optional argument REMOVE is non-nil, remove FLAG." (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 diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index 0ca5038..0d43d20 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -138,6 +138,23 @@ VALUE is the field value." :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 diff --git a/elmo/modb-entity.el b/elmo/modb-entity.el index d96a0da..05e6cdc 100644 --- a/elmo/modb-entity.el +++ b/elmo/modb-entity.el @@ -46,10 +46,14 @@ :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) @@ -766,8 +770,8 @@ If each field is t, function is set as default converter." (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))) @@ -789,6 +793,13 @@ If each field is t, function is set as default converter." (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)") @@ -830,8 +841,8 @@ If each field is t, function is set as default converter." (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