(elmo-folder-initialize): Set slot `number-list'
authorhmurata <hmurata>
Mon, 3 Jul 2006 00:25:27 +0000 (00:25 +0000)
committerhmurata <hmurata>
Mon, 3 Jul 2006 00:25:27 +0000 (00:25 +0000)
as 'not-loaded.
(elmo-folder-close): Ditto.
(elmo-filter-folder-number-list-loaded-p): New function.
(elmo-filter-folder-number-list): Check whether loaded or not.
(elmo-folder-commit): Use `elmo-filter-folder-number-list' instead
of `elmo-filter-folder-number-list-internal'.
(elmo-folder-delete-messages): Ditto.
(elmo-folder-length): Check whether number-list is loaded or not.

elmo/ChangeLog
elmo/elmo-filter.el

index 2603d6f..67d8036 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-03  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo-filter.el (elmo-folder-initialize): Set slot `number-list'
+       as 'not-loaded.
+       (elmo-folder-close): Ditto.
+       (elmo-filter-folder-number-list-loaded-p): New function.
+       (elmo-filter-folder-number-list): Check whether loaded or not.
+       (elmo-folder-commit): Use `elmo-filter-folder-number-list' instead
+       of `elmo-filter-folder-number-list-internal'.
+       (elmo-folder-delete-messages): Ditto.
+       (elmo-folder-length): Check whether number-list is loaded or not.
+
 2006-06-17  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * modb-entity.el (modb-entity-field-extractor-alist): Add 3rd
index 05d8b5a..5d3ec54 100644 (file)
@@ -57,6 +57,7 @@
      (elmo-folder-search-requires-msgdb-p
       (elmo-filter-folder-target-internal folder)
       (elmo-filter-folder-condition-internal folder)))
+    (elmo-filter-folder-set-number-list-internal folder 'not-loaded)
     (elmo-filter-connect-signals
      folder
      (elmo-filter-folder-target-internal folder))
    (expand-file-name elmo-filter-number-filename dir)
    number-list))
 
+(defun elmo-filter-folder-number-list-loaded-p (folder)
+  (listp (elmo-filter-folder-number-list-internal folder)))
+
 (defun elmo-filter-folder-number-list (folder)
-  (or (elmo-filter-folder-number-list-internal folder)
+  (let ((numbers (elmo-filter-folder-number-list-internal folder)))
+    (if (listp numbers)
+       numbers
       (elmo-filter-folder-set-number-list-internal
        folder
-       (elmo-filter-number-list-load (elmo-folder-msgdb-path folder)))))
+       (elmo-filter-number-list-load (elmo-folder-msgdb-path folder))))))
 
 (defsubst elmo-filter-folder-countup-message-flags (folder numbers
                                                           &optional delta)
 
 (luna-define-method elmo-folder-close ((folder elmo-filter-folder))
   (elmo-generic-folder-close folder)
-  (elmo-filter-folder-set-number-list-internal folder nil)
+  (elmo-filter-folder-set-number-list-internal folder 'not-loaded)
   (elmo-filter-folder-set-flag-count-internal folder nil)
   (elmo-folder-close (elmo-filter-folder-target-internal folder)))
 
     (elmo-msgdb-killed-list-save
      (elmo-folder-msgdb-path folder)
      (elmo-folder-killed-list-internal folder))
-    (elmo-filter-number-list-save
-     (elmo-folder-msgdb-path folder)
-     (elmo-filter-folder-number-list-internal folder))))
+    (when (elmo-filter-folder-number-list-loaded-p folder)
+      (elmo-filter-number-list-save
+       (elmo-folder-msgdb-path folder)
+       (elmo-filter-folder-number-list folder)))))
 
 (luna-define-method elmo-folder-expand-msgdb-path ((folder
                                                    elmo-filter-folder))
   (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)))
+                  (elmo-filter-folder-number-list folder)))
        success)
     (elmo-folder-detach-messages folder numbers)
     (unless (setq success
   t)
 
 (luna-define-method elmo-folder-length ((folder elmo-filter-folder))
-  (length (elmo-filter-folder-number-list-internal folder)))
+  (and (elmo-filter-folder-number-list-loaded-p folder)
+       (length (elmo-filter-folder-number-list-internal folder))))
 
 (require 'product)
 (product-provide (provide 'elmo-filter) (require 'elmo-version))