Hi Brendan and all,

Let me briefly wrap up what I am going to do:

I have by now analysed the source code of mutt and the function most 
relevant to partial fetch is imap_fetch_message(... in imap/message.c.
The function contains the following code
snprintf (buf, sizeof (buf), "UID FETCH %u %s", HEADER_DATA(h)->uid,
            (mutt_bit_isset (idata->capabilities, IMAP4REV1) ?
             (option (OPTIMAPPEEK) ? "BODY.PEEK[]" : "BODY[]") :
             "RFC822"));
In order to download only the first 16k of a message, this call will 
have to be altered into
  snprintf (buf, sizeof (buf), "UID FETCH %u %s", HEADER_DATA(h)->uid,
            (mutt_bit_isset (idata->capabilities, IMAP4REV1) ?
             (option (OPTIMAPPEEK) ? "BODY.PEEK[]<0.16384>" : 
"BODY[]<0.16384>") :
             "RFC822"));
That is, I am first going to download the first 16k of a message. Then I 
am going to check the size of the first attachment 
(hdr->content->parts->length), change the 16k value to the correct 
message size and make sure the first part of a mime message is 
fetched entirely.

The next thing to do will relate to recvattach.c, function 
mutt_view_attachments(... This function is invoked when the user presses 
'v'. Even though only the first part may have been downloaded at this 
stage, the tree structure showing the message parts nees be displayed 
correctly. This is probably the right time to download the entire 
message, because the user has chosen to look at the attachments.

The code suggested here will at least partly resolve the issue related 
to imap partial fetch. I often get emails which a 3.6k text message and 
with 22 M of images. The proposed change will as a minimum allow me to 
check the text of the message before I start downloading 22M of images.

And of course I will need to add a few options like
  { "imap_partial_fetch",      DT_BOOL, R_NONE, OPTIMAPPARTIALFETCH, 0 
},
  /*
  ** .pp
  ** If enabled, mutt will at first download only the first part of an IMAP 
message.
  ** Useful in case of IMAP messages with large attachments.
  */

Lots of work ahead. Any suggestions so far?

Cheers,

Tilman



On Sun, Jan 05, 2014 at 02:30:53PM -0800, Brendan Cully wrote:
> On Sunday, 05 January 2014 at 22:55, Tilman WEIERS wrote:
> > Hi all,
> > 
> > I would like to announce I am working on imap partial fetch. There is a 
> > ticket for this issue under
> > http://dev.mutt.org/trac/ticket/3465
> > 
> > I want to avoid doing someone else's work again. Is there anyone else 
> > working on imap partial fetch?
> 
> Hi!
> 
> This is exciting news! As far as I'm aware no one has taken on any of
> this yet. I'd recommend you outline your plan for it before coding it
> up, in case we can offer any feedback that might reduce the work
> involved in implementing it and getting it integrated.
> 
> Thanks,
> Brendan

Reply via email to