Return the size of the entire message in the Bytes header.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Mon, 20 Sep 2010 16:11:39 +0000 (18:11 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Mon, 20 Sep 2010 16:11:39 +0000 (18:11 +0200)
The old version would return just the size of the first part.

lisp/ChangeLog
lisp/nnimap.el

index 509ebad..278d4ea 100644 (file)
@@ -3,6 +3,8 @@
        * nnimap.el (nnimap-request-group): Don't select the imap buffer before
        opening the server.
        (nnimap-request-delete-group): Implement group deletion.
+       (nnimap-transform-headers): Return the size of the entire message in
+       the Bytes header, not just the size of the first part.
 
 2010-09-20  David Edmondson  <dme@dme.org>  (tiny change)
 
index c38fce9..f9eaf17 100644 (file)
@@ -137,7 +137,7 @@ textual parts.")
 
 (defun nnimap-transform-headers ()
   (goto-char (point-min))
-  (let (article bytes lines)
+  (let (article bytes lines size)
     (block nil
       (while (not (eobp))
        (while (not (looking-at "^\\* [0-9]+ FETCH.*UID \\([0-9]+\\)"))
@@ -148,6 +148,12 @@ textual parts.")
              bytes (nnimap-get-length)
              lines nil)
        (beginning-of-line)
+       (setq size
+             (and (re-search-forward "RFC822.SIZE \\([0-9]+\\)"
+                                     (line-end-position)
+                                     t)
+                  (match-string 1)))
+       (beginning-of-line)
        (when (search-forward "BODYSTRUCTURE" (line-end-position) t)
          (let ((structure (ignore-errors (read (current-buffer)))))
            (while (and (consp structure)
@@ -157,7 +163,8 @@ textual parts.")
        (delete-region (line-beginning-position) (line-end-position))
        (insert (format "211 %s Article retrieved." article))
        (forward-line 1)
-       (insert (format "Chars: %d\n" bytes))
+       (when size
+         (insert (format "Chars: %s\n" size)))
        (when lines
          (insert (format "Lines: %s\n" lines)))
        (re-search-forward "^\r$")