From: teranisi Date: Tue, 28 Nov 2000 03:44:32 +0000 (+0000) Subject: * elmo-imap4.el (elmo-imap4-delete-folder): Send "close" before "delete" X-Git-Tag: wl-2_4_0~4 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9a637ccf75c1e3a1188baeefb10d3854f99ed43;p=elisp%2Fwanderlust.git * elmo-imap4.el (elmo-imap4-delete-folder): Send "close" before "delete" (Use commented out line). (elmo-imap4-rename-folder): Ditto. * elmo-dop.el (elmo-dop-queue-append): Use `elmo-string' to get folder string itself. (elmo-dop-list-deleted): New function. (elmo-dop-list-folder): Treat result of `elmo-dop-list-deleted' as killed. * elmo-util.el (elmo-string-rassoc-all): New function. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index cbf994b..c2e0d37 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,17 @@ +2000-11-28 Yuuichi Teranishi + + * elmo-imap4.el (elmo-imap4-delete-folder): + Send "close" before "delete" (Use commented out line). + (elmo-imap4-rename-folder): Ditto. + + * elmo-dop.el (elmo-dop-queue-append): Use `elmo-string' to get + folder string itself. + (elmo-dop-list-deleted): New function. + (elmo-dop-list-folder): Treat result of `elmo-dop-list-deleted' as + killed. + + * elmo-util.el (elmo-string-rassoc-all): New function. + 2000-11-26 Kenichi OKADA * elmo-nntp.el (elmo-network-initialize-session): Accept response 20[01]. diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index 3d6fc06..0ff603c 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -42,7 +42,7 @@ Automatically loaded/saved.") (defun elmo-dop-queue-append (folder function argument) - (let ((operation (list (format "%s" folder) function argument))) + (let ((operation (list (elmo-string folder) function argument))) (elmo-dop-queue-load) (unless (member operation elmo-dop-queue) ;; don't append same operation (setq elmo-dop-queue @@ -241,6 +241,25 @@ even an operation concerns the unplugged folder." (setq numbers (cdr numbers))) (cons appended deleting-msgids))) +(defun elmo-dop-list-deleted (folder number-alist) + "List message numbers to be deleted on FOLDER from NUMBER-ALIST." + (elmo-dop-queue-load) + (let ((queue elmo-dop-queue) + numbers matches nalist) + (while queue + (if (and (string= (nth 0 (car queue)) folder) + (string= (nth 1 (car queue)) "delete-msgids")) + (setq numbers + (nconc numbers + (delq nil (mapcar + (lambda (x) + (mapcar 'car + (elmo-string-rassoc-all + x number-alist))) + (nth 2 (car queue))))))) + (setq queue (cdr queue))) + (elmo-uniq-list (elmo-flatten numbers)))) + (defun elmo-dop-delete-msgs (folder msgs msgdb) (save-match-data (let ((folder-numbers (elmo-make-folder-numbers-list folder msgs)) @@ -287,6 +306,8 @@ even an operation concerns the unplugged folder." alreadies max-num (i 0)) + (setq killed (nconc (elmo-dop-list-deleted folder number-alist) + killed)) (while append-list (if (rassoc (car append-list) number-alist) (setq alreadies (append alreadies @@ -332,7 +353,7 @@ even an operation concerns the unplugged folder." (if (eq (elmo-folder-get-type folder) 'imap4) (if elmo-enable-disconnected-operation (let* ((number-alist (elmo-msgdb-number-load - (elmo-msgdb-expand-path folder))) + (elmo-msgdb-expand-path folder))) (number-list (mapcar 'car number-alist)) (append-list (elmo-dop-append-list-load folder)) (append-num (length append-list)) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 450c68b..f3da976 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -636,23 +636,24 @@ BUFFER must be a single-byte buffer." (when (elmo-imap4-spec-mailbox spec) (when (setq msgs (elmo-imap4-list-folder spec)) (elmo-imap4-delete-msgs spec msgs)) - ;; (elmo-imap4-send-command-wait session "close") + (elmo-imap4-send-command-wait session "close") (elmo-imap4-send-command-wait session (list "delete " (elmo-imap4-mailbox (elmo-imap4-spec-mailbox spec))))))) (defun elmo-imap4-rename-folder (old-spec new-spec) -;;;(elmo-imap4-send-command-wait session "close") - (elmo-imap4-send-command-wait - (elmo-imap4-get-session old-spec) - (list "rename " - (elmo-imap4-mailbox - (elmo-imap4-spec-mailbox old-spec)) - " " - (elmo-imap4-mailbox - (elmo-imap4-spec-mailbox new-spec))))) - + (let ((session (elmo-imap4-get-session old-spec))) + (elmo-imap4-send-command-wait session "close") + (elmo-imap4-send-command-wait + session + (list "rename " + (elmo-imap4-mailbox + (elmo-imap4-spec-mailbox old-spec)) + " " + (elmo-imap4-mailbox + (elmo-imap4-spec-mailbox new-spec)))))) + (defun elmo-imap4-max-of-folder (spec) (let ((session (elmo-imap4-get-session spec)) (killed (and elmo-use-killed-list diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index c493d00..164b79a 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -1648,6 +1648,16 @@ But if optional argument AUTO is non-nil, DEFAULT is returned." (throw 'loop a)) (setq alist (cdr alist)))))) +(defun elmo-string-rassoc-all (key alist) + (let (matches) + (while alist + (if (string= key (cdr (car alist))) + (setq matches + (cons (car alist) + matches))) + (setq alist (cdr alist))) + matches)) + ;;; Number set defined by OKAZAKI Tetsurou ;; ;; number ::= [0-9]+