Allow nnimap-request-group to do a complete marks sync on `M-g'.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sat, 18 Sep 2010 15:32:24 +0000 (17:32 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sat, 18 Sep 2010 15:32:24 +0000 (17:32 +0200)
* nnimap.el (nnimap-request-group): Have the "check" version of the
function parse flags and update the info, so that a `M-g' get a total
resync of all flags from the group.

* gnus-start.el (gnus-activate-group): Send the info to
gnus-request-group.

lisp/ChangeLog
lisp/gnus-start.el
lisp/nnimap.el

index 8730083..fce0692 100644 (file)
@@ -1,5 +1,12 @@
 2010-09-18  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-start.el (gnus-activate-group): Send the info to
+       gnus-request-group.
+
+       * nnimap.el (nnimap-request-group): Have the "check" version of the
+       function parse flags and update the info, so that a `M-g' get a total
+       resync of all flags from the group.
+
        * gnus-int.el (gnus-request-group): Take an optional `info' parameter
        to allow backends to alter the info on group selection.  Also alter all
        the backend -request-group functions to take the parameter.
index 8483542..b421cee 100644 (file)
@@ -1536,10 +1536,12 @@ If SCAN, request a scan of that group as well."
           t)
         (if (or debug-on-error debug-on-quit)
             (inline (gnus-request-group group (or dont-sub-check dont-check)
-                                        method))
+                                        method
+                                        (gnus-get-info group)))
           (condition-case nil
               (inline (gnus-request-group group (or dont-sub-check dont-check)
-                                          method))
+                                          method
+                                          (gnus-get-info group)))
             ;;(error nil)
             (quit
              (message "Quit activating %s" group)
index e48364e..d595192 100644 (file)
@@ -74,7 +74,7 @@ not done by default on servers that doesn't support that command.")
   "Internal variable with default value for `nnimap-split-download-body'.")
 
 (defstruct nnimap
-  group process commands capabilities)
+  group process commands capabilities select-result)
 
 (defvar nnimap-object nil)
 
@@ -316,7 +316,7 @@ not done by default on servers that doesn't support that command.")
 (deffoo nnimap-request-group (group &optional server dont-check info)
   (with-current-buffer nntp-server-buffer
     (let ((result (nnimap-possibly-change-group group server))
-         articles active)
+         articles active marks)
       (when result
        (if (and dont-check
                 (setq active (nth 2 (assoc group nnimap-current-infos))))
@@ -325,15 +325,27 @@ not done by default on servers that doesn't support that command.")
                            (car active)
                            (cdr active)
                            group))
-         (setq articles (nnimap-get-flags "1:*"))
+         (with-current-buffer (nnimap-buffer)
+           (erase-buffer)
+           (let ((group-sequence
+                  (nnimap-send-command "SELECT %S" (utf7-encode group)))
+                 (flag-sequence
+                  (nnimap-send-command "UID FETCH 1:* FLAGS")))
+             (nnimap-wait-for-response flag-sequence)
+             (setq marks
+                   (nnimap-flags-to-marks
+                    (nnimap-parse-flags
+                     (list (list group-sequence flag-sequence 1 group)))))
+             (when info
+               (nnimap-update-infos marks (list info)))))
          (erase-buffer)
-         (insert
-          (format
-           "211 %d %d %d %S\n"
-           (length articles)
-           (or (caar articles) 0)
-           (or (caar (last articles)) 0)
-           group)))
+         (let ((high (nth 3 (car marks)))
+               (low (nth 4 (car marks))))
+           (insert
+            (format
+             "211 %d %d %d %S\n"
+             (1+ (- high low))
+             low high group))))
        t))))
 
 (defun nnimap-get-flags (spec)
@@ -715,7 +727,8 @@ not done by default on servers that doesn't support that command.")
            t
          (let ((result (nnimap-command "SELECT %S" (utf7-encode group t))))
            (when (car result)
-             (setf (nnimap-group nnimap-object) group)
+             (setf (nnimap-group nnimap-object) group
+                   (nnimap-select-result nnimap-object) result)
              result))))))))
 
 (defun nnimap-find-connection (buffer)