From: kaoru Date: Sun, 15 Jun 2003 16:40:20 +0000 (+0000) Subject: * elmo-maildir.el (elmo-folder-rename-internal): New method, X-Git-Tag: wl-2_10_1pre~11 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=e16cb2470297b6900277925930197f0eba88f0e8;p=elisp%2Fwanderlust.git * elmo-maildir.el (elmo-folder-rename-internal): New method, copied from localdir's one. * elmo-pipe.el (elmo-folder-rename): New method, rename destination folder with leaving source folder as it is. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 2439151..72ae421 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,11 @@ 2003-06-15 TAKAHASHI Kaoru + * elmo-maildir.el (elmo-folder-rename-internal): New method, + copied from localdir's one. + + * elmo-pipe.el (elmo-folder-rename): New method, rename + destination folder with leaving source folder as it is. + * elmo.el (elmo-folder-rename-internal): New method to cause error. * elmo-nntp.el (elmo-folder-search): Body search is to search from diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index 6fe8c22..0cf693c 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -482,6 +482,20 @@ file name for maildir directories." t) (error nil)))) +(luna-define-method elmo-folder-rename-internal ((folder elmo-maildir-folder) + new-folder) + (let* ((old (elmo-maildir-folder-directory-internal folder)) + (new (elmo-maildir-folder-directory-internal new-folder)) + (new-dir (directory-file-name (file-name-directory new)))) + (unless (file-directory-p old) + (error "No such directory: %s" old)) + (when (file-exists-p new) + (error "Already exists directory: %s" new)) + (unless (file-directory-p new-dir) + (elmo-make-directory new-dir)) + (rename-file old new) + t)) + (require 'product) (product-provide (provide 'elmo-maildir) (require 'elmo-version)) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index d43ae85..5e67ced 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -305,6 +305,28 @@ ;(luna-define-method elmo-folder-pack-numbers ((folder elmo-pipe-folder)) ; (elmo-folder-pack-numbers (elmo-pipe-folder-dst-internal folder))) +(luna-define-method elmo-folder-rename ((folder elmo-pipe-folder) new-name) + (let* ((new-folder (elmo-make-folder new-name))) + (unless (string= (elmo-folder-name-internal + (elmo-pipe-folder-src-internal folder)) + (elmo-folder-name-internal + (elmo-pipe-folder-src-internal new-folder))) + (error "Source folder differ")) + (unless (eq (elmo-folder-type-internal + (elmo-pipe-folder-dst-internal folder)) + (elmo-folder-type-internal + (elmo-pipe-folder-dst-internal new-folder))) + (error "Not same folder type")) + (if (or (file-exists-p (elmo-folder-msgdb-path + (elmo-pipe-folder-dst-internal new-folder))) + (elmo-folder-exists-p + (elmo-pipe-folder-dst-internal new-folder))) + (error "Already exists folder: %s" new-name)) + (elmo-folder-send (elmo-pipe-folder-dst-internal folder) + 'elmo-folder-rename-internal + (elmo-pipe-folder-dst-internal new-folder)) + (elmo-msgdb-rename-path folder new-folder))) + (require 'product) (product-provide (provide 'elmo-pipe) (require 'elmo-version))