* elmo.el (elmo-message-fetch): Define.
authorhmurata <hmurata>
Tue, 8 May 2001 01:38:25 +0000 (01:38 +0000)
committerhmurata <hmurata>
Tue, 8 May 2001 01:38:25 +0000 (01:38 +0000)
(elmo-message-fetch-with-cache-process): New generic method.
(elmo-message-fetch-internal): New generic method.

* elmo-archive.el (elmo-message-fetch-internal): Define.
(elmo-message-fetch): Eliminated.

* elmo-localdir.el (elmo-message-fetch-internal): Define.
(elmo-message-fetch): Eliminated.

* elmo-map.el (elmo-map-message-fetch): Eliminated optional
argument OUTBUF.
(elmo-message-fetch-internal): Define (Renamed from `elmo-message-fetch').

* elmo-cache.el (elmo-message-fetch-with-cache-process): Define.
(elmo-map-message-fetch): Merged with elmo-cache-folder-map-message-fetch.

* elmo-mark.el (elmo-message-fetch-with-cache-process): Define.
(elmo-map-message-fetch): Merged with `elmo-mark-folder-map-message-fetch'.

* elmo-maildir.el (elmo-map-message-fetch): Rewrite.

* elmo-nmz.el (elmo-map-message-fetch): Ditto.

* elmo-shimbun.el (elmo-map-message-fetch): Ditto.

* elmo-net.el (elmo-message-fetch-plugged): Remove cache process.
(elmo-message-fetch-unplugged): New generic method.
(elmo-message-fetch-internal): Remove cache process (Renamed from
`elmo-message-fetch').

* elmo-nntp.el (elmo-message-fetch-with-cache-process): Define.
(elmo-message-fetch): Eliminated.
(elmo-message-fetch-unplugged): Ditto.

* elmo-imap4.el (elmo-message-fetch-unplugged): Remove cache process.

13 files changed:
elmo/ChangeLog
elmo/elmo-archive.el
elmo/elmo-cache.el
elmo/elmo-imap4.el
elmo/elmo-localdir.el
elmo/elmo-maildir.el
elmo/elmo-map.el
elmo/elmo-mark.el
elmo/elmo-net.el
elmo/elmo-nmz.el
elmo/elmo-nntp.el
elmo/elmo-shimbun.el
elmo/elmo.el

index 90de14a..99bdc90 100644 (file)
@@ -1,9 +1,48 @@
+2001-05-08  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo.el (elmo-message-fetch): Define.
+       (elmo-message-fetch-with-cache-process): New generic method.
+       (elmo-message-fetch-internal): New generic method.
+
+       * elmo-archive.el (elmo-message-fetch-internal): Define.
+       (elmo-message-fetch): Eliminated.
+
+       * elmo-localdir.el (elmo-message-fetch-internal): Define.
+       (elmo-message-fetch): Eliminated.
+
+       * elmo-map.el (elmo-map-message-fetch): Eliminated optional
+       argument OUTBUF.
+       (elmo-message-fetch-internal): Define (Renamed from `elmo-message-fetch').
+
+       * elmo-cache.el (elmo-message-fetch-with-cache-process): Define.
+       (elmo-map-message-fetch): Merged with elmo-cache-folder-map-message-fetch.
+
+       * elmo-mark.el (elmo-message-fetch-with-cache-process): Define.
+       (elmo-map-message-fetch): Merged with `elmo-mark-folder-map-message-fetch'.
+
+       * elmo-maildir.el (elmo-map-message-fetch): Rewrite.
+
+       * elmo-nmz.el (elmo-map-message-fetch): Ditto.
+
+       * elmo-shimbun.el (elmo-map-message-fetch): Ditto.
+
+       * elmo-net.el (elmo-message-fetch-plugged): Remove cache process.
+       (elmo-message-fetch-unplugged): New generic method.
+       (elmo-message-fetch-internal): Remove cache process (Renamed from
+       `elmo-message-fetch').
+
+       * elmo-nntp.el (elmo-message-fetch-with-cache-process): Define.
+       (elmo-message-fetch): Eliminated.
+       (elmo-message-fetch-unplugged): Ditto.
+
+       * elmo-imap4.el (elmo-message-fetch-unplugged): Remove cache process.
+
 2001-05-02  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-multi.el (elmo-multi-folder-append-msgdb): Fixed structure
        of `to-be-deleted' from number-alist to number-list.
 
-2001-04-26  Hiroya Murata  <hiroya@use-ebisu.co.jp>
+2001-04-26  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-pipe.el (elmo-folder-unmark-important): Fixed typo.
        (elmo-folder-mark-as-important): Ditto.
@@ -22,7 +61,7 @@
 
        * elmo.el (elmo-generic-folder-append-msgdb): Ditto.
 
-2001-04-24  Hiroya Murata  <hiroya@use-ebisu.co.jp>
+2001-04-24  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-util.el (elmo-list-subdirectories-1): New function.
        (elmo-list-subdirectories): Use `elmo-list-subdirectories-1'.
index 6d3f891..e6b768e 100644 (file)
@@ -539,16 +539,10 @@ TYPE specifies the archiver's symbol."
        (elmo-archive-call-method method args t))
        (elmo-delete-cr-buffer)))))
 
