* elmo.el (elmo-message-copy-entity): New function.
authorteranisi <teranisi>
Thu, 17 Jul 2003 15:55:19 +0000 (15:55 +0000)
committerteranisi <teranisi>
Thu, 17 Jul 2003 15:55:19 +0000 (15:55 +0000)
(elmo-message-entity-set-number): Ditto.
(elmo-message-mark): Define as method.

* elmo-multi.el (elmo-multi-real-folder-number): Changed position.
(elmo-folder-synchronize): Return 0 (Should be reconsider).
(elmo-message-entity): Fixed last change.
(elmo-message-mark): Define.
(elmo-folder-msgdb-create): Abolish.
(elmo-multi-folder-append-msgdb): Ditto.
(elmo-multi-folder-diff): Fixed.
(elmo-multi-split-number-alist): Removed.
(elmo-multi-split-mark-alist): Removed.
(elmo-folder-list-messages): Define.
(elmo-folder-list-messages-internal): Removed.

* wl-thread.el (wl-thread-update-line-on-buffer-sub): Don't use
elmo-msgdb interface.
(wl-thread-get-exist-children): Likewise.
(wl-thread-insert-message): Likewise.
(wl-thread-msg-mark-as-important): Likewise.
(wl-thread-insert-entity-sub): Likewise.
(wl-thread-get-children-msgs-uncached): Likewise.

* wl-summary.el (wl-summary-sync-all-init): Use elmo-folder-length.
(wl-summary-prefetch-msg): Don't use elmo-msgdb interface.
(wl-summary-sync-update): Likewise.
(wl-summary-auto-select-msg-p): Likewise.
(wl-summary-update-thread): Likewise.
(wl-summary-mark-as-important): Likewise.
(wl-summary-jump-to-msg-internal): Likewise.
(wl-summary-redisplay-internal): Likewise.
(wl-summary-print-message-with-ps-print): Likewise.
(wl-summary-folder-info-update): Likewise.

* wl-folder.el (wl-folder-check-one-entity):
elmo-folder-count-flags instead of wl-summary-count-unread.

elmo/ChangeLog
elmo/elmo-multi.el
elmo/elmo.el
wl/ChangeLog
wl/wl-folder.el
wl/wl-score.el
wl/wl-summary.el
wl/wl-thread.el

index 04709d3..539f550 100644 (file)
@@ -1,5 +1,21 @@
 2003-07-17  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * elmo.el (elmo-message-copy-entity): New function.
+       (elmo-message-entity-set-number): Ditto.
+       (elmo-message-mark): Define as method.
+
+       * elmo-multi.el (elmo-multi-real-folder-number): Changed position.
+       (elmo-folder-synchronize): Return 0 (Should be reconsider).
+       (elmo-message-entity): Fixed last change.
+       (elmo-message-mark): Define.
+       (elmo-folder-msgdb-create): Abolish.
+       (elmo-multi-folder-append-msgdb): Ditto.
+       (elmo-multi-folder-diff): Fixed.
+       (elmo-multi-split-number-alist): Removed.
+       (elmo-multi-split-mark-alist): Removed.
+       (elmo-folder-list-messages): Define.
+       (elmo-folder-list-messages-internal): Removed.
+
        * elmo-localdir.el (elmo-folder-append-messages): Treat flags for
        local file messages.
        (elmo-folder-msgdb-create): Fixed read mark.
