Return the MIME parts as IMAP wants them.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 19 Sep 2010 18:21:02 +0000 (20:21 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 19 Sep 2010 18:21:02 +0000 (20:21 +0200)
lisp/ChangeLog
lisp/nnimap.el

index 9f98123..a30d034 100644 (file)
@@ -6,6 +6,8 @@
        nnimap-server-port.
        (nnimap-request-article): Return the group/article number, so that Gnus
        `^' works as expected.
        nnimap-server-port.
        (nnimap-request-article): Return the group/article number, so that Gnus
        `^' works as expected.
+       (nnimap-find-wanted-parts-1): Return the MIME parts as IMAP wants
+       them.
 
        * gnus.el (gnus-similar-server-opened): Refactor a bit and add
        comments.
 
        * gnus.el (gnus-similar-server-opened): Refactor a bit and add
        comments.
index e3c9d90..776ed7f 100644 (file)
@@ -361,20 +361,27 @@ textual parts.")
              (cons group article))))))))
 
 (defun nnimap-find-wanted-parts (structure)
              (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))
     (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)
          (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
 
 (deffoo nnimap-request-group (group &optional server dont-check info)
   (with-current-buffer nntp-server-buffer