-(luna-define-method elmo-message-fetch ((folder elmo-archive-folder)
-                                       number strategy &optional section 
-                                       outbuf unseen)
-  (if outbuf
-      (with-current-buffer outbuf
-       (elmo-archive-message-fetch-internal folder number)
-       t)
-    (with-temp-buffer
-      (elmo-archive-message-fetch-internal folder number)
-      (buffer-string))))
+(luna-define-method elmo-message-fetch-internal ((folder elmo-archive-folder)
+                                                number strategy
+                                                &optional section unseen)
+  (elmo-archive-message-fetch-internal folder number))
 
 (luna-define-method elmo-folder-append-buffer ((folder elmo-archive-folder)
                                               unread &optional number)
index 6631534..7c4e308 100644 (file)
      (expand-file-name location
                       (elmo-cache-folder-directory-internal folder)))))
 
-(defsubst elmo-cache-folder-map-message-fetch (folder location strategy
-                                                     section outbuf unseen)
+(luna-define-method elmo-message-fetch-with-cache-process
+  ((folder elmo-cache-folder) number strategy &optional section unseen)
+  ;; disbable cache process
+  (elmo-message-fetch-internal folder number strategy section unseen))
+
+(luna-define-method elmo-map-message-fetch ((folder elmo-cache-folder)
+                                           location strategy
+                                           &optional section unseen)
   (let ((file (expand-file-name
               location
               (elmo-cache-folder-directory-internal folder))))
     (when (file-exists-p file)
-      (if outbuf
-         (with-current-buffer outbuf
-           (erase-buffer)
-           (insert-file-contents-as-binary file)
-           (elmo-delete-cr-buffer)
-           t)
-       (with-temp-buffer
-         (insert-file-contents-as-binary file)
-         (elmo-delete-cr-buffer)
-         (buffer-string))))))
-
-(luna-define-method elmo-map-message-fetch ((folder elmo-cache-folder)
-                                           location strategy &optional
-                                           section outbuf unseen)
-  (elmo-cache-folder-map-message-fetch folder location strategy
-                                      section outbuf unseen))
+      (insert-file-contents-as-binary file))))
 
 (luna-define-method elmo-folder-creatable-p ((folder elmo-cache-folder))
   nil)
index fe13a15..a515a51 100644 (file)
@@ -2427,21 +2427,9 @@ If optional argument REMOVE is non-nil, remove FLAG."
 (luna-define-method elmo-message-fetch-unplugged
   ((folder elmo-imap4-folder)
    number strategy  &optional section outbuf unseen)
-  (let ((cache-file (elmo-file-cache-expand-path
-                    (elmo-fetch-strategy-cache-path strategy)
-                    section)))
-    (if (and (elmo-fetch-strategy-use-cache strategy)
-            (file-exists-p cache-file))
-       (if outbuf
-           (with-current-buffer outbuf
-             (insert-file-contents-as-binary cache-file)
-             t)
-         (with-temp-buffer
-           (insert-file-contents-as-binary cache-file)
-           (buffer-string)))
-      (error "%d%s is not cached." number (if section
-                                             (format "(%s)" section)
-                                           "")))))
+  (error "%d%s is not cached." number (if section
+                                         (format "(%s)" section)
+                                       "")))
 
 (defsubst elmo-imap4-message-fetch (folder number strategy
                                           section outbuf unseen)
index 3d6adab..3d9358e 100644 (file)
       (delete-file filename)
       t)))
 
