From 963a7ca47207d75bc4765071cc23c6d431d1c892 Mon Sep 17 00:00:00 2001 From: yoichi Date: Sat, 10 Apr 2004 15:39:19 +0000 Subject: [PATCH] * elmo.el (elmo-folder-append-buffer): Add note on return value. * elmo-cache.el (elmo-folder-append-buffer): Return nil on failure. * elmo-localdir.el (elmo-folder-append-buffer): Ditto. * elmo-split.el (elmo-split-subr): Check return value of elmo-folder-append-buffer. * elmo-localdir.el (elmo-folder-append-buffer): Create flag-table. * elmo-cache.el (elmo-folder-append-buffer): Check existence of message-id. --- elmo/ChangeLog | 13 +++++++++++++ elmo/elmo-cache.el | 20 ++++++++++++-------- elmo/elmo-localdir.el | 9 ++++++++- elmo/elmo-split.el | 2 +- elmo/elmo.el | 3 ++- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index ed67ea1..d1c684a 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,16 @@ +2004-04-11 Yoichi NAKAYAMA + + * elmo.el (elmo-folder-append-buffer): Add note on return value. + * elmo-cache.el (elmo-folder-append-buffer): Return nil on failure. + * elmo-localdir.el (elmo-folder-append-buffer): Ditto. + * elmo-split.el (elmo-split-subr): Check return value of + elmo-folder-append-buffer. + + * elmo-localdir.el (elmo-folder-append-buffer): Create flag-table. + + * elmo-cache.el (elmo-folder-append-buffer): Check existence of + message-id. + 2004-04-10 Yoichi NAKAYAMA * elmo-split.el (elmo-split-subr): Append message with flag. diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index 31fb023..c09a95f 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -116,14 +116,18 @@ &optional flag number) ;; dir-name is changed according to msgid. (unless (elmo-cache-folder-dir-name-internal folder) - (let* ((file (elmo-file-cache-get-path (std11-field-body "message-id"))) - (dir (directory-file-name (file-name-directory file)))) - (unless (file-exists-p dir) - (elmo-make-directory dir)) - (when (file-writable-p file) - (write-region-as-binary - (point-min) (point-max) file nil 'no-msg)))) - t) + (let ((msgid (std11-field-body "message-id")) + file dir) + (when msgid + (setq file (elmo-file-cache-get-path msgid)) + (setq dir (directory-file-name (file-name-directory file))) + (unless (file-exists-p dir) + (elmo-make-directory dir)) + (when (and (file-writable-p file) + (not (file-exists-p file))) + (write-region-as-binary + (point-min) (point-max) file nil 'no-msg) + t))))) (luna-define-method elmo-map-folder-delete-messages ((folder elmo-cache-folder) locations) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index 8ba51cb..6eae055 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -202,9 +202,16 @@ folder (or number (1+ (car (elmo-folder-status folder))))))) - (when (file-writable-p filename) + (when (and (file-writable-p filename) + (not (file-exists-p filename))) (write-region-as-binary (point-min) (point-max) filename nil 'no-msg) + (let* ((path (elmo-folder-msgdb-path folder)) + (table (elmo-flag-table-load path)) + (msgid (std11-field-body "message-id"))) + (when msgid + (elmo-flag-table-set table msgid flag) + (elmo-flag-table-save path table))) t))) (luna-define-method elmo-folder-append-messages :around diff --git a/elmo/elmo-split.el b/elmo/elmo-split.el index cbd4f19..24485c4 100644 --- a/elmo/elmo-split.el +++ b/elmo/elmo-split.el @@ -348,7 +348,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)." action))) (elmo-folder-create target-folder))) (elmo-folder-open-internal target-folder) - (elmo-folder-append-buffer target-folder (or flags '(read))) + (setq failure (not (elmo-folder-append-buffer target-folder (or flags '(read))))) (elmo-folder-close-internal target-folder)) (error (setq failure t) (incf fcount))) diff --git a/elmo/elmo.el b/elmo/elmo.el index b4e0675..717a850 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -378,7 +378,8 @@ FOLDER is the ELMO folder structure.") FOLDER is the destination folder(ELMO folder structure). FLAG is the status of appended message. If optional argument NUMBER is specified, the new message number is set -\(if possible\).") +\(if possible\). +Return nil on failure.") (luna-define-generic elmo-folder-append-messages (folder src-folder -- 1.7.10.4