* wl/wl-fldmgr.el (wl-fldmgr-delete): Move confirmation to elmo side, merged-trunk-to-elmo-mark-16
authoryoichi <yoichi>
Sun, 30 Mar 2003 09:28:19 +0000 (09:28 +0000)
committeryoichi <yoichi>
Sun, 30 Mar 2003 09:28:19 +0000 (09:28 +0000)
cut visible folder when elmo-folder-delete returns non-nil value.
* elmo/elmo.el (elmo-folder-delete): Confirm deletion here, return t if
the folder has been deleted successfully.
* elmo/elmo-imap4.el (elmo-folder-delete): Ditto.
* elmo/elmo-archive.el (elmo-folder-delete): Ditto.
* elmo/elmo-localdir.el (elmo-folder-delete): Ditto.
* elmo/elmo-maildir.el (elmo-folder-delete): Ditto.

elmo/ChangeLog
elmo/elmo-archive.el
elmo/elmo-imap4.el
elmo/elmo-localdir.el
elmo/elmo-maildir.el
elmo/elmo.el
wl/ChangeLog
wl/wl-fldmgr.el

index 24bba10..2203b05 100644 (file)
@@ -1,3 +1,12 @@
+2003-03-30  Yoichi NAKAYAMA  <yoichi@geiin.org>
+
+       * 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-03-27  Tetsurou Okazaki  <okazaki@be.to>
 
        * elmo-util.el (elmo-string-member-ignore-case): New function.
index 62dc48a..f76d026 100644 (file)
@@ -447,12 +447,20 @@ TYPE specifies the archiver's symbol."
             (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)
index 70e5041..a33a241 100644 (file)
@@ -1973,18 +1973,25 @@ Return nil if no complete line has arrived."
 (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)
index f030437..176b4ef 100644 (file)
        (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)
index 0cf693c..286c274 100644 (file)
@@ -465,22 +465,30 @@ file name for maildir directories."
          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)
index e2f691a..3dcec71 100644 (file)
@@ -698,7 +698,10 @@ Return a cons cell of (NUMBER-CROSSPOSTS . NEW-MARK-ALIST).")
   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)))
index cf53d05..c19fa71 100644 (file)
@@ -1,5 +1,10 @@
 2003-03-30  Yoichi NAKAYAMA  <yoichi@geiin.org>
 
+       * wl-fldmgr.el (wl-fldmgr-delete): Move confirmation to elmo side,
+       cut visible folder when elmo-folder-delete returns non-nil value.
+
+2003-03-30  Yoichi NAKAYAMA  <yoichi@geiin.org>
+
        * wl-draft.el (wl-draft-send-confirm): Display more info (advised
        by Kenichi OKADA <okada@opaopa.org>).
 
index 7da121f..4e38b40 100644 (file)
@@ -850,15 +850,8 @@ return value is diffs '(-new -unread -all)."
     (let* ((inhibit-read-only t)
           (tmp (wl-fldmgr-get-path-from-buffer))
           (entity (elmo-string (nth 4 tmp)))
-          (folder (wl-folder-get-elmo-folder entity))
-          (msgs (and (elmo-folder-exists-p folder)
-                     (elmo-folder-list-messages folder))))
-      (when (yes-or-no-p (format "%sDo you really want to delete \"%s\"? "
-                                (if (> (length msgs) 0)
-                                    (format "%d msg(s) exists. " (length msgs))
-                                  "")
-                                entity))
-       (elmo-folder-delete folder)
+          (folder (wl-folder-get-elmo-folder entity)))
+      (when (elmo-folder-delete folder)
        (wl-fldmgr-cut tmp nil t)))))
 
 (defun wl-fldmgr-rename ()