-(luna-define-method elmo-message-fetch ((folder elmo-localdir-folder)
-                                       number strategy
-                                       &optional section outbuf unseen)
-  ;; strategy, section, unseen is ignored.
-  (if outbuf
-      (with-current-buffer outbuf
-       (erase-buffer)
-       (when (file-exists-p (elmo-message-file-name folder number))
-         (insert-file-contents-as-binary
-          (elmo-message-file-name folder number))
-         (elmo-delete-cr-buffer))
-       t)
-    (with-temp-buffer
-      (when (file-exists-p (elmo-message-file-name folder number))
-       (insert-file-contents-as-binary (elmo-message-file-name folder number))
-       (elmo-delete-cr-buffer))
-      (buffer-string))))
+(luna-define-method elmo-message-fetch-internal ((folder elmo-localdir-folder)
+                                                number strategy
+                                                &optional section unread)
+  (when (file-exists-p (elmo-message-file-name folder number))
+    (insert-file-contents-as-binary
+     (elmo-message-file-name folder number))))
 
 (luna-define-method elmo-folder-list-messages-internal
   ((folder elmo-localdir-folder) &optional nohide)
index 0c8b315..4bd8a08 100644 (file)
@@ -418,20 +418,11 @@ file name for maildir directories."
          (delete-file file)))))
 
 (luna-define-method elmo-map-message-fetch ((folder elmo-maildir-folder)
-                                           location strategy &optional
-                                           section outbuf unseen)
+                                           location strategy
+                                           &optional section unseen)
   (let ((file (elmo-maildir-message-file-name folder location)))
     (when (file-exists-p file)
-      (if outbuf
-         (with-current-buffer outbuf
-           (erase-buffer)
-           (insert-file-contents-as-binary file)
-           (elmo-delete-cr-buffer)
-           t)
-       (with-temp-buffer
-         (insert-file-contents-as-binary file)
-         (elmo-delete-cr-buffer)
-         (buffer-string))))))
+      (insert-file-contents-as-binary file))))
 
 (luna-define-method elmo-folder-exists-p ((folder elmo-maildir-folder))
   (let ((basedir (elmo-maildir-folder-directory-internal folder)))
index d36d1b0..5b10067 100644 (file)
@@ -78,7 +78,7 @@
                                                    strategy
                                                    &optional
                                                    section
-                                                   outbuf unseen)
+                                                   unseen)
   "")
 
 (luna-define-generic elmo-map-folder-list-unreads (folder)
    folder
    (elmo-map-folder-numbers-to-locations folder numbers)))
 
-(luna-define-method elmo-message-fetch ((folder elmo-map-folder) number
-                                       strategy section outbuf unread)
+(luna-define-method elmo-message-fetch-internal ((folder elmo-map-folder)
+                                                number strategy
+                                                &optional section unread)
   (elmo-map-message-fetch
    folder
    (elmo-map-message-location folder number)
-   strategy section outbuf unread))
+   strategy section unread))
 
 (luna-define-method elmo-folder-list-unreads-internal
   ((folder elmo-map-folder) unread-marks &optional mark-alist)
index 03bf8d3..4e3a4d0 100644 (file)
   (dolist (location locations)
     (elmo-msgdb-global-mark-delete location)))
 
-(luna-define-method elmo-map-message-fetch ((folder elmo-mark-folder)
-                                           location strategy &optional
-                                           section outbuf unseen)
-  (elmo-mark-folder-map-message-fetch folder location strategy
-                                     section outbuf unseen))
+(luna-define-method elmo-message-fetch-with-cache-process
+  ((folder elmo-cache-folder) number strategy &optional section unseen)
+  ;; disbable cache process
+  (elmo-message-fetch-internal folder number strategy section unseen))
 
-(defun elmo-mark-folder-map-message-fetch (folder location strategy
-                                                 section outbuf unseen)
+(luna-define-method elmo-map-message-fetch ((folder elmo-mark-folder)
+                                           location strategy
+                                           &optional section unseen)
   (let ((file (elmo-file-cache-get-path location)))
     (when (file-exists-p file)
-      (if outbuf
-         (with-current-buffer outbuf
-           (erase-buffer)
-           (insert-file-contents-as-binary file)
-           (elmo-delete-cr-buffer)
-           t)
-       (with-temp-buffer
-         (insert-file-contents-as-binary file)
-         (elmo-delete-cr-buffer)
-         (buffer-string))))))
+      (insert-file-contents-as-binary file))))
 
 (luna-define-method elmo-folder-exists-p ((folder elmo-mark-folder))
   t)
