From: hmurata Date: Tue, 23 Nov 2004 02:58:44 +0000 (+0000) Subject: * wl-draft.el (wl-draft-do-fcc): No cache save. X-Git-Tag: wl-2_12-root~37 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=a042bf9c4ba9de35aae4f231fe1f2c3c5cf594cd;p=elisp%2Fwanderlust.git * wl-draft.el (wl-draft-do-fcc): No cache save. * elmo.el (elmo-message-flags-for-append): New function. (elmo-generic-folder-append-messages): Use it. * elmo-split.el (elmo-split-subr): Ditto. * elmo-dop.el (elmo-dop-spool-folder-append-buffer): Add argument `flags' and use elmo-folder-append-buffer instead of write-region-as-binary. (elmo-dop-filter-pending-messages): New function. (elmo-folder-append-buffer-dop): Call elmo-dop-spool-folder-append-buffer with `flag'. (elmo-folder-set-flag-dop): Filter messages by elmo-dop-filter-pending-messages. (elmo-folder-unset-flag-dop): Ditto. (elmo-folder-append-buffer-dop-delayed): Use elmo-message-flags-for-append to get flags of the message and simplify. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index d0dd02b..256651e 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,23 @@ +2004-11-23 Hiroya Murata + + * elmo.el (elmo-message-flags-for-append): New function. + (elmo-generic-folder-append-messages): Use it. + + * elmo-split.el (elmo-split-subr): Ditto. + + * elmo-dop.el (elmo-dop-spool-folder-append-buffer): Add argument + `flags' and use elmo-folder-append-buffer instead of + write-region-as-binary. + (elmo-dop-filter-pending-messages): New function. + (elmo-folder-append-buffer-dop): Call + elmo-dop-spool-folder-append-buffer with `flag'. + (elmo-folder-set-flag-dop): Filter messages by + elmo-dop-filter-pending-messages. + (elmo-folder-unset-flag-dop): Ditto. + (elmo-folder-append-buffer-dop-delayed): Use + elmo-message-flags-for-append to get flags of the message and + simplify. + 2004-11-07 Yuuichi Teranishi * elmo-mime.el (elmo-mime-display-as-is): Treat ignore-cache argument. diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index 1aa8215..4841182 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -197,21 +197,16 @@ which is corresponded to the FOLDER." (concat "+" (expand-file-name "spool" (elmo-folder-msgdb-path (, folder))))))) -(defun elmo-dop-spool-folder-append-buffer (folder) +(defun elmo-dop-spool-folder-append-buffer (folder flags) "Append current buffer content to the dop spool folder. FOLDER is the folder structure. Return a message number." - (setq folder (elmo-dop-spool-folder folder)) - (unless (elmo-folder-exists-p folder) - (elmo-folder-create folder)) - (let ((new-number (1+ (car (elmo-folder-status folder))))) - ;; dop folder is a localdir folder. - (write-region-as-binary (point-min) (point-max) - (expand-file-name - (int-to-string new-number) - (elmo-localdir-folder-directory-internal folder)) - nil 'no-msg) - new-number)) + (let ((spool (elmo-dop-spool-folder folder))) + (unless (elmo-folder-exists-p spool) + (elmo-folder-create spool)) + (let ((new-number (1+ (car (elmo-folder-status spool))))) + (elmo-folder-append-buffer spool flags new-number) + new-number))) (defun elmo-dop-spool-folder-list-messages (folder) @@ -235,13 +230,15 @@ FOLDER is the folder structure." 'car (car (elmo-dop-queue-arguments queue))))))))) +(defun elmo-dop-filter-pending-messages (numbers) + (elmo-delete-if (lambda (number) (< number 0)) numbers)) + ;;; DOP operations. (defsubst elmo-folder-append-buffer-dop (folder &optional flag number) (elmo-dop-queue-append folder 'elmo-folder-append-buffer-dop-delayed (list flag - (elmo-dop-spool-folder-append-buffer - folder) + (elmo-dop-spool-folder-append-buffer folder flag) number))) (defsubst elmo-folder-delete-messages-dop (folder numbers) @@ -269,34 +266,36 @@ FOLDER is the folder structure." (elmo-dop-queue-append folder 'elmo-folder-create-dop-delayed nil)) (defsubst elmo-folder-set-flag-dop (folder numbers flag) - (let ((method (case flag - (unread - 'elmo-folder-unset-read-delayed) - (read - 'elmo-folder-set-read-delayed) - (important - 'elmo-folder-set-important-delayed) - (answered - 'elmo-folder-set-answered-delayed)))) - (if method - (elmo-dop-queue-append folder method (list numbers)) - (elmo-dop-queue-append folder 'elmo-folder-set-flag - (list numbers flag))))) + (when (setq numbers (elmo-dop-filter-pending-messages numbers)) + (let ((method (case flag + (unread + 'elmo-folder-unset-read-delayed) + (read + 'elmo-folder-set-read-delayed) + (important + 'elmo-folder-set-important-delayed) + (answered + 'elmo-folder-set-answered-delayed)))) + (if method + (elmo-dop-queue-append folder method (list numbers)) + (elmo-dop-queue-append folder 'elmo-folder-set-flag + (list numbers flag)))))) (defsubst elmo-folder-unset-flag-dop (folder numbers flag) - (let ((method (case flag - (unread - 'elmo-folder-set-read-delayed) - (read - 'elmo-folder-unset-read-delayed) - (important - 'elmo-folder-unset-important-delayed) - (answered - 'elmo-folder-unset-answered-delayed)))) - (if method - (elmo-dop-queue-append folder method (list numbers)) - (elmo-dop-queue-append folder 'elmo-folder-unset-flag - (list numbers flag))))) + (when (setq numbers (elmo-dop-filter-pending-messages numbers)) + (let ((method (case flag + (unread + 'elmo-folder-set-read-delayed) + (read + 'elmo-folder-unset-read-delayed) + (important + 'elmo-folder-unset-important-delayed) + (answered + 'elmo-folder-unset-answered-delayed)))) + (if method + (elmo-dop-queue-append folder method (list numbers)) + (elmo-dop-queue-append folder 'elmo-folder-unset-flag + (list numbers flag)))))) ;;; Execute as subsutitute for plugged operation. (defun elmo-folder-status-dop (folder) @@ -324,37 +323,29 @@ FOLDER is the folder structure." ;;; Delayed operation (executed at online status). (defun elmo-folder-append-buffer-dop-delayed (folder flag number set-number) (let ((spool-folder (elmo-dop-spool-folder folder)) - (flags (cond ((listp flag) - flag) - ;; for compatibility - ((eq flag t) - nil) - (t - (list flag)))) - failure saved dequeued) + flags) (with-temp-buffer - (if (elmo-message-fetch spool-folder number - (elmo-make-fetch-strategy 'entire) - nil (current-buffer) 'unread) - (condition-case nil - (setq failure (not - (elmo-folder-append-buffer - folder - flags - set-number))) - (error (setq failure t))) - (setq dequeued t)) ; Already deletef from queue. - (when failure - ;; Append failed... - (setq saved (elmo-folder-append-buffer - (elmo-make-folder elmo-lost+found-folder) - flags - set-number))) - (if (and (not dequeued) ; if dequeued, no need to delete. - (or (not failure) ; succeed - saved)) ; in lost+found - (elmo-folder-delete-messages spool-folder (list number))) - t))) + (when (elmo-message-fetch spool-folder number + (elmo-make-fetch-strategy 'entire) + nil (current-buffer) 'unread) + (setq flags (or (elmo-message-flags-for-append folder (* -1 number)) + (cond ((listp flag) + flag) + ;; for compatibility with 2.11.12 or earlier + ((eq flag t) + nil) + (t + (list flag))))) + (when (or (condition-case nil + (elmo-folder-append-buffer folder flags set-number) + (error)) + ;; Append failed... + (elmo-folder-append-buffer + (elmo-make-folder elmo-lost+found-folder) + flags)) + (elmo-folder-delete-messages spool-folder (list number))))) + ;; ignore failure (already dequed) + t)) (defun elmo-folder-delete-messages-dop-delayed (folder number-alist) (ignore-errors diff --git a/elmo/elmo-split.el b/elmo/elmo-split.el index 891ef41..3eafd55 100644 --- a/elmo/elmo-split.el +++ b/elmo/elmo-split.el @@ -337,16 +337,7 @@ If prefix argument ARG is specified, do a reharsal (no harm)." nil (current-buffer) 'unread)) (run-hooks 'elmo-split-fetch-hook) (setq elmo-split-message-entity (mime-parse-buffer)) - (setq flags - (let ((this-id (elmo-message-field folder - msg - 'message-id))) - (and this-id - (string= this-id - (elmo-msgdb-get-message-id-from-buffer)) - (or (elmo-message-flags folder msg) - ;; message exists, but no flag. - '(read))))) + (setq flags (elmo-message-flags-for-append folder msg)) (catch 'terminate (dolist (rule (append elmo-split-rule default-rule)) (setq elmo-split-match-string-internal nil) diff --git a/elmo/elmo.el b/elmo/elmo.el index 7a8b781..328205d 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -472,6 +472,19 @@ Return newly created temporary directory name which contains temporary files.") FOLDER is a ELMO folder structure. NUMBER is a number of the message.") +(defun elmo-message-flags-for-append (folder number &optional message-id) + "Return a list of flags for `elmo-folder-append-buffer'. +FOLDER is a ELMO folder structure. +NUMBER is a number of the message. +If optional argument MESSAGES-ID is not specified, get it from current buffer." + (let ((this-id (elmo-message-field folder number 'message-id))) + (and this-id + (string= this-id (or message-id + (elmo-msgdb-get-message-id-from-buffer))) + (or (elmo-message-flags folder number) + ;; message exists, but no flag. + '(read))))) + (luna-define-method elmo-message-flag-available-p ((folder elmo-folder) number flag) (elmo-msgdb-flag-available-p (elmo-folder-msgdb folder) flag)) @@ -1064,13 +1077,7 @@ If optional argument IF-EXISTS is nil, load on demand. (> (buffer-size) 0) (elmo-folder-append-buffer folder - (let ((this-id (elmo-message-field src-folder (car numbers) - 'message-id))) - (and this-id - (string= this-id - (elmo-msgdb-get-message-id-from-buffer)) - (or (elmo-message-flags src-folder (car numbers)) - '(read)))) + (elmo-message-flags-for-append src-folder (car numbers)) (if same-number (car numbers)))))) (error (setq failure t))) ;; FETCH & APPEND finished diff --git a/wl/ChangeLog b/wl/ChangeLog index 434f9cc..cc3179d 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,7 @@ +2004-11-23 Hiroya Murata + + * wl-draft.el (wl-draft-do-fcc): No cache save. + 2004-11-16 Hiroya Murata * wl-summary.el (elmo-event-handler-flag-changed): Use diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 543fb62..643d907 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -1591,14 +1591,8 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed" (goto-char (point-max)) (insert-buffer-substring send-mail-buffer header-end) (let ((id (std11-field-body "Message-ID")) - (elmo-enable-disconnected-operation t) - cache-saved) + (elmo-enable-disconnected-operation t)) (while fcc-list - (unless (or cache-saved - (elmo-folder-plugged-p - (wl-folder-get-elmo-folder (car fcc-list)))) - (elmo-file-cache-save id nil) ;; for disconnected operation - (setq cache-saved t)) (if (elmo-folder-append-buffer (wl-folder-get-elmo-folder (eword-decode-string (car fcc-list)))