(elmo-filter-folder-copy-flag-count): New
authorhmurata <hmurata>
Sat, 16 Oct 2004 03:00:44 +0000 (03:00 +0000)
committerhmurata <hmurata>
Sat, 16 Oct 2004 03:00:44 +0000 (03:00 +0000)
function.
(elmo-folder-delete-messages): Detach messages before delete
messages from target folder.
(elmo-folder-detach-messages): Set updated number-list to slot.

elmo/ChangeLog
elmo/elmo-filter.el

index 7308b10..ef08514 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-16  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo-filter.el (elmo-filter-folder-copy-flag-count): New
+       function.
+       (elmo-folder-delete-messages): Detach messages before delete
+       messages from target folder.
+       (elmo-folder-detach-messages): Set updated number-list to slot.
+
 2004-10-14  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-filter.el (elmo-folder-detach-messages): Always return t.
index cca26ca..8c59e89 100644 (file)
@@ -92,6 +92,9 @@
        folder
        (elmo-folder-list-messages folder t t))))
 
+(defun elmo-filter-folder-copy-flag-count (flag-counts)
+  (mapcar (lambda (pair) (cons (car pair) (cdr pair))) flag-counts))
+
 (luna-define-method elmo-folder-open :after ((folder elmo-filter-folder)
                                             &optional load-msgdb)
   (when load-msgdb
 
 (luna-define-method elmo-folder-delete-messages ((folder elmo-filter-folder)
                                                 numbers)
-  (and (elmo-folder-delete-messages
-       (elmo-filter-folder-target-internal folder) numbers)
-       (elmo-folder-detach-messages folder numbers)))
+  (let ((flag-count (elmo-filter-folder-copy-flag-count
+                    (elmo-filter-folder-flag-count-internal folder)))
+       (messages (copy-sequence
+                  (elmo-filter-folder-number-list-internal folder)))
+       success)
+    (elmo-folder-detach-messages folder numbers)
+    (unless (setq success
+                 (elmo-folder-delete-messages
+                  (elmo-filter-folder-target-internal folder) numbers))
+      (elmo-filter-folder-set-flag-count-internal folder flag-count)
+      (elmo-filter-folder-set-number-list-internal folder messages))
+    success))
 
 (luna-define-method elmo-folder-list-messages ((folder elmo-filter-folder)
                                               &optional visible-only in-msgdb)
 (luna-define-method elmo-folder-detach-messages ((folder elmo-filter-folder)
                                                 numbers)
   (elmo-filter-folder-countup-message-flags folder numbers -1)
-  (elmo-list-delete numbers (elmo-filter-folder-number-list folder) #'delq)
+  (elmo-filter-folder-set-number-list-internal
+   folder
+   (elmo-list-delete numbers (elmo-filter-folder-number-list folder) #'delq))
   t)
 
 (luna-define-method elmo-folder-length ((folder elmo-filter-folder))