* elmo.el (elmo-message-fetch-with-cache-process): Rewrite.
authorhmurata <hmurata>
Tue, 25 Dec 2001 12:23:16 +0000 (12:23 +0000)
committerhmurata <hmurata>
Tue, 25 Dec 2001 12:23:16 +0000 (12:23 +0000)
elmo/ChangeLog
elmo/elmo.el

index 6ad0a89..c88d65b 100644 (file)
@@ -1,3 +1,7 @@
+2001-12-25  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo.el (elmo-message-fetch-with-cache-process): Rewrite.
+
 2001-12-23  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo.el (elmo-generic-folder-append-messages): Make
index 3edc6ad..49a8794 100644 (file)
@@ -1175,25 +1175,36 @@ FIELD is a symbol of the field."
                                                           &optional
                                                           section unread)
   (let ((cache-path (elmo-fetch-strategy-cache-path strategy))
-       err)
-    (or (and (eq (elmo-fetch-strategy-use-cache strategy) t)
-            (elmo-file-cache-load cache-path section))
-       (when (and (condition-case error
-                      (elmo-message-fetch-internal folder number
-                                                   strategy
-                                                   section
-                                                   unread)
-                    (error (setq err error) nil))
-                  (> (buffer-size) 0))
-         (elmo-delete-cr-buffer)
-         (when (and (elmo-fetch-strategy-save-cache strategy)
-                    cache-path)
-           (elmo-file-cache-save cache-path section))
-         t)
-       (and (eq (elmo-fetch-strategy-use-cache strategy) 'maybe)
-            (elmo-file-cache-load cache-path section))
-       (and err
-            (signal (car err) (cdr err))))))
+       (method-priorities
+        (cond ((eq (elmo-fetch-strategy-use-cache strategy) 'meybe)
+               '(entity cache))
+              ((elmo-fetch-strategy-use-cache strategy)
+               '(cache entity))
+              (t
+               '(entity))))
+       result err)
+    (while (and method-priorities
+               (null result))
+      (setq result
+           (case (car method-priorities)
+             (cache
+              (elmo-file-cache-load cache-path section))
+             (entity
+              (when (and (condition-case error
+                             (elmo-message-fetch-internal folder number
+                                                          strategy
+                                                          section
+                                                          unread)
+                           (error (setq err error) nil))
+                         (> (buffer-size) 0))
+                (elmo-delete-cr-buffer)
+                (when (and (elmo-fetch-strategy-save-cache strategy)
+                           cache-path)
+                  (elmo-file-cache-save cache-path section))
+                t)))
+           method-priorities (cdr method-priorities)))
+    (or result
+       (and err (signal (car err) (cdr err))))))
 
 (luna-define-method elmo-folder-clear ((folder elmo-folder)
                                       &optional keep-killed)