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.


Ok, so my code for getting the entire message looks like:

char *header;
int email_fd, msgno;
...
header = mail_fetchheader(stream, msgno);
write(email_fd, header, strlen(header);

mail_parameters (NIL,SET_GETS,(void *) myMailGets);
mail_partial_body(stream, msgno, 0, 0, 0, 0);
mail_parameters (NIL,SET_GETS,NIL);

where myMailGets writes to the email_fd a few KiB at a time and returns 0.
Is that a reasonable use of c-client, or am I still doing offensive things
to it?  It looks like all the mail_fetch* functions documented in the
internals.txt return character pointers, so I assume this is the best way to
get a full message without reading the whole thing to memory.
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to