* elmo-msgdb.el (elmo-msgdb-set-flag): Use
authorhmurata <hmurata>
Thu, 24 Oct 2002 17:36:10 +0000 (17:36 +0000)
committerhmurata <hmurata>
Thu, 24 Oct 2002 17:36:10 +0000 (17:36 +0000)
`elmo-file-cache-exists-p'; use proper mark that depends on
`use-cache'.
(elmo-msgdb-unset-flag): Ditto.
(elmo-msgdb-set-cached): Ditto. added argument `use-cache'.

* elmo.el (elmo-message-set-cached): Call `elmo-msgdb-set-cached'
with 4th argument `use-cache'.

elmo/ChangeLog
elmo/elmo-msgdb.el
elmo/elmo.el

index 262835e..3bda2b4 100644 (file)
@@ -1,3 +1,14 @@
+2002-10-24  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo-msgdb.el (elmo-msgdb-set-flag): Use
+       `elmo-file-cache-exists-p'; use proper mark that depends on
+       `use-cache'.
+       (elmo-msgdb-unset-flag): Ditto.
+       (elmo-msgdb-set-cached): Ditto. added argument `use-cache'.
+
+       * elmo.el (elmo-message-set-cached): Call `elmo-msgdb-set-cached'
+       with 4th argument `use-cache'.
+
 2002-10-18  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo.el (elmo-folder-unmark-important): Follow the changes above.
index 44fab6b..7424186 100644 (file)
@@ -120,7 +120,7 @@ if MARK is nil, mark is removed."
     ;; return value.
     t))
 
-(defun elmo-msgdb-set-cached (msgdb number cached)
+(defun elmo-msgdb-set-cached (msgdb number cached use-cache)
   "Set message cache status.
 If mark is changed, return non-nil."
   (let* ((cur-mark (elmo-msgdb-get-mark msgdb number))
@@ -131,13 +131,14 @@ If mark is changed, return non-nil."
                       'answered)
                      ((not (member cur-mark (elmo-msgdb-unread-marks)))
                       'read)))
-        (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks)))))
+        (cur-cached (elmo-file-cache-exists-p
+                     (elmo-msgdb-get-field msgdb number 'message-id))))
     (unless (eq cached cur-cached)
       (case cur-flag
        (read
         (elmo-msgdb-set-mark msgdb number
-                             (unless cached
-                               elmo-msgdb-read-uncached-mark)))
+                             (if (and use-cache (not cached))
+                                 elmo-msgdb-read-uncached-mark)))
        (important nil)
        (answered
         (elmo-msgdb-set-mark msgdb number
@@ -168,7 +169,8 @@ FLAG is a symbol which is one of the following:
                     'answered)
                    ((not (member cur-mark (elmo-msgdb-unread-marks)))
                     'read)))
-        (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks))))
+        (cur-cached (elmo-file-cache-exists-p
+                     (elmo-msgdb-get-field msgdb number 'message-id)))
         mark-modified)
     (case flag
       (read
@@ -186,9 +188,7 @@ FLAG is a symbol which is one of the following:
        (unless (or (eq cur-flag 'answered) (eq cur-flag 'important))
         (elmo-msgdb-set-mark msgdb number
                              (if cur-cached
-                                 (if use-cache
-                                     elmo-msgdb-answered-cached-mark
-                                   elmo-msgdb-answered-uncached-mark)
+                                 elmo-msgdb-answered-cached-mark
                                elmo-msgdb-answered-uncached-mark)))
        (setq mark-modified t)))
     (if mark-modified (elmo-folder-set-mark-modified-internal folder t))))
@@ -211,13 +211,14 @@ FLAG is a symbol which is one of the following:
                     'answered)
                    ((not (member cur-mark (elmo-msgdb-unread-marks)))
                     'read)))
-        (cur-cached (not (member cur-mark (elmo-msgdb-uncached-marks))))
+        (cur-cached (elmo-file-cache-exists-p
+                     (elmo-msgdb-get-field msgdb number 'message-id)))
         mark-modified)
     (case flag
       (read
        (when (eq cur-flag 'read)
         (elmo-msgdb-set-mark msgdb number
-                             (if (and cur-cached use-cache)
+                             (if cur-cached
                                  elmo-msgdb-unread-cached-mark
                                elmo-msgdb-unread-uncached-mark))
         (setq mark-modified t)))
@@ -228,7 +229,7 @@ FLAG is a symbol which is one of the following:
       (answered
        (when (eq cur-flag 'answered)
         (elmo-msgdb-set-mark msgdb number
-                             (if (and cur-cached (not use-cache))
+                             (if (and use-cache (not cur-cached))
                                  elmo-msgdb-read-uncached-mark))
         (setq mark-modified t))))
     (if mark-modified (elmo-folder-set-mark-modified-internal folder t))))
index 42f5448..2676cf0 100644 (file)
@@ -1114,8 +1114,10 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).")
 FOLDER is the ELMO folder structure.
 NUMBER is a number of the message.
 If CACHED is t, message mark is set as cached."
-  (when (elmo-msgdb-set-cached
-        (elmo-folder-msgdb folder) number cached)
+  (when (elmo-msgdb-set-cached (elmo-folder-msgdb folder)
+                              number
+                              cached
+                              (elmo-message-use-cache-p folder number))
     (elmo-folder-set-mark-modified-internal folder t)))