(nnimap-update-info): Clean up slightly.
[gnus] / lisp / nnimap.el
index e7c2f32..6de49eb 100644 (file)
@@ -985,15 +985,20 @@ textual parts.")
                                 "\n"
                               "\r\n"))
        (let ((result (nnimap-get-response sequence)))
-         (if (not (car result))
+         (if (not (nnimap-ok-p result))
              (progn
-               (nnheader-message 7 "%s" (nnheader-get-report-string 'nnimap))
+               (nnheader-report 'nnimap "%s" result)
                nil)
            (cons group
                  (or (nnimap-find-uid-response "APPENDUID" (car result))
                      (nnimap-find-article-by-message-id
                       group message-id)))))))))
 
+(defun nnimap-ok-p (value)
+  (and (consp value)
+       (consp (car value))
+       (equal (caar value) "OK")))
+
 (defun nnimap-find-uid-response (name list)
   (let ((result (car (last (nnimap-find-response-element name list)))))
     (and result
@@ -1225,27 +1230,26 @@ textual parts.")
        (when uidnext
          (setq high (1- uidnext)))
        ;; First set the active ranges based on high/low.
-       (if (or completep
-               (not (gnus-active group)))
-           (gnus-set-active group
-                            (cond
-                             (active
-                              (cons (min (or low (car active))
-                                         (car active))
-                                    (max (or high (cdr active))
-                                         (cdr active))))
-                             ((and low high)
-                              (cons low high))
-                             (uidnext
-                              ;; No articles in this group.
-                              (cons uidnext (1- uidnext)))
-                             (start-article
-                              (cons start-article (1- start-article)))
-                             (t
-                              ;; No articles and no uidnext.
-                              nil)))
-         (gnus-set-active
-          group
+       (gnus-set-active
+        group
+        (if (or completep
+                (not (gnus-active group)))
+            (cond
+             (active
+              (cons (min (or low (car active))
+                         (car active))
+                    (max (or high (cdr active))
+                         (cdr active))))
+             ((and low high)
+              (cons low high))
+             (uidnext
+              ;; No articles in this group.
+              (cons uidnext (1- uidnext)))
+             (start-article
+              (cons start-article (1- start-article)))
+             (t
+              ;; No articles and no uidnext.
+              nil))
           (cons (car active)
                 (or high (1- uidnext)))))
        ;; See whether this is a read-only group.
@@ -1311,6 +1315,16 @@ textual parts.")
                    (when new-marks
                      (push (cons (car type) new-marks) marks)))))
              (gnus-info-set-marks info marks t))))
+       ;; Tell Gnus whether there are any \Recent messages in any of
+       ;; the groups.
+       (let ((recent (cdr (assoc '%Recent flags))))
+         (when (and active recent)
+           (while recent
+             (when (> (car recent) (cdr active))
+               (push (list (cons (gnus-group-real-name group) 0))
+                     nnmail-split-history)
+               (setq recent nil))
+             (pop recent))))
        ;; Note the active level for the next run-through.
        (gnus-group-set-parameter info 'active (gnus-active group))
        (gnus-group-set-parameter info 'uidvalidity uidvalidity)