index 9d4c1e6..19208ec 100644 (file)
@@ -413,69 +413,34 @@ Returns a process object.  if making session failed, returns nil."
         folder 'elmo-folder-mark-as-read-unplugged numbers))
     t))
 
-(luna-define-method elmo-message-fetch ((folder elmo-net-folder)
-                                       number strategy
-                                       &optional section
-                                       outbuf
-                                       unseen)
+(luna-define-generic elmo-message-fetch-plugged (folder number strategy
+                                                       &optional
+                                                       section
+                                                       outbuf
+                                                       unseen)
+  "")
+
+(luna-define-generic elmo-message-fetch-unplugged (folder number strategy
+                                                         &optional
+                                                         section
+                                                         outbuf
+                                                         unseen)
+  "")
+
+(luna-define-method elmo-message-fetch-internal ((folder elmo-net-folder)
+                                                number strategy
+                                                &optional section unseen)
   (if (elmo-folder-plugged-p folder)
-      (let ((cache-file (elmo-file-cache-expand-path
-                        (elmo-fetch-strategy-cache-path strategy)
-                        section)))
-       (if (and (elmo-fetch-strategy-use-cache strategy)
-                (file-exists-p cache-file))
-           (if outbuf
-               (with-current-buffer outbuf
-                 (insert-file-contents-as-binary cache-file)
-                 t)
-             (with-temp-buffer
-               (insert-file-contents-as-binary cache-file)
-               (buffer-string)))
-         (if outbuf
-             (with-current-buffer outbuf
-               (elmo-folder-send folder 'elmo-message-fetch-plugged
-                                 number strategy section
+      (elmo-message-fetch-plugged folder number
+                                 strategy section
                                  (current-buffer) unseen)
-               (elmo-delete-cr-buffer)
-               (when (and (> (buffer-size) 0)
-                          (elmo-fetch-strategy-save-cache strategy)
-                          (elmo-fetch-strategy-cache-path strategy))
-                 (elmo-file-cache-save
-                  (elmo-fetch-strategy-cache-path strategy)
-                  section))
-               t)
-           (with-temp-buffer
-             (elmo-folder-send folder 'elmo-message-fetch-plugged
-                               number strategy section
-                               (current-buffer) unseen)
-             (elmo-delete-cr-buffer)
-             (when (and (> (buffer-size) 0)
-                        (elmo-fetch-strategy-save-cache strategy)
-                        (elmo-fetch-strategy-cache-path strategy))
-               (elmo-file-cache-save
-                (elmo-fetch-strategy-cache-path strategy)
-                section))
-             (buffer-string)))))
-    (elmo-folder-send folder 'elmo-message-fetch-unplugged
-                     number strategy section outbuf unseen)))
+    (elmo-message-fetch-unplugged folder number
+                                 strategy section
+                                 (current-buffer) unseen)))
 
 (luna-define-method elmo-message-fetch-unplugged
   ((folder elmo-net-folder) number strategy  &optional section outbuf unseen)
-  (if (elmo-fetch-strategy-use-cache strategy)
-      (if outbuf
-         (with-current-buffer outbuf
-           (insert-file-contents-as-binary
-            (elmo-file-cache-expand-path
-             (elmo-fetch-strategy-cache-path strategy)
-             section))
-           t)
-       (with-temp-buffer
-         (insert-file-contents-as-binary
-          (elmo-file-cache-expand-path
-           (elmo-fetch-strategy-cache-path strategy)
-           section))
-         (buffer-string)))
-    (error "Unplugged")))
+  (error "Unplugged"))
 
 (luna-define-method elmo-folder-check ((folder elmo-net-folder))
   (if (elmo-folder-plugged-p folder)
index 0bb4bb4..c361f20 100644 (file)
     temp-dir))
 
 (luna-define-method elmo-map-message-fetch ((folder elmo-nmz-folder)
-                                           location strategy &optional
-                                           section outbuf unseen)
-  (if outbuf
-      (with-current-buffer outbuf
-       (erase-buffer)
-       (when (file-exists-p location)
-         (insert-file-contents-as-binary location)
-         (elmo-delete-cr-buffer)
-         t))
-    (with-temp-buffer
-      (insert-file-contents-as-binary location)
-      (elmo-delete-cr-buffer)
-      (buffer-string))))
+                                           location strategy
+                                           &optional section unseen)
+  (when (file-exists-p location)
+    (insert-file-contents-as-binary location)))
 
 (luna-define-method elmo-map-folder-list-message-locations
   ((folder elmo-nmz-folder))
index cb4d468..d2500f6 100644 (file)
@@ -965,57 +965,12 @@ Don't cache if nil.")
       (with-current-buffer (elmo-network-session-buffer session)
        (std11-field-body "Newsgroups")))))
 
