apropriately, mimic localdir's one.
Based on the patch from KAMO Tomoyuki <kamo@ITmanage.co.jp>.
* elmo.el (elmo-folder-delete): Confirm deletion here, return t if
the folder has been deleted successfully.
* elmo-imap4.el (elmo-folder-delete): Ditto.
* elmo-archive.el (elmo-folder-delete): Ditto.
* elmo-localdir.el (elmo-folder-delete): Ditto.
* elmo-maildir.el (elmo-folder-delete): Ditto.
+2003-06-18 TAKAHASHI Kaoru <kaoru@kaisei.org>
+
+ * elmo-archive.el (elmo-folder-rename-internal): Create directory
+ apropriately, mimic localdir's one.
+ Based on the patch from KAMO Tomoyuki <kamo@ITmanage.co.jp>.
+
+ * elmo.el (elmo-folder-delete): Confirm deletion here, return t if
+ the folder has been deleted successfully.
+ * elmo-imap4.el (elmo-folder-delete): Ditto.
+ * elmo-archive.el (elmo-folder-delete): Ditto.
+ * elmo-localdir.el (elmo-folder-delete): Ditto.
+ * elmo-maildir.el (elmo-folder-delete): Ditto.
+
2003-06-15 TAKAHASHI Kaoru <kaoru@kaisei.org>
* elmo-maildir.el (elmo-folder-rename-internal): New method,
(elmo-nntp-search-primitive): Do nothing when body search is
invoked (although it is not used by the change above).
(elmo-nntp-get-folders-info): Don't use replace-regexp.
-
+
* elmo-multi.el (elmo-folder-search): Don't ignore error anymore.
* elmo-localdir.el (elmo-folder-pack-numbers): onum, a member of
-;;; elmo-archive.el --- Archive folder of ELMO.
+;;; elmo-archive.el --- Archive folder of ELMO. -*- coding: euc-japan -*-
;; Copyright (C) 1998,1999,2000 OKUNISHI Fujikazu <fuji0924@mbox.kyoto-inet.or.jp>
;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
(delete-file dummy)))
))))
-(luna-define-method elmo-folder-delete :before ((folder elmo-archive-folder))
- (let ((arc (elmo-archive-get-archive-name folder)))
- (if (not (file-exists-p arc))
- (error "No such file: %s" arc)
- (delete-file arc)
- t)))
+(luna-define-method elmo-folder-delete ((folder elmo-archive-folder))
+ (let ((msgs (and (elmo-folder-exists-p folder)
+ (elmo-folder-list-messages folder))))
+ (when (yes-or-no-p (format "%sDelete msgdb and substance of \"%s\"? "
+ (if (> (length msgs) 0)
+ (format "%d msg(s) exists. " (length msgs))
+ "")
+ (elmo-folder-name-internal folder)))
+ (let ((arc (elmo-archive-get-archive-name folder)))
+ (if (not (file-exists-p arc))
+ (error "No such file: %s" arc)
+ (delete-file arc))
+ (elmo-msgdb-delete-path folder)
+ t))))
(luna-define-method elmo-folder-rename-internal ((folder elmo-archive-folder)
new-folder)
(let* ((old-arc (elmo-archive-get-archive-name folder))
- (new-arc (elmo-archive-get-archive-name new-folder)))
+ (new-arc (elmo-archive-get-archive-name new-folder))
+ (new-dir (directory-file-name
+ (elmo-archive-get-archive-directory new-folder))))
+ (if elmo-archive-treat-file
+ (setq new-dir (directory-file-name (file-name-directory new-dir))))
(unless (and (eq (elmo-archive-folder-archive-type-internal folder)
(elmo-archive-folder-archive-type-internal new-folder))
(equal (elmo-archive-folder-archive-prefix-internal
(error "No such file: %s" old-arc))
(when (file-exists-p new-arc)
(error "Already exists: %s" new-arc))
+ (unless (file-directory-p new-dir)
+ (elmo-make-directory new-dir))
(rename-file old-arc new-arc)
t))
(luna-define-method elmo-folder-writable-p ((folder elmo-imap4-folder))
t)
-(luna-define-method elmo-folder-delete :before ((folder elmo-imap4-folder))
- (let ((session (elmo-imap4-get-session folder))
- msgs)
- (when (elmo-imap4-folder-mailbox-internal folder)
- (when (setq msgs (elmo-folder-list-messages folder))
- (elmo-folder-delete-messages folder msgs))
- (elmo-imap4-send-command-wait session "close")
- (elmo-imap4-send-command-wait
- session
- (list "delete "
- (elmo-imap4-mailbox
- (elmo-imap4-folder-mailbox-internal folder)))))))
+(luna-define-method elmo-folder-delete ((folder elmo-imap4-folder))
+ (let ((msgs (and (elmo-folder-exists-p folder)
+ (elmo-folder-list-messages folder))))
+ (when (yes-or-no-p (format "%sDelete msgdb and substance of \"%s\"? "
+ (if (> (length msgs) 0)
+ (format "%d msg(s) exists. " (length msgs))
+ "")
+ (elmo-folder-name-internal folder)))
+ (let ((session (elmo-imap4-get-session folder)))
+ (when (elmo-imap4-folder-mailbox-internal folder)
+ (when msgs (elmo-folder-delete-messages folder msgs))
+ (elmo-imap4-send-command-wait session "close")
+ (elmo-imap4-send-command-wait
+ session
+ (list "delete "
+ (elmo-imap4-mailbox
+ (elmo-imap4-folder-mailbox-internal folder))))))
+ (elmo-msgdb-delete-path folder)
+ t)))
(luna-define-method elmo-folder-rename-internal ((folder elmo-imap4-folder)
new-folder)
(elmo-make-directory dir))
t)))
-(luna-define-method elmo-folder-delete :before ((folder elmo-localdir-folder))
- (let ((dir (elmo-localdir-folder-directory-internal folder)))
- (if (not (file-directory-p dir))
- (error "No such directory: %s" dir)
- (elmo-delete-match-files dir "[0-9]+" t)
+(luna-define-method elmo-folder-delete ((folder elmo-localdir-folder))
+ (let ((msgs (and (elmo-folder-exists-p folder)
+ (elmo-folder-list-messages folder))))
+ (when (yes-or-no-p (format "%sDelete msgdb and substance of \"%s\"? "
+ (if (> (length msgs) 0)
+ (format "%d msg(s) exists. " (length msgs))
+ "")
+ (elmo-folder-name-internal folder)))
+ (let ((dir (elmo-localdir-folder-directory-internal folder)))
+ (if (not (file-directory-p dir))
+ (error "No such directory: %s" dir)
+ (elmo-delete-match-files dir "[0-9]+" t)))
+ (elmo-msgdb-delete-path folder)
t)))
(luna-define-method elmo-folder-rename-internal ((folder elmo-localdir-folder)
t)
(error))))
-(luna-define-method elmo-folder-delete :before ((folder elmo-maildir-folder))
- (let ((basedir (elmo-maildir-folder-directory-internal folder)))
- (condition-case nil
- (let ((tmp-files (directory-files
- (expand-file-name "tmp" basedir)
- t "[^.].*")))
- ;; Delete files in tmp.
- (dolist (file tmp-files)
- (delete-file file))
- (dolist (dir '("new" "cur" "tmp" "."))
- (setq dir (expand-file-name dir basedir))
- (if (not (file-directory-p dir))
- (error nil)
- (elmo-delete-directory dir t)))
- t)
- (error nil))))
+(luna-define-method elmo-folder-delete ((folder elmo-maildir-folder))
+ (let ((msgs (and (elmo-folder-exists-p folder)
+ (elmo-folder-list-messages folder))))
+ (when (yes-or-no-p (format "%sDelete msgdb and substance of \"%s\"? "
+ (if (> (length msgs) 0)
+ (format "%d msg(s) exists. " (length msgs))
+ "")
+ (elmo-folder-name-internal folder)))
+ (let ((basedir (elmo-maildir-folder-directory-internal folder)))
+ (condition-case nil
+ (let ((tmp-files (directory-files
+ (expand-file-name "tmp" basedir)
+ t "[^.].*")))
+ ;; Delete files in tmp.
+ (dolist (file tmp-files)
+ (delete-file file))
+ (dolist (dir '("new" "cur" "tmp" "."))
+ (setq dir (expand-file-name dir basedir))
+ (if (not (file-directory-p dir))
+ (error nil)
+ (elmo-delete-directory dir t))))
+ (error nil)))
+ (elmo-msgdb-delete-path folder)
+ t)))
(luna-define-method elmo-folder-rename-internal ((folder elmo-maildir-folder)
new-folder)
nil) ; default is not writable.
(luna-define-method elmo-folder-delete ((folder elmo-folder))
- (elmo-msgdb-delete-path folder))
+ (when (yes-or-no-p (format "Delete msgdb of \"%s\"? "
+ (elmo-folder-name-internal folder)))
+ (elmo-msgdb-delete-path folder)
+ t))
(luna-define-method elmo-folder-rename ((folder elmo-folder) new-name)
(let* ((new-folder (elmo-make-folder new-name)))