Gnus development mailing list
 help / color / mirror / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: ding@gnus.org
Subject: nnimap downloads full message while splitting
Date: Thu, 17 Mar 2011 15:14:02 +0100	[thread overview]
Message-ID: <877hbxomvp.fsf@nemi.mork.no> (raw)

[-- Attachment #1: Type: text/plain, Size: 2596 bytes --]

One issue that has annoyed me for quite a while, is the large amount of
data nnimap needs to download every time I do 'g'.  So I looked at the
*imap-log* and found 



13:40:29 11913 LIST "" "*"
13:40:31 11914 SELECT "INBOX"
13:40:32 11915 UID FETCH 1:* FLAGS
13:40:34 11916 UID FETCH 254986,255345,260617,261796,278644,278651,278659,278693,279436,279440,279627,280724,280727,280845,280847,280964,289681,290732,291103,292263,292277,294090,294688,295152,295802,295814,295831,295842,295943,296193,296201,296208,296287,296307:296308,296318,296863,296866,296930,296940,297782,298610,298649,298827,299314,299321,299968,299994,300594,300786,301132,302623:302624,302629,302641,302704,302908,303061,303193,303313,303504,303508,304227,304521,305071,305355:305356,305411,305414:305415,305525,306413,306428,306437,306447,306449,306457,306649,306727,307813,308448,308453,308553,308558,308562:308563,309365,310001,310289,310292,311762,311768,311774,311809,311813,311863,311914:311915,311918,311921,311944,311968,311977,311985,311991,312472,312618,312620,312629,312815,31285
 0,312957,313150:313151 (UID BODY.PEEK[HEADER] BODY.PEEK[1])
13:40:57 11917 UID COPY 313150:313151 "INBOX.lister.system"
13:40:59 11918 UID STORE 313150:313151 +FLAGS.SILENT (\Deleted)
13:40:59 11919 UID EXPUNGE 313150:313151
[etc]

which doesn't look right at all.  One problem is of course the number of
old messages which nnimap wants to inspect over and over again.
Probably my own fault, since I tend to leave a number of unread messages
in my INBOX for later processing.


But my main problem with the above is the "BODY.PEEK[1]". For me, this
is almost the same as "BODY.PEEK[]" since most of the messages I receive
consist of a single body part.  Yes, I'm lucky.  But that means that
every 'g' will download the same set of unread messages over and over
again, instead of just fetching the headers.


Looking at nnimap.el, I see:

(defun nnimap-fetch-inbox (articles)
  (erase-buffer)
  (nnimap-wait-for-response
   (nnimap-send-command
    "UID FETCH %s %s"
    (nnimap-article-ranges articles)
    (format "(UID %s%s)"
	    (format
	     (if (nnimap-ver4-p)
		 "BODY.PEEK[HEADER] BODY.PEEK"
	       "RFC822.PEEK"))
	    (if nnimap-split-download-body-default
		"[]"
	      "[1]")))
   t))


Which doesn't look right at all.  Looks like
nnimap-split-download-body-default selects between downloading one part
or all parts.  Ah, I got it.  This is due to the attempt to support both
nnimap-ver4-p and others.  It will actually work for the non
nnimap-ver4-p servers.


I'm attaching a patch which fixes this for me.



Bjørn


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-nnimap.el-nnimap-fetch-inbox-Respect-nnimap-split-do.patch --]
[-- Type: text/x-diff, Size: 829 bytes --]

From 8f956e18f39a6481e52e7c44ea2a9e6c9d52eeb4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
Date: Thu, 17 Mar 2011 15:04:54 +0100
Subject: [PATCH] * nnimap.el (nnimap-fetch-inbox): Respect nnimap-split-download-body-default

---
 lisp/nnimap.el |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 11c521f..d44ec2e 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -1767,11 +1767,13 @@ textual parts.")
     (format "(UID %s%s)"
 	    (format
 	     (if (nnimap-ver4-p)
-		 "BODY.PEEK[HEADER] BODY.PEEK"
+		 "BODY.PEEK"
 	       "RFC822.PEEK"))
 	    (if nnimap-split-download-body-default
 		"[]"
-	      "[1]")))
+	      (if (nnimap-ver4-p)
+		  "[HEADER]"
+		"[1]"))))
    t))
 
 (defun nnimap-split-incoming-mail ()
-- 
1.7.2.3


             reply	other threads:[~2011-03-17 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-17 14:14 Bjørn Mork [this message]
2011-03-17 16:45 ` Lars Magne Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877hbxomvp.fsf@nemi.mork.no \
    --to=bjorn@mork.no \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).