* elmo.el (elmo-folder-synchronize): Add 5th optional argument
authorhmurata <hmurata>
Sun, 13 Jun 2004 12:33:45 +0000 (12:33 +0000)
committerhmurata <hmurata>
Sun, 13 Jun 2004 12:33:45 +0000 (12:33 +0000)
`mask'.

* elmo-pipe.el (elmo-folder-synchronize): Follow the API chagne.

* elmo-multi.el (elmo-folder-synchronize): Likewise.
(elmo-multi-split-numbers): Add elmo-folder object into each
element of return value at first.
(elmo-folder-delete-messages): Follow the above change.
(elmo-folder-detach-messages): Ditto.

* elmo-filter.el (elmo-folder-synchronize): Minimize message
number which is synchronized in target folder.

elmo/ChangeLog
elmo/elmo-filter.el
elmo/elmo-multi.el
elmo/elmo-pipe.el
elmo/elmo.el

index 62f80d3..4169655 100644 (file)
@@ -1,3 +1,19 @@
+2004-06-13  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo.el (elmo-folder-synchronize): Add 5th optional argument
+       `mask'.
+
+       * elmo-pipe.el (elmo-folder-synchronize): Follow the API chagne.
+
+       * elmo-multi.el (elmo-folder-synchronize): Likewise.
+       (elmo-multi-split-numbers): Add elmo-folder object into each
+       element of return value at first.
+       (elmo-folder-delete-messages): Follow the above change.
+       (elmo-folder-detach-messages): Ditto.
+
+       * elmo-filter.el (elmo-folder-synchronize): Minimize message
+       number which is synchronized in target folder.
+
 2004-05-25  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elmo-shimbun.el (elmo-shimbun-update-overview-folder-list):
index 1aef7fc..6ebcd1a 100644 (file)
                                             &optional
                                             disable-killed
                                             ignore-msgdb
