* elmo.el (elmo-folder-list-unreads): Don't use msgdb API.
authorteranisi <teranisi>
Fri, 18 Jul 2003 03:59:00 +0000 (03:59 +0000)
committerteranisi <teranisi>
Fri, 18 Jul 2003 03:59:00 +0000 (03:59 +0000)
(elmo-folder-list-importants): Ditto.
(elmo-folder-list-answereds): Ditto.

* elmo-multi.el (elmo-folder-mark-as-important): Remove :before qualifier.
(elmo-folder-mark-as-read): Ditto.
(elmo-folder-unmark-read): Ditto.
(elmo-folder-mark-as-answered): Ditto.
(elmo-folder-unmark-answered): Ditto.
(elmo-folder-list-flagged): Define.
(elmo-folder-commit): Ditto.
(elmo-folder-length): Ditto.
(elmo-folder-count-flags): Ditto.

elmo/ChangeLog
elmo/elmo-multi.el
elmo/elmo.el

index ad00910..aa31f36 100644 (file)
@@ -1,3 +1,20 @@
+2003-07-18  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo.el (elmo-folder-list-unreads): Don't use msgdb API.
+       (elmo-folder-list-importants): Ditto.
+       (elmo-folder-list-answereds): Ditto.
+
+       * elmo-multi.el (elmo-folder-mark-as-important): Remove :before
+       qualifier.
+       (elmo-folder-mark-as-read): Ditto.
+       (elmo-folder-unmark-read): Ditto.
+       (elmo-folder-mark-as-answered): Ditto.
+       (elmo-folder-unmark-answered): Ditto.
+       (elmo-folder-list-flagged): Define.
+       (elmo-folder-commit): Ditto.
+       (elmo-folder-length): Ditto.
+       (elmo-folder-count-flags): Ditto.
+
 2003-07-17  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo.el (elmo-folder-detach-messages): New method.
index e7a7aa6..b854255 100644 (file)
       (setq msg-list (cdr msg-list)))
     ret-val))
 
-(luna-define-method elmo-folder-mark-as-important :before ((folder
-                                                           elmo-multi-folder)
-                                                          numbers
-                                                          &optional
-                                                          ignore-flags)
+(luna-define-method elmo-folder-mark-as-important ((folder
+                                                   elmo-multi-folder)
+                                                  numbers
+                                                  &optional
+                                                  ignore-flags)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
     (elmo-folder-mark-as-important (car folder-numbers)
                                   (cdr folder-numbers)
                                   ignore-flags)))
 
-(luna-define-method elmo-folder-unmark-important :before ((folder
-                                                          elmo-multi-folder)
-                                                         numbers
-                                                         &optional
-                                                         ignore-flags)
+(luna-define-method elmo-folder-unmark-important ((folder
+                                                  elmo-multi-folder)
+                                                 numbers
+                                                 &optional
+                                                 ignore-flags)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
     (elmo-folder-unmark-important (car folder-numbers)
                                  (cdr folder-numbers)
                                  ignore-flags)))
 
-(luna-define-method elmo-folder-mark-as-read :before ((folder
-                                                      elmo-multi-folder)
-                                                     numbers
-                                                     &optional ignore-flag)
+(luna-define-method elmo-folder-mark-as-read ((folder
+                                              elmo-multi-folder)
+                                             numbers
+                                             &optional ignore-flag)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
     (elmo-folder-mark-as-read (car folder-numbers)
                              (cdr folder-numbers)
                              ignore-flag)))
 
-(luna-define-method elmo-folder-unmark-read :before ((folder
-                                                     elmo-multi-folder)
-                                                    numbers
-                                                    &optional ignore-flag)
+(luna-define-method elmo-folder-unmark-read ((folder
+                                             elmo-multi-folder)
+                                            numbers
+                                            &optional ignore-flag)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
     (elmo-folder-unmark-read (car folder-numbers)
                             (cdr folder-numbers)
                             ignore-flag)))
 
-(luna-define-method elmo-folder-mark-as-answered :before ((folder
-                                                          elmo-multi-folder)
-                                                         numbers)
+(luna-define-method elmo-folder-mark-as-answered ((folder
+                                                  elmo-multi-folder)
+                                                 numbers)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
     (elmo-folder-mark-as-answered (car folder-numbers)
                                  (cdr folder-numbers))))
 
-(luna-define-method elmo-folder-unmark-answered :before ((folder
-                                                         elmo-multi-folder)
-                                                        numbers)
+(luna-define-method elmo-folder-unmark-answered ((folder
+                                                 elmo-multi-folder)
+                                                numbers)
   (dolist (folder-numbers (elmo-multi-make-folder-numbers-list folder numbers))
     (elmo-folder-unmark-answered (car folder-numbers)
                                 (cdr folder-numbers))))
 
+(luna-define-method elmo-folder-list-flagged ((folder elmo-multi-folder)
+                                             flag
+                                             &optional in-msgdb)
+  (let ((cur-number 0)
+       numbers)
+    (dolist (child (elmo-multi-folder-children-internal folder))
+      (setq cur-number (+ cur-number 1)
+           numbers
+           (nconc
+            numbers
+            (mapcar
+             (function
+              (lambda (x)
+                (+
+                 (* (elmo-multi-folder-divide-number-internal folder)
+                    cur-number) x)))
+             (elmo-folder-list-flagged child flag in-msgdb)))))
+    numbers))
+
+(luna-define-method elmo-folder-commit ((folder elmo-multi-folder))
+  (dolist (child (elmo-multi-folder-children-internal folder))
+    (elmo-folder-commit child)))
+
+(luna-define-method elmo-folder-length ((folder elmo-multi-folder))
+  (let ((sum 0))
+    (dolist (child (elmo-multi-folder-children-internal folder))
+      (setq sum (+ sum (elmo-folder-length child))))
+    sum))
+
+(luna-define-method elmo-folder-count-flags ((folder elmo-multi-folder))
+  (let ((new 0)
+       (unreads 0)
+       (answered 0)
+       flags)
+    (dolist (child (elmo-multi-folder-children-internal folder))
+      (setq flags (elmo-folder-count-flags child))
+      (setq new (+ new (nth 0 flags)))
+      (setq unreads (+ unreads (nth 1 flags)))
+      (setq answered (+ answered (nth 2 flags))))
+    (list new unreads answered)))
+
 (require 'product)
 (product-provide (provide 'elmo-multi) (require 'elmo-version))
 
index bb0ea4f..a4e4793 100644 (file)
@@ -268,13 +268,13 @@ If optional IN-MSGDB is non-nil, retrieve flag information from msgdb.")
   (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) flag))
 
 (luna-define-method elmo-folder-list-unreads ((folder elmo-folder))
-  (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) 'unread))
+  (elmo-folder-list-flagged folder 'unread))
 
 (luna-define-method elmo-folder-list-importants ((folder elmo-folder))
-  (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) 'important))
+  (elmo-folder-list-flagged folder 'important))
 
 (luna-define-method elmo-folder-list-answereds ((folder elmo-folder))
-  (elmo-msgdb-list-flagged (elmo-folder-msgdb folder) 'answered))
+  (elmo-folder-list-flagged folder 'answered))
 
 (luna-define-generic elmo-folder-list-messages-internal (folder &optional
                                                                visible-only)