* test-utf7.el (test-utf7-encode-string-alpha): Fix indent.
[elisp/wanderlust.git] / elmo / modb-entity.el
index d96a0da..77d53ce 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)
@@ -479,7 +483,7 @@ If each field is t, function is set as default converter."
            cc   (mapconcat 'identity (elmo-multiple-field-body "cc") ","))
       (unless (elmo-msgdb-message-entity-field handler entity 'size)
        (if (setq size (elmo-field-body "content-length"))
-           (setq size (string-to-int size))
+           (setq size (string-to-number size))
          (setq size 0)))
       (while extras
        (if (setq field-body (elmo-field-body (car extras)))
@@ -557,7 +561,7 @@ If each field is t, function is set as default converter."
      ((or (string= key "larger")
          (string= key "smaller"))
       (let ((bytes (elmo-msgdb-message-entity-field handler entity 'size))
-           (threshold (string-to-int (elmo-filter-value condition))))
+           (threshold (string-to-number (elmo-filter-value condition))))
        (if (string= key "larger")
            (> bytes threshold)
          (< bytes threshold))))
@@ -761,13 +765,13 @@ If each field is t, function is set as default converter."
               :size
               (let ((size (elmo-field-body "content-length")))
                 (if size
-                    (string-to-int size)
+                    (string-to-number size)
                   (or (plist-get args :size) 0)))))))
       (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