From: hmurata Date: Thu, 13 Dec 2001 14:27:04 +0000 (+0000) Subject: * elmo-pipe.el (elmo-pipe-folder-copied-filename): New variable. X-Git-Tag: wl-2_8-root~11 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=75f8b9f82e020e579f0c1843b17b417ecc65d961;p=elisp%2Fwanderlust.git * elmo-pipe.el (elmo-pipe-folder-copied-filename): New variable. (elmo-pipe-folder-list-target-messages): New internal function. (elmo-pipe-drain): Use new argument `ignore-list' instead of `killed-list'. (elmo-pipe-folder-copied-list-load): New function. (elmo-pipe-folder-copied-list-save): Ditto. (elmo-folder-open-internal): Follow the change above. (elmo-folder-status): Fixed for copy. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 4afca3b..978e04c 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,14 @@ +2001-12-13 Hiroya Murata + + * elmo-pipe.el (elmo-pipe-folder-copied-filename): New variable. + (elmo-pipe-folder-list-target-messages): New internal function. + (elmo-pipe-drain): Use new argument `ignore-list' instead of + `killed-list'. + (elmo-pipe-folder-copied-list-load): New function. + (elmo-pipe-folder-copied-list-save): Ditto. + (elmo-folder-open-internal): Follow the change above. + (elmo-folder-status): Fixed for copy. + 2001-12-13 Yuuichi Teranishi * elmo-shimbun.el (elmo-folder-creatable-p): Define. diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index 0d8f999..f2cfdcf 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -31,6 +31,9 @@ (require 'elmo) +(defvar elmo-pipe-folder-copied-filename "copied" + "Copied messages number set.") + ;;; ELMO pipe folder (eval-and-compile (luna-define-class elmo-pipe-folder (elmo-folder) @@ -97,47 +100,74 @@ (defvar elmo-pipe-drained-hook nil "A hook called when the pipe is flushed.") -(defun elmo-pipe-drain (src dst copy) - "Move all messages of SRC to DST." +(defsubst elmo-pipe-folder-list-target-messages (src &optional ignore-list) + (unwind-protect + (progn + (elmo-folder-set-killed-list-internal src ignore-list) + (elmo-folder-list-messages src)) + (elmo-folder-set-killed-list-internal src nil))) + +(defun elmo-pipe-drain (src dst &optional copy ignore-list) + "Move or copy all messages of SRC to DST." (let ((elmo-inhibit-number-mapping (not copy)) ; No need to use UIDL msgs len) (message "Checking %s..." (elmo-folder-name-internal src)) ;; Warnnig: some function requires msgdb ;; but elmo-folder-open-internal do not load msgdb. (elmo-folder-open-internal src) - (elmo-folder-set-killed-list-internal - src - (elmo-msgdb-killed-list-load (elmo-folder-msgdb-path src))) - (setq msgs (elmo-folder-list-messages src) + (setq msgs (elmo-pipe-folder-list-target-messages src ignore-list) len (length msgs)) (when (> len elmo-display-progress-threshold) (elmo-progress-set 'elmo-folder-move-messages - len "Moving messages...")) + len + (if copy + "Copying messages..." + "Moving messages..."))) (unwind-protect (elmo-folder-move-messages src msgs dst nil nil copy) (elmo-progress-clear 'elmo-folder-move-messages)) - (if (and copy msgs) - (progn - (elmo-msgdb-append-to-killed-list src msgs) - ;; for save killed-list instead of elmo-folder-close-internal - (elmo-msgdb-killed-list-save - (elmo-folder-msgdb-path src) - (elmo-folder-killed-list-internal src))))) - ;; Don't save msgdb here. - ;; Because summary view of original folder is not updated yet. - (elmo-folder-close-internal src) - (elmo-folder-set-killed-list-internal src nil) - (run-hooks 'elmo-pipe-drained-hook)) + (when (and copy msgs) + (setq ignore-list (elmo-number-set-append-list ignore-list + msgs))) + ;; Don't save msgdb here. + ;; Because summary view of original folder is not updated yet. + (elmo-folder-close-internal src) + (run-hooks 'elmo-pipe-drained-hook) + ignore-list)) + +(defun elmo-pipe-folder-copied-list-load (folder) + (elmo-object-load + (expand-file-name elmo-pipe-folder-copied-filename + (expand-file-name + (elmo-replace-string-as-filename + (elmo-folder-name-internal folder)) + (expand-file-name "pipe" elmo-msgdb-directory))) + nil t)) + +(defun elmo-pipe-folder-copied-list-save (folder copied-list) + (elmo-object-save + (expand-file-name elmo-pipe-folder-copied-filename + (expand-file-name + (elmo-replace-string-as-filename + (elmo-folder-name-internal folder)) + (expand-file-name "pipe" elmo-msgdb-directory))) + copied-list)) (luna-define-method elmo-folder-open-internal ((folder elmo-pipe-folder)) (elmo-folder-open-internal (elmo-pipe-folder-dst-internal folder)) (let ((src-folder (elmo-pipe-folder-src-internal folder)) - (dst-folder (elmo-pipe-folder-dst-internal folder)) - (copy (elmo-pipe-folder-copy-internal folder))) + (dst-folder (elmo-pipe-folder-dst-internal folder))) (when (and (elmo-folder-plugged-p src-folder) (elmo-folder-plugged-p dst-folder)) - (elmo-pipe-drain src-folder dst-folder copy)))) + (if (elmo-pipe-folder-copy-internal folder) + (elmo-pipe-folder-copied-list-save + folder + (elmo-pipe-drain src-folder + dst-folder + 'copy + (elmo-pipe-folder-copied-list-load folder))) + (elmo-pipe-drain src-folder dst-folder))))) (luna-define-method elmo-folder-close-internal ((folder elmo-pipe-folder)) (elmo-folder-close-internal(elmo-pipe-folder-dst-internal folder))) @@ -160,9 +190,11 @@ (luna-define-method elmo-folder-status ((folder elmo-pipe-folder)) (elmo-folder-open-internal (elmo-pipe-folder-src-internal folder)) (elmo-folder-open-internal (elmo-pipe-folder-dst-internal folder)) - (let* ((elmo-inhibit-number-mapping t) - (src-length (length (elmo-folder-list-messages - (elmo-pipe-folder-src-internal folder)))) + (let* ((elmo-inhibit-number-mapping + (not (elmo-pipe-folder-copy-internal folder))) + (src-length (length (elmo-pipe-folder-list-target-messages + (elmo-pipe-folder-src-internal folder) + (elmo-pipe-folder-copied-list-load folder)))) (dst-list (elmo-folder-list-messages (elmo-pipe-folder-dst-internal folder)))) (prog1 (cons (+ src-length (elmo-max-of-list dst-list))