From 2706485848c7fabd109477e1d7fad89a6249f0b2 Mon Sep 17 00:00:00 2001 From: dmaus Date: Mon, 9 Aug 2010 19:17:28 +0000 Subject: [PATCH] * elmo.el (elmo-folder-open-internal-p): New luna method. (elmo-folder-move-messages): Open source folder only if necessary. * elmo-pipe.el (elmo-folder-open-internal-p): New luna method. * elmo-multi.el (elmo-folder-open-internal-p): Dto. * elmo-map.el (elmo-folder-open-internal-p): Dto. * elmo-filter.el (elmo-folder-open-internal-p): Dto. --- elmo/ChangeLog | 9 +++++++++ elmo/elmo-filter.el | 3 +++ elmo/elmo-map.el | 3 +++ elmo/elmo-multi.el | 5 +++++ elmo/elmo-pipe.el | 3 +++ elmo/elmo.el | 10 +++++++++- 6 files changed, 32 insertions(+), 1 deletion(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 5af96fb..90dd1ad 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,12 @@ +2010-08-09 David Maus + + * elmo.el (elmo-folder-open-internal-p): New luna method. + (elmo-folder-move-messages): Open source folder only if necessary. + * elmo-pipe.el (elmo-folder-open-internal-p): New luna method. + * elmo-multi.el (elmo-folder-open-internal-p): Dto. + * elmo-map.el (elmo-folder-open-internal-p): Dto. + * elmo-filter.el (elmo-folder-open-internal-p): Dto. + 2010-08-01 David Maus * elmo.el (elmo-folder-move-messages): Open source folder before diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index 700be31..65aacfa 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -156,6 +156,9 @@ (luna-define-method elmo-folder-open-internal ((folder elmo-filter-folder)) (elmo-folder-open-internal (elmo-filter-folder-target-internal folder))) +(luna-define-method elmo-folder-open-internal-p ((folder elmo-filter-folder)) + (elmo-folder-open-internal-p (elmo-filter-folder-target-internal folder))) + (luna-define-method elmo-folder-check ((folder elmo-filter-folder)) (when (elmo-filter-folder-require-msgdb-internal folder) (elmo-folder-synchronize (elmo-filter-folder-target-internal folder)))) diff --git a/elmo/elmo-map.el b/elmo/elmo-map.el index 0ba69ff..20c6f65 100644 --- a/elmo/elmo-map.el +++ b/elmo/elmo-map.el @@ -233,6 +233,9 @@ Return new location alist." folder (elmo-map-folder-list-message-locations folder)))) +(luna-define-method elmo-folder-open-internal-p ((folder elmo-map-folder)) + (elmo-location-map-alist folder)) + (luna-define-method elmo-folder-commit :after ((folder elmo-map-folder)) (when (elmo-folder-persistent-p folder) (elmo-location-map-save folder (elmo-folder-msgdb-path folder)))) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index 2e52de3..122a6df 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -123,6 +123,11 @@ (dolist (fld (elmo-multi-folder-children-internal folder)) (elmo-folder-open-internal fld))) +(luna-define-method elmo-folder-open-internal-p ((folder elmo-multi-folder)) + (let (open) + (dolist (fld (elmo-multi-folder-children-internal folder)) + (setq open (and open (elmo-folder-open-internal-p fld)))))) + (luna-define-method elmo-folder-check ((folder elmo-multi-folder)) (dolist (fld (elmo-multi-folder-children-internal folder)) (elmo-folder-check fld))) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index f3c7ffc..68bb479 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -179,6 +179,9 @@ (luna-define-method elmo-folder-open-internal ((folder elmo-pipe-folder)) (elmo-folder-open-internal (elmo-pipe-folder-dst-internal folder))) +(luna-define-method elmo-folder-open-internal-p ((folder elmo-pipe-folder)) + (elmo-folder-open-internal-p (elmo-pipe-folder-dst-internal folder))) + (luna-define-method elmo-folder-close-internal ((folder elmo-pipe-folder)) (elmo-folder-close-internal (elmo-pipe-folder-dst-internal folder))) diff --git a/elmo/elmo.el b/elmo/elmo.el index 3b3e707..c3c0bd7 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -217,6 +217,9 @@ If optional LOAD-MSGDB is non-nil, msgdb is loaded. (luna-define-generic elmo-folder-open-internal (folder) "Open FOLDER (without loading saved folder status).") +(luna-define-generic elmo-folder-open-internal-p (folder) + "Return non-nil if FOLDER is opened internally.") + (luna-define-generic elmo-folder-check (folder) "Check the FOLDER to obtain newest information at the next list operation.") @@ -713,6 +716,10 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-FLAG-ALIST).") nil ; default is do nothing. ) +(luna-define-method elmo-folder-open-internal-p ((folder elmo-folder)) + t ; default is always opened internally + ) + (luna-define-method elmo-folder-check ((folder elmo-folder)) nil) ; default is noop. @@ -1188,7 +1195,8 @@ Returns a list of message numbers successfully appended." (error "move: %d is not writable" (elmo-folder-name-internal dst-folder))) (when messages - (elmo-folder-open-internal src-folder) + (unless (elmo-folder-open-internal-p src-folder) + (elmo-folder-open-internal src-folder)) (elmo-folder-open-internal dst-folder) (unless (setq succeeds (elmo-folder-append-messages dst-folder src-folder -- 1.7.10.4