-(luna-define-method elmo-message-fetch ((folder elmo-nntp-folder)
-                                       number strategy
-                                       &optional section
-                                       outbuf
-                                       unread)
-  (if (elmo-folder-plugged-p folder)
-      (let ((cache-file (elmo-file-cache-expand-path
-                        (elmo-fetch-strategy-cache-path strategy)
-                        section)))
-       (if (and (elmo-fetch-strategy-use-cache strategy)
-                (file-exists-p cache-file))
-           (if outbuf
-               (with-current-buffer outbuf
-                 (insert-file-contents-as-binary cache-file)
-                 (elmo-nntp-setup-crosspost-buffer folder number)
-                 (unless unread
-                   (elmo-nntp-folder-update-crosspost-message-alist
-                    folder (list number)))
-                 t)
-             (with-temp-buffer
-               (insert-file-contents-as-binary cache-file)
-               (elmo-nntp-setup-crosspost-buffer folder number)
-               (unless unread
-                 (elmo-nntp-folder-update-crosspost-message-alist
-                  folder (list number)))
-               (buffer-string)))
-         (if outbuf
-             (with-current-buffer outbuf
-               (elmo-folder-send folder 'elmo-message-fetch-plugged
-                                 number strategy section
-                                 (current-buffer) unread)
-               (elmo-delete-cr-buffer)
-               (when (and (> (buffer-size) 0)
-                          (elmo-fetch-strategy-save-cache strategy))
-                 (elmo-file-cache-save
-                  (elmo-fetch-strategy-cache-path strategy)
-                  section))
-               t)
-           (with-temp-buffer
-             (elmo-folder-send folder 'elmo-message-fetch-plugged
-                               number strategy section
-                               (current-buffer) unread)
-             (elmo-delete-cr-buffer)
-             (when (and (> (buffer-size) 0)
-                        (elmo-fetch-strategy-save-cache strategy))
-               (elmo-file-cache-save
-                (elmo-fetch-strategy-cache-path strategy)
-                section))
-             (buffer-string)))))
-    (elmo-folder-send folder 'elmo-message-fetch-unplugged
-                     number strategy section outbuf unread)))
+(luna-define-method elmo-message-fetch-with-cache-process :after
+  ((folder elmo-nntp-folder) number strategy &optional section unread)
+  (elmo-nntp-setup-crosspost-buffer folder number)
+  (unless unread
+    (elmo-nntp-folder-update-crosspost-message-alist
+     folder (list number))))
 
 (luna-define-method elmo-message-fetch-plugged ((folder elmo-nntp-folder)
                                                number strategy
@@ -1023,34 +978,6 @@ Don't cache if nil.")
                                                unread)
   (elmo-nntp-message-fetch folder number strategy section outbuf unread))
 