-                                            no-check)
-  (when (elmo-folder-synchronize
-        (elmo-filter-folder-target-internal folder)
-        'disable-killed
-        ignore-msgdb
-        no-check)
-    (let ((killed-list (elmo-folder-killed-list-internal folder))
-         (numbers (elmo-folder-list-messages folder (not disable-killed))))
-      (when (and disable-killed ignore-msgdb)
-       (elmo-folder-set-killed-list-internal folder nil))
-      (elmo-filter-folder-set-number-list-internal folder numbers)
-      (elmo-filter-folder-set-flag-count-internal folder nil)
-      0)))
+                                            no-check
+                                            mask)
+  (let ((killed-list (elmo-folder-killed-list-internal folder))
+       numbers)
+    (unless no-check
+      (when (elmo-filter-folder-require-msgdb-internal folder)
+       (elmo-folder-synchronize (elmo-filter-folder-target-internal folder)
+                                disable-killed
+                                ignore-msgdb
+                                no-check
+                                mask)))
+    (setq numbers (elmo-folder-list-messages folder (not disable-killed)))
+    (when (and numbers
+              (not (elmo-filter-folder-require-msgdb-internal folder)))
+      (elmo-folder-synchronize (elmo-filter-folder-target-internal folder)
+                              'disable-killed
+                              ignore-msgdb
+                              no-check
+                              (if mask
+                                  (elmo-list-filter mask numbers)
+                                numbers)))
+    (when (and disable-killed ignore-msgdb)
+      (elmo-folder-set-killed-list-internal folder nil))
+    (elmo-filter-folder-set-number-list-internal folder numbers)
+    (elmo-filter-folder-set-flag-count-internal folder nil)
+    0))
 
 (luna-define-method elmo-folder-detach-messages ((folder elmo-filter-folder)
                                                 numbers)
index c9d1368..5bca2c2 100644 (file)
                                             &optional
                                             disable-killed
                                             ignore-msgdb
-                                            no-check)
-  (dolist (fld (elmo-multi-folder-children-internal folder))
-    (elmo-folder-synchronize fld disable-killed ignore-msgdb no-check))
+                                            no-check
+                                            mask)
+  (if mask
+      (dolist (element (elmo-multi-split-numbers folder mask))
+       (when (cdr element)
+         (elmo-folder-synchronize (car element)
+                                  disable-killed
+                                  ignore-msgdb
+                                  no-check
+                                  (cdr element))))
+    (dolist (fld (elmo-multi-folder-children-internal folder))
+      (elmo-folder-synchronize fld disable-killed ignore-msgdb no-check)))
   0)
 
 (luna-define-method elmo-folder-expand-msgdb-path ((folder
 
 (defun elmo-multi-split-numbers (folder numlist &optional as-is)
   (let ((numbers (sort numlist '<))
+       (folders (elmo-multi-folder-children-internal folder))
        (divider (elmo-multi-folder-divide-number-internal folder))
        (cur-number 0)
        one-list numbers-list)
     (while numbers
+      (setq one-list (list (nth cur-number folders)))
       (setq cur-number (+ cur-number 1))
-      (setq one-list nil)
       (while (and numbers
                  (eq 0
                      (/ (- (car numbers)
 
 (luna-define-method elmo-folder-delete-messages ((folder elmo-multi-folder)
                                                 numbers)
-  (let ((flds (elmo-multi-folder-children-internal folder))
-       one-list-list
-       (cur-number 0))
-    (setq one-list-list (elmo-multi-split-numbers folder numbers))
-    (while (< cur-number (length flds))
-      (elmo-folder-delete-messages (nth cur-number flds)
-                                  (nth cur-number one-list-list))
-      (setq cur-number (+ 1 cur-number)))
-    t))
+  (dolist (element (elmo-multi-split-numbers folder numbers))
+    (when (cdr element)
+      (elmo-folder-delete-messages (car element) (cdr element))))
+  t)
 
 (luna-define-method elmo-folder-detach-messages ((folder elmo-multi-folder)
                                                 numbers)
-  (let ((flds (elmo-multi-folder-children-internal folder))
-       one-list-list
-       (cur-number 0))
-    (setq one-list-list (elmo-multi-split-numbers folder numbers))
-    (while (< cur-number (length flds))
-      (elmo-folder-detach-messages (nth cur-number flds)
-                                  (nth cur-number one-list-list))
-      (setq cur-number (+ 1 cur-number)))
-    t))
+  (dolist (element (elmo-multi-split-numbers folder numbers))
+    (when (cdr element)
+      (elmo-folder-detach-messages (car element) (cdr element))))
+  t)
 
 (luna-define-method elmo-folder-diff ((folder elmo-multi-folder))
   (elmo-multi-folder-diff folder))
index 3229ac3..fd8b9a4 100644 (file)
                                             &optional
                                             disable-killed
                                             ignore-msgdb
-                                            no-check)
+                                            no-check
+                                            mask)
   (let ((src-folder (elmo-pipe-folder-src-internal folder))
        (dst-folder (elmo-pipe-folder-dst-internal folder)))
     (when (and (elmo-folder-plugged-p src-folder)
        (elmo-pipe-drain src-folder dst-folder))))
   (elmo-folder-synchronize
    (elmo-pipe-folder-dst-internal folder)
-   disable-killed ignore-msgdb no-check))
+   disable-killed ignore-msgdb no-check mask))
 
 (luna-define-method elmo-folder-list-flagged ((folder elmo-pipe-folder)
                                              flag
index 39eb047..3bebcca 100644 (file)
@@ -1450,7 +1450,8 @@ If Optional LOCAL is non-nil, don't update server flag."
                                              &optional
                                              disable-killed
                                              ignore-msgdb
-                                             no-check)
+                                             no-check
+                                             mask)
   "Synchronize the folder data to the newest status.
 FOLDER is the ELMO folder structure.
 
@@ -1458,6 +1459,8 @@ If optional DISABLE-KILLED is non-nil, killed messages are also synchronized.
 If optional IGNORE-MSGDB is non-nil, current msgdb is thrown away except
 flag status.
 If NO-CHECK is non-nil, rechecking folder is skipped.
+If optional argument MASK is specified and is a list of message numbers,
+synchronize messages only which are contained the list.
 Return amount of cross-posted messages.
 If update process is interrupted, return nil.")
 
@@ -1465,7 +1468,8 @@ If update process is interrupted, return nil.")
                                             &optional
                                             disable-killed
                                             ignore-msgdb
-                                            no-check)
+                                            no-check
+                                            mask)
   (let ((killed-list (elmo-folder-killed-list-internal folder))
        (before-append t)
        old-msgdb diff diff-2 delete-list new-list new-msgdb flag
@@ -1486,6 +1490,8 @@ If update process is interrupted, return nil.")
                                      folder
                                      (not disable-killed)
                                      'in-msgdb)))
+         (when (and mask (car diff))
+           (setcar diff (elmo-list-filter mask (car diff))))
          (message "Checking folder diff...done")
          (setq new-list (elmo-folder-confirm-appends (car diff)))
          ;; Set killed list as ((1 . MAX-OF-DISAPPEARED))