* modb-entity.el (modb-entity-field-extractor-alist): Add 3rd
authorhmurata <hmurata>
Sat, 17 Jun 2006 14:06:32 +0000 (14:06 +0000)
committerhmurata <hmurata>
Sat, 17 Jun 2006 14:06:32 +0000 (14:06 +0000)
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'.

elmo/ChangeLog
elmo/elmo-imap4.el
elmo/elmo-msgdb.el
elmo/modb-entity.el

index 8bd50d9..2603d6f 100644 (file)
@@ -1,3 +1,16 @@
+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
index 89ced71..ce4b708 100644 (file)
@@ -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
index 0ca5038..0d43d20 100644 (file)
@@ -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
index d96a0da..05e6cdc 100644 (file)
   :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