-(luna-define-method elmo-message-fetch-unplugged ((folder elmo-nntp-folder)
-                                                 number strategy
-                                                 &optional section outbuf
-                                                 unread)
-  (if (elmo-fetch-strategy-use-cache strategy)
-      (if outbuf
-         (with-current-buffer outbuf
-           (insert-file-contents-as-binary
-            (elmo-file-cache-expand-path
-             (elmo-fetch-strategy-cache-path strategy)
-             section))
-           (elmo-nntp-setup-crosspost-buffer folder number)
-           (unless unread
-             (elmo-nntp-folder-update-crosspost-message-alist
-              folder (list number)))
-           t)
-       (with-temp-buffer
-         (insert-file-contents-as-binary
-          (elmo-file-cache-expand-path
-           (elmo-fetch-strategy-cache-path strategy)
-           section))
-         (elmo-nntp-setup-crosspost-buffer folder number)
-         (unless unread
-           (elmo-nntp-folder-update-crosspost-message-alist
-            folder (list number)))
-         (buffer-string)))
-    (error "Unplugged")))
-
 (defun elmo-nntp-message-fetch (folder number strategy section outbuf unread)
   (let ((session (elmo-nntp-get-session folder))
        newsgroups)
index 11d3169..16eb0b8 100644 (file)
   nil)
 
 (luna-define-method elmo-map-message-fetch ((folder elmo-shimbun-folder)
-                                           location strategy &optional
-                                           section outbuf unseen)
-  (if outbuf
-      (with-current-buffer outbuf
-       (erase-buffer)
-       (shimbun-article (elmo-shimbun-folder-shimbun-internal folder)
-                        (elmo-get-hash-val
-                         location
-                         (elmo-shimbun-folder-header-hash-internal folder)))
-       t)
-    (with-temp-buffer
-      (shimbun-article (elmo-shimbun-folder-shimbun-internal folder)
-                      (elmo-get-hash-val
-                       location
-                       (elmo-shimbun-folder-header-hash-internal folder)))
-      (buffer-string))))
+                                           location strategy
+                                           &optional section unseen)
+  (shimbun-article (elmo-shimbun-folder-shimbun-internal folder)
+                  (elmo-get-hash-val
+                   location
+                   (elmo-shimbun-folder-header-hash-internal folder))))
 
 (luna-define-method elmo-folder-list-messages-internal :around
   ((folder elmo-shimbun-folder) &optional nohide)
index 70245f1..7157b15 100644 (file)
@@ -527,6 +527,33 @@ inserted to the buffer and returns t if fetch was ended successfully.
 If third optional argument UNREAD is non-nil, message is not marked as read.
 Returns non-nil if fetching was succeed.")
 
+(luna-define-generic elmo-message-fetch-with-cache-process (folder
+                                                           number strategy
+                                                           &optional
+                                                           section
+                                                           unread)
+  "Fetch a message into current buffer with cache process.
+FOLDER is the ELMO folder structure.
+NUMBER is the number of the message in the FOLDER.
+STRATEGY is the message fetching strategy.
+If optional argument SECTION is specified, only the SECTION of the message
+is fetched (if possible).
+If second optional argument UNREAD is non-nil, message is not marked as read.
+Returns non-nil if fetching was succeed.")
+
+(luna-define-generic elmo-message-fetch-internal (folder number strategy
+                                                        &optional
+                                                        section
+                                                        unread)
+  "Fetch a message into current buffer.
+FOLDER is the ELMO folder structure.
+NUMBER is the number of the message in the FOLDER.
+STRATEGY is the message fetching strategy.
+If optional argument SECTION is specified, only the SECTION of the message
+is fetched (if possible).
+If second optional argument UNREAD is non-nil, message is not marked as read.
+Returns non-nil if fetching was succeed.")
+
 (luna-define-generic elmo-message-folder (folder number)
   "Get primitive folder of the message.")
 
@@ -1053,6 +1080,43 @@ FIELD is a symbol of the field."
          (nthcdr (max (- len elmo-folder-update-threshold) 0) appends)
        appends))))
 
+(luna-define-method elmo-message-fetch ((folder elmo-folder)
+                                       number strategy
+                                       &optional
+                                       section
+                                       outbuf
+                                       unread)
+  (if outbuf
+      (with-current-buffer outbuf
+       (erase-buffer)
+       (elmo-message-fetch-with-cache-process folder number
+                                              strategy section unread)
+       t)
+    (with-temp-buffer
+      (elmo-message-fetch-with-cache-process folder number
+                                            strategy section unread)
+      (buffer-string))))
+
+(luna-define-method elmo-message-fetch-with-cache-process ((folder elmo-folder)
+                                                          number strategy
+                                                          &optional
+                                                          section unread)
+  (let (cache-file)
+    (if (and (elmo-fetch-strategy-use-cache strategy)
+            (setq cache-file (elmo-file-cache-expand-path
+                              (elmo-fetch-strategy-cache-path strategy)
+                              section))
+            (file-exists-p cache-file))
+       (insert-file-contents-as-binary cache-file)
+      (elmo-message-fetch-internal folder number strategy section unread)
+      (elmo-delete-cr-buffer)
+      (when (and (> (buffer-size) 0)
+                (elmo-fetch-strategy-save-cache strategy)
+                (elmo-fetch-strategy-cache-path strategy))
+       (elmo-file-cache-save
+        (elmo-fetch-strategy-cache-path strategy)
+        section)))))
+
 (defun elmo-folder-synchronize (folder
                                new-mark             ;"N"
                                unread-uncached-mark ;"U"