* wl-summary.el (wl-summary-prefetch-msg): Use elmo-msgdb-set-cached.
authorteranisi <teranisi>
Tue, 17 Sep 2002 12:24:59 +0000 (12:24 +0000)
committerteranisi <teranisi>
Tue, 17 Sep 2002 12:24:59 +0000 (12:24 +0000)
(wl-summary-delete-cache): Likewise.
(wl-summary-mark-as-read): Rewrite.

wl/ChangeLog
wl/wl-summary.el

index 8a52dab..a657501 100644 (file)
@@ -1,3 +1,9 @@
+2002-09-17  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-prefetch-msg): Use elmo-msgdb-set-cached.
+       (wl-summary-delete-cache): Likewise.
+       (wl-summary-mark-as-read): Rewrite.
+
 2002-09-16  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * wl-folder.el (wl-folder-check-one-entity): Follow the API change on
index c0aa7d0..8a11250 100644 (file)
@@ -1424,23 +1424,11 @@ If ARG is non-nil, checking is omitted."
                        (elmo-message-encache
                         wl-summary-buffer-elmo-folder
                         number))
+                   (elmo-msgdb-set-cached msgdb number t)
                    (setq new-mark
-                         (cond
-                          ((string= mark
-                                    elmo-msgdb-unread-uncached-mark)
-                           elmo-msgdb-unread-cached-mark)
-                          ((string= mark elmo-msgdb-new-mark)
-                           (setq wl-summary-buffer-new-count
-                                 (- wl-summary-buffer-new-count 1))
-                           (setq wl-summary-buffer-unread-count
-                                 (+ wl-summary-buffer-unread-count 1))
-                           elmo-msgdb-unread-cached-mark)
-                          ((string= mark elmo-msgdb-read-uncached-mark)
-                           nil)
-                          (t mark)))
-                   (elmo-msgdb-set-mark msgdb number new-mark)
-                   (or new-mark (setq new-mark " "))
-                   (wl-summary-set-mark-modified)
+                         (or (elmo-message-mark wl-summary-buffer-elmo-folder
+                                                number)
+                             " "))
                    (wl-summary-update-modeline)
                    (wl-folder-update-unread
                     (wl-summary-buffer-folder-name)
@@ -1712,20 +1700,11 @@ If ARG is non-nil, checking is omitted."
           (msgdb (wl-summary-buffer-msgdb))
           (number-alist (elmo-msgdb-get-number-alist msgdb))
           (case-fold-search nil)
-          mark number unread new-mark)
-      (setq mark (wl-summary-persistent-mark))
-      (cond
-       ((or (string= mark elmo-msgdb-new-mark)
-           (string= mark elmo-msgdb-unread-uncached-mark)
-           (string= mark elmo-msgdb-important-mark))
-       ;; noop
-       )
-       ((string= mark elmo-msgdb-unread-cached-mark)
-       (setq new-mark elmo-msgdb-unread-uncached-mark))
-       (t
-       (setq new-mark elmo-msgdb-read-uncached-mark)))
+          mark number unread)
+      (setq mark (wl-summary-persistent-mark)
+           number (wl-summary-message-number)
+           new-mark (elmo-msgdb-set-cached msgdb number nil))
       (when new-mark
-       (setq number (wl-summary-message-number))
        (delete-backward-char 1)
        (insert new-mark)
        (elmo-file-cache-delete
@@ -3948,61 +3927,31 @@ If ARG, exit virtual folder."
          (folder wl-summary-buffer-elmo-folder)
          (msgdb (wl-summary-buffer-msgdb))
          (case-fold-search nil)
-         cur-mark mark stat visible uncached new-mark marked)
-      (setq number (or number (wl-summary-message-number))
-           visible (if number
+         old-mark visible new-mark)
+      (setq visible (if number
                        (wl-summary-jump-to-msg number)
                      ;; interactive
                      t)
-           mark (elmo-msgdb-get-mark msgdb number))
-      (cond
-       ((string= mark elmo-msgdb-new-mark) ; N
-       (setq stat 'new))
-       ((string= mark elmo-msgdb-unread-uncached-mark) ; U
-       (setq stat 'unread))
-       ((string= mark elmo-msgdb-unread-cached-mark)  ; !
-       (setq stat 'unread))
-       ((string= mark elmo-msgdb-read-uncached-mark)  ; u
-       (setq stat 'read))
-       (t
-       ;; no need to mark server.
-       (setq no-folder-mark t)))
-      (setq new-mark
-           (if (and (if (elmo-message-use-cache-p folder number)
-                        (not (elmo-folder-local-p folder)))
-                    (not (elmo-file-cache-exists-p
-                          (elmo-message-field wl-summary-buffer-elmo-folder
-                                              number 'message-id))))
-               elmo-msgdb-read-uncached-mark
-             nil))
+           number (or number (wl-summary-message-number))
+           mark (elmo-message-mark folder number))
       ;; folder mark.
-      (unless no-folder-mark
-       (elmo-folder-mark-as-read folder (list number)))
-      (cond ((eq stat 'unread)
-            (setq wl-summary-buffer-unread-count
-                  (1- wl-summary-buffer-unread-count)))
-           ((eq stat 'new)
-            (setq wl-summary-buffer-new-count
-                  (1- wl-summary-buffer-new-count))))
+      (elmo-folder-mark-as-read folder (list number) no-folder-mark)
+      (elmo-msgdb-set-cached msgdb number t)
+      (setq new-mark (elmo-message-mark folder number))
+      ;;
+      ;; elmo-folder-mark-as-read should return unread numbers?
+      ;;
+      (wl-summary-count-unread)
       (wl-summary-update-modeline)
-      (wl-folder-update-unread
-       (wl-summary-buffer-folder-name)
-       (+ wl-summary-buffer-unread-count
-         wl-summary-buffer-new-count))
-      (when stat
-       ;; set mark on buffer
-       (when visible
-         (unless (string= (wl-summary-persistent-mark) new-mark)
-           (delete-backward-char 1)
-           (insert (or new-mark " "))))
-       ;; set msgdb mark.
-       (unless (string= mark new-mark)
-         (elmo-msgdb-set-mark msgdb number new-mark))
-       (wl-summary-set-mark-modified))
+      ;; set mark on buffer
+      (when visible
+       (unless (string= (wl-summary-persistent-mark) new-mark)
+         (delete-backward-char 1)
+         (insert (or new-mark " "))))
       (if (and visible wl-summary-highlight)
          (wl-highlight-summary-current-line nil nil t))
       (set-buffer-modified-p nil)
-      (if stat
+      (if (member mark (elmo-msgdb-unread-marks))
          (run-hooks 'wl-summary-unread-message-hook))
       number ;return value
       )))