Merge remote-tracking branch 'origin/no-gnus'
[gnus] / lisp / nnimap.el
index a78346c..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)
@@ -1720,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)