index 27b06ec..e3b5c11 100644 (file)
                     (children divide-number))
   (luna-define-internal-accessors 'elmo-multi-folder))
 
+(defmacro elmo-multi-real-folder-number (folder number)
+  "Returns a cons cell of real FOLDER and NUMBER."
+  (` (cons (nth (- 
+                (/ (, number)
+                   (elmo-multi-folder-divide-number-internal (, folder)))
+                1) (elmo-multi-folder-children-internal (, folder)))
+          (% (, number) (elmo-multi-folder-divide-number-internal
+                         (, folder))))))
+
 (luna-define-method elmo-folder-initialize ((folder
                                             elmo-multi-folder)
                                            name)
@@ -79,7 +88,8 @@
                                             &optional ignore-msgdb
                                             no-check)
   (dolist (fld (elmo-multi-folder-children-internal folder))
-    (elmo-folder-synchronize fld ignore-msgdb no-check)))
+    (elmo-folder-synchronize fld ignore-msgdb no-check))
+  0)
 
 (luna-define-method elmo-folder-expand-msgdb-path ((folder
                                                    elmo-multi-folder))
   (nth (- (/ number (elmo-multi-folder-divide-number-internal folder)) 1)
        (elmo-multi-folder-children-internal folder)))
 
-(luna-define-method elmo-message-entity ((folder elmo-folder) key)
+(luna-define-method elmo-message-entity ((folder elmo-multi-folder) key)
   (cond
    ((numberp key)
-    (elmo-msgdb-message-entity (elmo-folder-msgdb
-                               (elmo-message-folder folder key))
-                              key))
+    (let* ((pair (elmo-multi-real-folder-number folder key))
+          (entity 
+           (elmo-message-copy-entity
+            (elmo-message-entity (car pair) (cdr pair)))))
+      (elmo-message-entity-set-number entity key)))
    ((stringp key)
     (let ((children (elmo-multi-folder-children-internal folder))
+         (cur-number 0)
          match)
       (while children
+       (setq cur-number (+ cur-number 1))
        (when (setq match (elmo-message-entity (car children) key))
+         (setq match (elmo-message-copy-entity match))
+         (elmo-message-entity-set-number
+          match
+          (+ (* (elmo-multi-folder-divide-number-internal folder)
+                cur-number)
+             (elmo-message-entity-number match)))
          (setq children nil))
        (setq children (cdr children)))
       match))))
 
-(defun elmo-multi-msgdb (msgdb base)
-  (list (mapcar (function
-                (lambda (x)
-                  (elmo-msgdb-overview-entity-set-number
-                   x
-                   (+ base
-                      (elmo-msgdb-overview-entity-get-number x)))))
-               (nth 0 msgdb))
-       (mapcar (function
-                (lambda (x) (cons
-                             (+ base (car x))
-                             (cdr x))))
-               (nth 1 msgdb))
-       (mapcar (function
-                (lambda (x) (cons
-                             (+ base (car x))
-                             (cdr x)))) (nth 2 msgdb))))
+(luna-define-method elmo-message-mark ((folder elmo-multi-folder) number)
+  (let ((pair (elmo-multi-real-folder-number folder number)))
+    (elmo-message-mark (car pair) (cdr pair))))
 
 (defun elmo-multi-split-numbers (folder numlist &optional as-is)
   (let ((numbers (sort numlist '<))
       (setq numbers-list (nconc numbers-list (list one-list))))
     numbers-list))
 
-(luna-define-method elmo-folder-msgdb-create ((folder elmo-multi-folder)
-                                             numbers flag-table)
-  (let* ((folders (elmo-multi-folder-children-internal folder))
-        overview number-alist mark-alist entity
-        numbers-list
-        cur-number
-        i percent num
-        msgdb)
-    (setq numbers-list (elmo-multi-split-numbers folder numbers))
-    (setq cur-number 0)
-    (while (< cur-number (length folders))
-      (if (nth cur-number numbers-list)
-         (setq msgdb
-               (elmo-msgdb-append
-                msgdb
-                (elmo-multi-msgdb
-                 (elmo-folder-msgdb-create (nth cur-number folders)
-                                           (nth cur-number numbers-list)
-                                           flag-table)
-                 (* (elmo-multi-folder-divide-number-internal folder)
-                    (1+ cur-number))))))
-      (setq cur-number (1+ cur-number)))
-    (elmo-msgdb-sort-by-date msgdb)))
-
 (luna-define-method elmo-folder-process-crosspost ((folder elmo-multi-folder))
   (dolist (child (elmo-multi-folder-children-internal folder))
     (elmo-folder-process-crosspost child)))
 
-(defsubst elmo-multi-folder-append-msgdb (folder append-msgdb)
-  (if append-msgdb
-      (let* ((number-alist (elmo-msgdb-get-number-alist append-msgdb))
-            (all-alist (copy-sequence (append
-                                       (elmo-msgdb-get-number-alist
-                                        (elmo-folder-msgdb folder))
-                                       number-alist)))
-            (cur number-alist)
-            overview to-be-deleted
-            mark-alist same)
-       (while cur
-         (setq all-alist (delq (car cur) all-alist))
-         ;; same message id exists.
-         (if (setq same (rassoc (cdr (car cur)) all-alist))
-             (unless (= (/ (car (car cur))
-                           (elmo-multi-folder-divide-number-internal folder))
-                        (/ (car same)
-                           (elmo-multi-folder-divide-number-internal folder)))
-               ;; base is also same...delete it!
-               (setq to-be-deleted
-                     (append to-be-deleted (list (car (car cur)))))))
-         (setq cur (cdr cur)))
-       (cond ((eq (elmo-folder-process-duplicates-internal folder)
-                  'hide)
-              ;; Hide duplicates.
-              (elmo-msgdb-append-to-killed-list folder to-be-deleted)
-              (setq overview (elmo-delete-if
-                              (lambda (x)
-                                (memq (elmo-msgdb-overview-entity-get-number
-                                       x)
-                                      to-be-deleted))
-                              (elmo-msgdb-get-overview append-msgdb)))
-              ;; Should be mark as read.
-              (elmo-folder-mark-as-read folder to-be-deleted)
-              (elmo-msgdb-set-overview append-msgdb overview))
-             ((eq (elmo-folder-process-duplicates-internal folder)
-                  'read)
-              ;; Mark as read duplicates.
-              (elmo-folder-mark-as-read folder to-be-deleted))
-             (t
-              ;; Do nothing.
-              (setq to-be-deleted nil)))
-       (elmo-folder-set-msgdb-internal folder
-                                       (elmo-msgdb-append
-                                        (elmo-folder-msgdb folder)
-                                        append-msgdb))
-       (length to-be-deleted))
-    0))
-
-(luna-define-method elmo-folder-append-msgdb ((folder elmo-multi-folder)
-                                             append-msgdb)
-  (elmo-multi-folder-append-msgdb folder append-msgdb))
-
-(defmacro elmo-multi-real-folder-number (folder number)
-  "Returns a cons cell of real FOLDER and NUMBER."
-  (` (cons (nth (- 
-                (/ (, number)
-                   (elmo-multi-folder-divide-number-internal (, folder)))
-                1) (elmo-multi-folder-children-internal (, folder)))
-          (% (, number) (elmo-multi-folder-divide-number-internal
-                         (, folder))))))
-
 (defsubst elmo-multi-find-fetch-strategy (folder entity ignore-cache)
   (if entity
       (let ((pair (elmo-multi-real-folder-number
 
 (defun elmo-multi-folder-diff (folder numbers)
   (let ((flds (elmo-multi-folder-children-internal folder))
-       (numbers (mapcar 'car
-                        (elmo-msgdb-number-load
-                         (elmo-folder-msgdb-path folder))))
-       (killed (elmo-msgdb-killed-list-load (elmo-folder-msgdb-path folder)))
-       (count 0)
+       (num-list (and numbers (elmo-multi-split-numbers folder numbers)))
        (unsync 0)
        (messages 0)
-       num-list
-       diffs nums)
-    ;; If first time, dummy numbers is used as current number list.
-    (unless numbers
-      (let ((i 0)
-           (divider (elmo-multi-folder-divide-number-internal folder)))
-       (dolist (folder flds)
-         (setq i (+ i 1))
-         (setq numbers
-               (cons (* i divider) numbers)))))
-    (setq num-list
-         (elmo-multi-split-numbers folder
-                                   (elmo-uniq-list
-                                    (nconc
-                                     (elmo-number-set-to-number-list killed)
-                                     numbers))))
+       diffs)
     (while flds
-      (setq nums (elmo-folder-diff (car flds) (car num-list))
-           nums (cons (or (elmo-diff-unread nums)
-                          (elmo-diff-new nums))
-                      (elmo-diff-all nums)))
-      (setq diffs (nconc diffs (list nums)))
-      (setq count (+ 1 count))
-      (setq num-list (cdr num-list))
+      (setq diffs (nconc diffs (list (elmo-folder-diff (car flds)
+                                                      (car num-list)))))
       (setq flds (cdr flds)))
     (while diffs
       (and (car (car diffs))
     (elmo-folder-set-info-hashtb folder nil messages)
     (cons unsync messages)))
 
-(defun elmo-multi-split-number-alist (folder number-alist)
-  (let ((alist (sort (copy-sequence number-alist)
-                    (lambda (pair1 pair2)
-                      (< (car pair1)(car pair2)))))
-       (cur-number 0)
-       one-alist split num)
-    (while alist
-      (setq cur-number (+ cur-number 1))
-      (setq one-alist nil)
-      (while (and alist
-                 (eq 0
-                     (/ (- (setq num (car (car alist)))
-                           (* elmo-multi-divide-number cur-number))
-                        (elmo-multi-folder-divide-number-internal folder))))
-       (setq one-alist (nconc
-                        one-alist
-                        (list
-                         (cons
-                          (% num (* (elmo-multi-folder-divide-number-internal
-                                     folder) cur-number))
-                          (cdr (car alist))))))
-       (setq alist (cdr alist)))
-      (setq split (nconc split (list one-alist))))
-    split))
-
-(defun elmo-multi-split-mark-alist (folder mark-alist)
-  (let ((cur-number 0)
-       (alist (sort (copy-sequence mark-alist)
-                    (lambda (pair1 pair2)
-                      (< (car pair1)(car pair2)))))
-       one-alist result)
-    (while alist
-      (setq cur-number (+ cur-number 1))
-      (setq one-alist nil)
-      (while (and alist
-                 (eq 0
-                     (/ (- (car (car alist))
-                           (* (elmo-multi-folder-divide-number-internal
-                               folder) cur-number))
-                        (elmo-multi-folder-divide-number-internal folder))))
-       (setq one-alist (nconc
-                        one-alist
-                        (list
-                         (list (% (car (car alist))
-                                  (* (elmo-multi-folder-divide-number-internal
-                                      folder) cur-number))
-                               (cadr (car alist))))))
-       (setq alist (cdr alist)))
-      (setq result (nconc result (list one-alist))))
-    result))
-
 (luna-define-method elmo-folder-list-unreads ((folder elmo-multi-folder))
   (let ((cur-number 0)
        unreads)
            (elmo-folder-list-messages-with-global-mark
             folder elmo-msgdb-important-mark)))))
 
-(luna-define-method elmo-folder-list-messages-internal
-  ((folder elmo-multi-folder) &optional nohide)
+(luna-define-method elmo-folder-list-messages
+  ((folder elmo-multi-folder) &optional visible-only in-msgdb)
   (let* ((flds (elmo-multi-folder-children-internal folder))
         (cur-number 0)
         list numbers)
     (while flds
       (setq cur-number (+ cur-number 1))
-      (setq list (elmo-folder-list-messages-internal (car flds)))
+      (setq list (elmo-folder-list-messages (car flds) visible-only in-msgdb))
       (setq numbers
-           (append
+           (nconc
             numbers
-            (if (listp list)
-                (mapcar
-                 (function
-                  (lambda (x)
-                    (+
-                     (* (elmo-multi-folder-divide-number-internal
-                         folder) cur-number) x)))
-                 list)
-              ;; Use current list.
-              (elmo-delete-if
-               (lambda (num)
-                 (not
-                  (eq cur-number (/ num
-                                    (elmo-multi-folder-divide-number-internal
-                                     folder)))))
-               (mapcar
-                'car
-                (elmo-msgdb-get-number-alist
-                 (elmo-folder-msgdb folder)))))))
+            (mapcar
+             (function
+              (lambda (x)
+                (+
+                 (* (elmo-multi-folder-divide-number-internal
+                     folder) cur-number) x)))
+             list)))
       (setq flds (cdr flds)))
     numbers))
 
index f3396fa..9db3215 100644 (file)
@@ -1136,6 +1136,13 @@ If CACHED is t, message is set as cached."
                               (elmo-message-use-cache-p folder number))
     (elmo-folder-set-mark-modified-internal folder t)))
 
+(defun elmo-message-copy-entity (entity)
+  ;; 
+  (elmo-msgdb-copy-overview-entity entity))
+
+(defun elmo-message-entity-set-number (entity number)  
+  (elmo-msgdb-overview-entity-set-number entity number))
+
 (luna-define-generic elmo-message-entity (folder key)
   "Return the message-entity structure which matches to the KEY.
 KEY is a number or a string.
@@ -1229,10 +1236,12 @@ FLAG is a symbol which is one of the following:
 'sugar' flag:
   `read'      (set unread flag)")
 
-(defun elmo-message-mark (folder number)
+(luna-define-generic elmo-message-mark (folder number)
   "Get mark of the message.
 FOLDER is the ELMO folder structure.
-NUMBER is a number of the message."
+NUMBER is a number of the message.")
+
+(luna-define-method elmo-message-mark ((folder elmo-folder) number)
   (elmo-msgdb-get-mark (elmo-folder-msgdb folder) number))
 
 (defun elmo-message-field (folder number field)
index 7bc3961..407bf2b 100644 (file)
@@ -1,5 +1,27 @@
 2003-07-17  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * wl-thread.el (wl-thread-update-line-on-buffer-sub): Don't use
+       elmo-msgdb interface.
+       (wl-thread-get-exist-children): Likewise.
+       (wl-thread-insert-message): Likewise.
+       (wl-thread-msg-mark-as-important): Likewise.
+       (wl-thread-insert-entity-sub): Likewise.
+       (wl-thread-get-children-msgs-uncached): Likewise.
+
+       * wl-summary.el (wl-summary-sync-all-init): Use elmo-folder-length.
+       (wl-summary-prefetch-msg): Don't use elmo-msgdb interface.
+       (wl-summary-sync-update): Likewise.
+       (wl-summary-auto-select-msg-p): Likewise.
+       (wl-summary-update-thread): Likewise.
+       (wl-summary-mark-as-important): Likewise.
+       (wl-summary-jump-to-msg-internal): Likewise.
+       (wl-summary-redisplay-internal): Likewise.
+       (wl-summary-print-message-with-ps-print): Likewise.
+       (wl-summary-folder-info-update): Likewise.
+
+       * wl-folder.el (wl-folder-check-one-entity):
+       elmo-folder-count-flags instead of wl-summary-count-unread.
+
        * wl-draft.el (wl-draft-normal-send-func): Fixed last change.
 
        * wl-action.el (wl-summary-define-mark-action): Fixed region function.
index 8e4b79d..f749b69 100644 (file)
@@ -852,7 +852,7 @@ Optional argument ARG is repeart count."
              all    (and all    (max 0 all))))
       (setq unread (or (and unread (- unread (or new 0)))
                       (elmo-folder-get-info-unread folder)
-                      (nth 1 (wl-summary-count-unread))))
+                      (nth 1 (elmo-folder-count-flags folder))))
       (wl-folder-entity-hashtb-set wl-folder-entity-hashtb entity
                                   (list new unread all)
                                   (get-buffer wl-folder-buffer-name)))
index f940cb1..93c888d 100644 (file)
@@ -405,10 +405,8 @@ Set `wl-score-cache' nil."
 
     ;; Create messages, an alist of the form `(ENTITY . SCORE)'.
     (elmo-folder-do-each-message-entity (entity folder)
-      (when (and (not (assq
-                      (setq num
-                            (elmo-message-entity-number entity))
-                      wl-summary-scored))
+      (setq num (elmo-message-entity-number entity))
+      (when (and (not (assq num wl-summary-scored))
                 (or (memq num force-msgs)
                     (member (elmo-message-mark folder num)
                             wl-summary-score-marks)))
index bbcb30f..6a598bd 100644 (file)
@@ -1190,8 +1190,9 @@ Entering Folder mode calls the value of `wl-summary-mode-hook'."
   (erase-buffer)
   (wl-summary-set-message-modified)
   (setq wl-thread-entity-hashtb (elmo-make-hash
-                                (* (length (elmo-msgdb-get-number-alist
-                                            (wl-summary-buffer-msgdb))) 2)))
+                                (* (elmo-folder-length
+                                    wl-summary-buffer-elmo-folder)
+                                   2)))
   (setq wl-thread-entity-list nil)
   (setq wl-thread-entities nil)
   (setq wl-summary-buffer-number-list nil)
@@ -1361,16 +1362,13 @@ If ARG is non-nil, checking is omitted."
   "Returns status-mark. if skipped, returns nil."
   ;; prefetching procedure.
   (save-excursion
-    (let* ((msgdb (wl-summary-buffer-msgdb))
-          (number-alist (elmo-msgdb-get-number-alist msgdb))
-          (message-id (cdr (assq number number-alist)))
-          (ov (elmo-msgdb-overview-get-entity message-id msgdb))
-          (wl-message-entity ov)
-          (entity ov)                  ; backward compatibility.
-          (size (elmo-msgdb-overview-entity-get-size ov))
+    (let* ((size (elmo-message-field wl-summary-buffer-elmo-folder
+                                    number 'size))
           (inhibit-read-only t)
           (buffer-read-only nil)
-          (file-cached (elmo-file-cache-exists-p message-id))
+          (file-cached (elmo-file-cache-exists-p
+                        (elmo-message-field wl-summary-buffer-elmo-folder
+                                            number 'message-id)))
           (force-read (and size
                            (or file-cached
                                (and (null wl-prefetch-confirm) arg)
@@ -1397,11 +1395,14 @@ If ARG is non-nil, checking is omitted."
                              (elmo-delete-char
                               ?\"
                               (or
-                               (elmo-msgdb-overview-entity-get-from ov)
+                               (elmo-message-field
+                                wl-summary-buffer-elmo-folder
+                                number 'from)
                                "??")))))) " ]")
                        size))))
              (message ""))             ; flush.
-           (setq mark (or (elmo-msgdb-get-mark msgdb number) " "))
+           (setq mark (or (elmo-message-mark wl-summary-buffer-elmo-folder
+                                             number) " "))
            (if force-read
                (save-excursion
                  (save-match-data
@@ -1598,7 +1599,6 @@ If ARG is non-nil, checking is omitted."
          (y-or-n-p "Mark all messages as read? "))
       (let* ((folder wl-summary-buffer-elmo-folder)
             (cur-buf (current-buffer))
-            (msgdb (wl-summary-buffer-msgdb))
             (inhibit-read-only t)
             (buffer-read-only nil)
             (case-fold-search nil)
@@ -1634,8 +1634,6 @@ If ARG is non-nil, checking is omitted."
     (let* ((inhibit-read-only t)
           (buffer-read-only nil)
           (folder wl-summary-buffer-elmo-folder)
-          (msgdb (wl-summary-buffer-msgdb))
-          (number-alist (elmo-msgdb-get-number-alist msgdb))
           (case-fold-search nil)
           new-mark mark number unread)
       (setq number (wl-summary-message-number))
@@ -1847,7 +1845,7 @@ If ARG is non-nil, checking is omitted."
         (inhibit-read-only t)
         (buffer-read-only nil)
         gc-message
-        overview number-alist
+        overview
         curp num i diff
         append-list delete-list crossed
         update-thread update-top-list
@@ -1949,7 +1947,8 @@ If ARG is non-nil, checking is omitted."
       (when wl-use-scoring
        (setq wl-summary-scored nil)
        (wl-summary-score-headers (and sync-all
-                                      (wl-summary-rescore-msgs number-alist))
+                                      (wl-summary-rescore-msgs
+                                       wl-summary-buffer-number-list))
                                  sync-all)
        (when (and wl-summary-scored
                   (setq expunged (wl-summary-score-update-all-lines)))
@@ -2075,9 +2074,9 @@ If ARG is non-nil, checking is omitted."
            (message "Deleting...")
            (elmo-folder-delete-messages
             wl-summary-buffer-elmo-folder dels)
+           ;; XXXX
            (elmo-msgdb-delete-msgs (wl-summary-buffer-msgdb)
                                    dels)
-;;;        (elmo-msgdb-save (wl-summary-buffer-folder-name) nil)
            (wl-summary-set-message-modified)
            (wl-folder-set-folder-updated (wl-summary-buffer-folder-name)
                                          (list 0 0 0))
@@ -2256,8 +2255,8 @@ If ARG, without confirm."
 (defun wl-summary-auto-select-msg-p (unread-msg)
   (and unread-msg
        (not (string=
-            (elmo-msgdb-get-mark
-             (wl-summary-buffer-msgdb)
+            (elmo-message-mark
+             wl-summary-buffer-elmo-folder
              unread-msg)
             elmo-msgdb-important-mark))))
 
@@ -2704,7 +2703,7 @@ If ARG, without confirm."
          entity
          parent-entity
          nil
-         (elmo-msgdb-get-mark (wl-summary-buffer-msgdb) number)
+         (elmo-message-mark wl-summary-buffer-elmo-folder number)
          (wl-thread-maybe-get-children-num number)
          (wl-thread-make-indent-string thr-entity)
          (wl-thread-entity-get-linked thr-entity)))))))
@@ -3029,13 +3028,12 @@ If ARG, exit virtual folder."
          (inhibit-read-only t)
          (buffer-read-only nil)
          (folder wl-summary-buffer-elmo-folder)
-         (msgdb (wl-summary-buffer-msgdb))
-         (number-alist (elmo-msgdb-get-number-alist msgdb))
          message-id visible cur-mark)
       (if number
          (progn
            (setq visible (wl-summary-jump-to-msg number))
-           (setq mark (or mark (elmo-msgdb-get-mark msgdb number))))
+           (setq mark (or mark (elmo-message-mark 
+                                wl-summary-buffer-elmo-folder number))))
        (setq visible t))
       (when visible
        (if (null (setq number (wl-summary-message-number)))
@@ -3047,7 +3045,8 @@ If ARG, exit virtual folder."
          (wl-summary-goto-previous-message-beginning)))
       (if (or (and (not visible)
                   ;; already exists in msgdb.
-                  (elmo-msgdb-overview-get-entity number msgdb))
+                  (elmo-message-entity wl-summary-buffer-elmo-folder
+                                       number))
              (setq cur-mark (wl-summary-persistent-mark)))
          (progn
            (setq number (or number (wl-summary-message-number)))
@@ -3759,9 +3758,10 @@ Return t if message exists."
               folder scan-type nil nil t)
            (if msgid
                (setq msg
-                     (car (rassoc msgid
-                                  (elmo-msgdb-get-number-alist
-                                   (wl-summary-buffer-msgdb))))))
+                     (elmo-message-entity-number
+                      (elmo-message-entity
+                       wl-summary-buffer-elmo-folder
+                       msgid))))
            (setq entity (wl-folder-search-entity-by-name folder
                                                          wl-folder-entity
                                                          'folder))
@@ -4133,8 +4133,7 @@ Use function list is `wl-summary-write-current-folder-functions'."
 
 (defsubst wl-summary-redisplay-internal (&optional folder number force-reload)
   (interactive)
-  (let* ((msgdb (wl-summary-buffer-msgdb))
-        (folder (or folder wl-summary-buffer-elmo-folder))
+  (let* ((folder (or folder wl-summary-buffer-elmo-folder))
         (num (or number (wl-summary-message-number)))
         (wl-mime-charset      wl-summary-buffer-mime-charset)
         (default-mime-charset wl-summary-buffer-mime-charset)
@@ -4470,12 +4469,9 @@ If ASK-CODING is non-nil, coding-system for the message is asked."
            (let* ((buffer (generate-new-buffer " *print*"))
                   (entity (progn
                             (set-buffer summary-buffer)
-                            (assoc (cdr (assq
-                                         (wl-summary-message-number)
-                                         (elmo-msgdb-get-number-alist
-                                          (wl-summary-buffer-msgdb))))
-                                   (elmo-msgdb-get-overview
-                                    (wl-summary-buffer-msgdb)))))
+                            (elmo-message-entity
+                             wl-summary-buffer-elmo-folder
+                             (wl-summary-message-number))))
                   (wl-ps-subject
                    (and entity
                         (or (elmo-msgdb-overview-entity-get-subject entity)
@@ -4517,14 +4513,13 @@ If ASK-CODING is non-nil, coding-system for the message is asked."
          (wl-summary-unmark num))))))
 
 (defun wl-summary-folder-info-update ()
-  (let ((folder (elmo-string (wl-summary-buffer-folder-name)))
-       (num-db (elmo-msgdb-get-number-alist
-                (wl-summary-buffer-msgdb))))
-    (wl-folder-set-folder-updated folder
-                                 (list 0
-                                       (+ wl-summary-buffer-unread-count
-                                          wl-summary-buffer-new-count)
-                                       (length num-db)))))
+  (wl-folder-set-folder-updated
+   (elmo-string (wl-summary-buffer-folder-name))
+   (list 0
+        (+ wl-summary-buffer-unread-count
+           wl-summary-buffer-new-count)
+        (elmo-folder-length
+         wl-summary-buffer-elmo-folder))))
 
 (defun wl-summary-get-original-buffer ()
   "Get original buffer for the current summary."
index f7337d8..1ba4ab4 100644 (file)
@@ -374,10 +374,9 @@ ENTITY is returned."
 (defsubst wl-thread-update-line-on-buffer-sub (entity msg &optional parent-msg)
   (let* ((entity (or entity (wl-thread-get-entity msg)))
         (parent-msg (or parent-msg (wl-thread-entity-get-parent entity)))
-        (overview (elmo-msgdb-get-overview (wl-summary-buffer-msgdb)))
         (buffer-read-only nil)
         (inhibit-read-only t)
-        overview-entity temp-mark summary-line invisible-top dest-pair)
+        message-entity temp-mark summary-line invisible-top dest-pair)
     (if (wl-thread-delete-line-from-buffer msg)
        (progn
          (cond
@@ -387,16 +386,16 @@ ENTITY is returned."
            (setq dest-pair (cons (nth 0 temp-mark)(nth 2 temp-mark))
                  temp-mark (nth 1 temp-mark)))
           (t (setq temp-mark (wl-summary-get-score-mark msg))))
-         (when (setq overview-entity
-                     (elmo-msgdb-overview-get-entity
-                      msg (wl-summary-buffer-msgdb)))
+         (when (setq message-entity
+                     (elmo-message-entity wl-summary-buffer-elmo-folder
+                                          msg))
            (wl-summary-insert-line 
             (wl-summary-create-line
-             overview-entity
-             (elmo-msgdb-overview-get-entity
-              parent-msg (wl-summary-buffer-msgdb))
+             message-entity
+             (elmo-message-entity wl-summary-buffer-elmo-folder
+                                  parent-msg)
              temp-mark
-             (elmo-msgdb-get-mark (wl-summary-buffer-msgdb) msg)
+             (elmo-message-mark wl-summary-buffer-elmo-folder msg)
              (if wl-thread-insert-force-opened
                  nil
                (wl-thread-maybe-get-children-num msg))
@@ -409,11 +408,11 @@ ENTITY is returned."
       (if (not (setq invisible-top
                     (wl-thread-entity-parent-invisible-p entity)))
          (wl-summary-update-thread
-          (elmo-msgdb-overview-get-entity msg (wl-summary-buffer-msgdb))
+          (elmo-message-entity wl-summary-buffer-elmo-folder msg)
           entity
           (and parent-msg
-               (elmo-msgdb-overview-get-entity
-                parent-msg (wl-summary-buffer-msgdb))))
+               (elmo-message-entity wl-summary-buffer-elmo-folder
+                                    parent-msg)))
        ;; currently invisible.. update closed line.
        (wl-thread-update-children-number invisible-top)))))
 
@@ -496,8 +495,8 @@ ENTITY is returned."
     (while msgs
       (setq children (wl-thread-entity-get-children
                      (setq entity (wl-thread-get-entity (car msgs)))))
-      (when (elmo-msgdb-overview-get-entity (car msgs)
-                                           (wl-summary-buffer-msgdb))
+      (when (elmo-message-entity wl-summary-buffer-elmo-folder
+                                (car msgs))
        (wl-append ret-val (list (car msgs)))
        (setq children nil))
       (setq msgs (cdr msgs))
@@ -675,8 +674,8 @@ Message is inserted to the summary buffer."
              (wl-summary-update-thread
               overview-entity
               child-entity
-              (elmo-msgdb-overview-get-entity
-               parent-msg (wl-summary-buffer-msgdb)))
+              (elmo-message-entity wl-summary-buffer-elmo-folder
+                                   parent-msg))
              (when parent
                ;; use thread structure.
                ;;(wl-thread-entity-get-nearly-older-brother
@@ -735,14 +734,10 @@ Message is inserted to the summary buffer."
 
 (defun wl-thread-msg-mark-as-important (msg)
   "Set mark as important for invisible MSG. Modeline is not changed."
-  (let ((msgdb (wl-summary-buffer-msgdb))
+  (let ((folder wl-summary-buffer-elmo-folder)
        cur-mark)
-    (setq cur-mark (elmo-msgdb-get-mark msgdb msg))
-    (elmo-msgdb-set-mark msgdb
-                        msg
-                        (if (string= cur-mark elmo-msgdb-important-mark)
-                            nil
-                          elmo-msgdb-important-mark))
+    (setq cur-mark (elmo-message-mark folder msg))
+    (elmo-folder-mark-as-important folder (list msg))
     (wl-summary-set-mark-modified)))
 
 (defun wl-thread-mark-as-read (&optional arg)
@@ -808,7 +803,7 @@ Message is inserted to the summary buffer."
 
 (defsubst wl-thread-insert-entity-sub (indent entity parent-entity all)
   (let (msg-num
-       overview-entity
+       message-entity
        temp-mark
        summary-line)
     (when (setq msg-num (wl-thread-entity-get-number entity))
@@ -819,18 +814,18 @@ Message is inserted to the summary buffer."
               (setq temp-mark (nth 1 temp-mark)))))
       (unless temp-mark
        (setq temp-mark (wl-summary-get-score-mark msg-num)))
-      (setq overview-entity
-           (elmo-msgdb-overview-get-entity
-            (nth 0 entity) (wl-summary-buffer-msgdb)))
+      (setq message-entity
+           (elmo-message-entity wl-summary-buffer-elmo-folder
+                                (nth 0 entity)))
 ;;;   (wl-delete-all-overlays)
-      (when overview-entity
+      (when message-entity
        (wl-summary-insert-line
         (wl-summary-create-line
-         overview-entity
-         (elmo-msgdb-overview-get-entity
-          (nth 0 parent-entity) (wl-summary-buffer-msgdb))
+         message-entity
+         (elmo-message-entity wl-summary-buffer-elmo-folder
+                              (nth 0 parent-entity))
          temp-mark
-         (elmo-msgdb-get-mark (wl-summary-buffer-msgdb) msg-num)
+         (elmo-message-mark wl-summary-buffer-elmo-folder msg-num)
          (if wl-thread-insert-force-opened
              nil
            (wl-thread-maybe-get-children-num msg-num))
@@ -940,14 +935,12 @@ Message is inserted to the summary buffer."
 
 (defun wl-thread-get-children-msgs-uncached (msg &optional uncached-marks)
   (let ((children-msgs (wl-thread-get-children-msgs msg))
-       (number-alist (elmo-msgdb-get-number-alist (wl-summary-buffer-msgdb)))
-       mark
-       uncached-list)
+       mark uncached-list)
     (while children-msgs
       (if (and (not (eq msg (car children-msgs))) ; except itself
               (or (and uncached-marks
-                       (setq mark (elmo-msgdb-get-mark
-                                   (wl-summary-buffer-msgdb)
+                       (setq mark (elmo-message-mark
+                                   wl-summary-buffer-elmo-folder
                                    (car children-msgs)))
                        (member mark uncached-marks))
                   (and (not uncached-marks)