First comment: why are you calling mail_fetch_message()?  The only reason
why a well-written client would need to do call that function is if it is
downloading the entire message to save on the client's hard drive.
Otherwise, you should be calling mail_fetch_structure() and using the
resulting ENVELOPE and BODY information to fetch portions of the message
as needed.


The program is not a client for end-users; it fetches email to a computer
for the purpose of tape-archiving, so having the entire message is important
:-)

The secret is to arm a mailgets_t callback function via the SET_GETS
operation of mail_parameters().  Then, use mail_partial_text() and/or
mail_partial_body() to access the desired data.

<snip>

For this reason, modern (including 32-bit Windows which is Windows 95 or
later) software which uses the mailgets_t functionality avoids the
secondary functionality by arming the mailgets_t function immediately
prior to a mail_partial_body()/mail_partial_text() call, and then
disarming it:
   mail_parameters (NIL,SET_GETS,(void *) myMailGets);
   retval = mail_partial_text (.....);
   mail_parameters (NIL,SET_GETS,NIL);
   if (retval)
        success_action;
   else
        error_action;

Generally, the only time this is actually used is when processing
attachments.  Specifically, the normal mail_fetch_body() calls are called
for text message parts (which generally are of manageable size), and the
mail_partial_body() call is used to read a big attachment.  Take a look at
the code in Pine/Alpine to see how this is done.


So there isn't a good way to get the entire source of the message at once?
I'm not interested in the rfc822 structure of the message right now; I'm
just looking for an IMAP protocol parser that's a bit faster and better
tested than my code.  The fact that c-client also handles all of the ssl,
tls, and rfc822 parsing (for other things I'm working on) is just extra
niceness in my book.
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to