From aca0d3bf3a798a9c51ce1d158b59c9cb2381cd22 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sun, 19 Sep 2010 20:21:02 +0200 Subject: [PATCH] Return the MIME parts as IMAP wants them. --- lisp/ChangeLog | 2 ++ lisp/nnimap.el | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9f98123df..a30d0343f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -6,6 +6,8 @@ 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. diff --git a/lisp/nnimap.el b/lisp/nnimap.el index e3c9d903c..776ed7fd9 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -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 -- 2.25.1