Subject: Fetching a message header within a message body

From: "Mark Elvers" <[email-masked]>
Date: Mon, 29 Oct 2001 14:20:40 -0000

I have a 'complex' message which has the following structure:-

section "1.1", type "TEXT/PLAIN" - first message
section "1.2", type "TEXT/HTML" - first message in html format
section "2", type "IMAGE/JPEG" - first attachment to message
section "3", type "IMAGE/JPEG" - second attachment to message
section "4", type "MESSAGE/RFC822" - message attached to first message
section "4.1.1", type "TEXT/PLAIN" - second message text
section "4.1.2", type "TEXT/HTML" - second message text in html format
section "4.2", type "IMAGE/JPEG" - attachment to second message
section "5", type "TEXT/PLAIN" - third attachment to the first message

What I would like to do is grab *just* the header of the attached message.
The only function that takes a specific section number is mail_fetch_body(),
but if I do

char *s = mail_fetchbody_full(mailstream, i, "4", NIL, FT_PEEK);

s then contains the text of "4", "4.1.1", "4.1.2" and "4.2".  Is there
another way to do this?

On another subject is there a way to definitely know that "1.1" is really
the same as "1.2" and "4.1.1" is the same as "4.1.2".

Lastly, I'm using imap-2000c if that makes any difference

Thanks

Mark

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Mon, 29 Oct 2001 09:52:06 -0800 (PST)

On Mon, 29 Oct 2001 14:20:40 -0000, Mark Elvers wrote:
> The only function that takes a specific section number is mail_fetch_body()

You probably overlooked mail_fetch_header():

char *mail_fetch_header (MAILSTREAM *stream,unsigned long msgno,char *section,
                         STRINGLIST *lines,unsigned long *len,long flags);

> the same as "1.2" and "4.1.1" is the same as "4.1.2".

Look at the subtype of the encapsulating MULTIPART (sections 1 and 4.1).  If
it is "ALTERNATIVE", then you can reasonably conclude they are the same.