Fix list-messages for new folder
authorvitaly <v.mayatskih@gmail.com>
Wed, 25 Mar 2009 08:17:28 +0000 (25 09:17 +0100)
committervitaly <v.mayatskih@gmail.com>
Wed, 25 Mar 2009 08:17:28 +0000 (25 09:17 +0100)
Newly added folders don't have any info yet, take that in count.

elmo/elmo-imap4.el

index d1b6c21..23d4d31 100644 (file)
@@ -2004,14 +2004,14 @@ Return nil if no complete line has arrived."
 
   (let* ((old (elmo-msgdb-list-messages (elmo-folder-msgdb folder)))
          (new (elmo-imap4-folder-list-range folder
-               (1+ (elmo-folder-get-info-max folder)) "*"))
+               (1+ (or (elmo-folder-get-info-max folder) 0)) "*"))
          (united-old-new (elmo-union old new)))
-    (if (= (length united-old-new) (elmo-folder-get-info-length folder))
+    (if (= (length united-old-new) (or (elmo-folder-get-info-length folder) 0))
         united-old-new
       (elmo-union new
                  (elmo-imap4-folder-list-range
                   folder
-                  1 (1+ (elmo-folder-get-info-max folder)))))))
+                  1 (1+ (or (elmo-folder-get-info-max folder) 0)))))))
 
 (luna-define-method elmo-folder-list-flagged-plugged
   ((folder elmo-imap4-folder) flag)