Use "[]" as the parameter instead of "".
[gnus] / lisp / nnimap.el
index e3c9d90..fddb406 100644 (file)
@@ -361,20 +361,27 @@ textual parts.")
              (cons group article))))))))
 
 (defun nnimap-find-wanted-parts (structure)
-  (let ((nnimap-level 1))
-    (message-flatten-list (nnimap-find-wanted-parts-1 structure))))
+  (message-flatten-list (nnimap-find-wanted-parts-1 structure "")))
 
-(defun nnimap-find-wanted-parts-1 (structure)
-  (let (levels)
+(defun nnimap-find-wanted-parts-1 (structure prefix)
+  (let ((num 1)
+       parts)
     (while (consp (car structure))
       (let ((sub (pop structure)))
        (if (consp (car sub))
-           (push (nnimap-find-wanted-parts-1 sub) levels)
+           (push (nnimap-find-wanted-parts-1
+                  sub (if (string= prefix "")
+                          (number-to-string num)
+                        (format "%s.%s" prefix num)))
+                 parts)
          (let ((type (format "%s/%s" (nth 0 sub) (nth 1 sub))))
            (when (string-match nnimap-fetch-partial-articles type)
-             (push nnimap-level levels)))
-         (incf nnimap-level))))
-    (nreverse levels)))
+             (push (if (string= prefix "")
+                       (number-to-string num)
+                     (format "%s.%s" prefix num))
+                   parts)))
+         (incf num))))
+    (nreverse parts)))
 
 (deffoo nnimap-request-group (group &optional server dont-check info)
   (with-current-buffer nntp-server-buffer
@@ -868,11 +875,12 @@ textual parts.")
     (goto-char (point-min))
     (while (and (memq (process-status process)
                      '(open run))
-               (not (re-search-forward "^\\* " nil t)))
+               (not (re-search-forward "^\\* .*\n" nil t)))
       (nnheader-accept-process-output process)
       (goto-char (point-min)))
-    (and (looking-at "[A-Z0-9]+")
-        (match-string 0))))
+    (forward-line -1)
+    (and (looking-at "\\* \\([A-Z0-9]+\\)")
+        (match-string 1))))
 
 (defun nnimap-wait-for-response (sequence &optional messagep)
   (let ((process (get-buffer-process (current-buffer))))
@@ -964,7 +972,7 @@ textual parts.")
                 "BODY.PEEK[HEADER] BODY.PEEK"
               "RFC822.PEEK"))
            (if nnimap-split-download-body-default
-               ""
+               "[]"
              "[1]")))
    t))