(elmo-multi-folder-diff): Fixed problem when the
authorhmurata <hmurata>
Fri, 11 Feb 2005 16:59:20 +0000 (16:59 +0000)
committerhmurata <hmurata>
Fri, 11 Feb 2005 16:59:20 +0000 (16:59 +0000)
element of the difference is nil.

elmo/ChangeLog
elmo/elmo-multi.el

index 0ea3002..396bc35 100644 (file)
@@ -1,3 +1,8 @@
+2005-02-11  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elmo-multi.el (elmo-multi-folder-diff): Fixed problem when the
+       element of the difference is nil.
+
 2005-02-11  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-maildir.el (elmo-maildir-separator): Added some OS types
index ccc899c..b4700b3 100644 (file)
   (elmo-multi-folder-diff folder))
 
 (defun elmo-multi-folder-diff (folder)
-  (let ((flds (elmo-multi-folder-children-internal folder))
-       (news 0)
+  (let ((news 0)
        (unreads 0)
        (alls 0)
-       no-unreads diff)
-    (while flds
-      (setq diff (elmo-folder-diff (car flds)))
-      (cond
-       ((consp (cdr diff)) ; (new unread all)
-       (setq news    (+ news (nth 0 diff))
-             unreads (+ unreads (nth 1 diff))
-             alls    (+ alls (nth 2 diff))))
-       (t
-       (setq no-unreads t)
-       (setq news    (+ news (car diff))
-             alls    (+ alls (cdr diff)))))
-      (setq flds (cdr flds)))
-    (if no-unreads
-       (cons news alls)
-      (list news unreads alls))))
+       diff value)
+    (dolist (child (elmo-multi-folder-children-internal folder))
+      (setq diff (elmo-folder-diff child))
+      (setq news    (and news
+                        (setq value (elmo-diff-new diff))
+                        (+ news value))
+           unreads (and unreads
+                        (setq value (elmo-diff-unread diff))
+                        (+ unreads value))
+           alls    (and alls
+                        (setq value (elmo-diff-all diff))
+                        (+ alls value))))
+    (if unreads
+       (list news unreads alls)
+      (cons news alls))))
 
 (luna-define-method elmo-folder-list-messages
   ((folder elmo-multi-folder) &optional visible-only in-msgdb)