Merge remote-tracking branch 'origin/no-gnus'
[gnus] / lisp / nnimap.el
index 4423860..eaf0f5c 100644 (file)
@@ -201,7 +201,10 @@ textual parts.")
        (while (re-search-forward
                "[^]][ (]{\\([0-9]+\\)}\r?\n"
                (save-excursion
-                 (or (re-search-forward "\\* [0-9]+ FETCH" nil t)
+                 ;; Start of the header section.
+                 (or (re-search-forward "] {[0-9]+}\r?\n" nil t)
+                     ;; Start of the next FETCH.
+                     (re-search-forward "\\* [0-9]+ FETCH" nil t)
                      (point-max)))
                t)
          (setq size (string-to-number (match-string 1)))
@@ -289,7 +292,7 @@ textual parts.")
 
 (defun nnimap-make-process-buffer (buffer)
   (with-current-buffer
-      (generate-new-buffer (format "*nnimap %s %s %s*"
+      (generate-new-buffer (format " *nnimap %s %s %s*"
                                   nnimap-address nnimap-server-port
                                   (gnus-buffer-exists-p buffer)))
     (mm-disable-multibyte)
@@ -1230,7 +1233,8 @@ textual parts.")
       (setf (nnimap-group nnimap-object) nil)
       (setf (nnimap-initial-resync nnimap-object) 0)
       (let ((qresyncp (nnimap-capability "QRESYNC"))
-           params groups sequences active uidvalidity modseq group)
+           params groups sequences active uidvalidity modseq group
+           unexist)
        ;; Go through the infos and gather the data needed to know
        ;; what and how to request the data.
        (dolist (info infos)
@@ -1634,7 +1638,9 @@ textual parts.")
                             vanished highestmodseq)
                       articles)
                groups)
-         (goto-char end)
+         (if (eq flag-sequence 'qresync)
+             (goto-char end)
+           (setq end (point)))
          (setq articles nil))))
     groups))
 
@@ -1717,13 +1723,18 @@ textual parts.")
     (nnimap-wait-for-response nnimap-sequence))
   nnimap-sequence)
 
+(defvar nnimap-record-commands nil
+  "If non-nil, log commands to the \"*imap log*\" buffer.")
+
 (defun nnimap-log-command (command)
-  (with-current-buffer (get-buffer-create "*imap log*")
-    (goto-char (point-max))
-    (insert (format-time-string "%H:%M:%S") " "
-           (if nnimap-inhibit-logging
-               "(inhibited)\n"
-             command)))
+  (when nnimap-record-commands
+    (with-current-buffer (get-buffer-create "*imap log*")
+      (goto-char (point-max))
+      (insert (format-time-string "%H:%M:%S")
+             " [" nnimap-address "] "
+             (if nnimap-inhibit-logging
+                 "(inhibited)\n"
+               command))))
   command)
 
 (defun nnimap-command (&rest args)