(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-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.
* 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'.
(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)
(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)
(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)
(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)
(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)))
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)
(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)
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)
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))
(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
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)
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)
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.")
(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"