I'm a bit of a newbie, especially when it comes to dovecot
internals, but nevertheless, I need some help:
I'm working on a dovecot plugin, and I would like to copy
a mail message from the mail store out to a temporary file,
less a few headers:
static const char *const exclude_headers[] = {
"X-DSPAM-Signature"
}
strcpy(fname, mktemp(fname));
fd = creat(fname, 0600);
mail_get_stream(mail, NULL, NULL, &input);
output = o_stream_create_fd_file(fd, 0, TRUE);
input = i_stream_create_header_filter(input,
HEADER_FILTER_EXCLUDE | HEADER_FILTER_NO_CR,
exclude_headers, N_ELEMENTS(exclude_headers),
null_header_filter_callback, NULL);
o_stream_send_istream(output, input);
But all I get in the temp file is the message body,
i.e. no headers at all. What am I doing wrong here?
My understanding (or hope:) of what the function
i_stream_create_header_filter() is supposed to do
might not be accurate: I was hoping that it would
exclude the aforementioned headers, but leave the
rest of the headers as is.
Any help appreciated
/Lars
On Tue, 2007-10-09 at 00:40 +0200, Lars Stavholm wrote:> static const char *const exclude_headers[] = { > "X-DSPAM-Signature" > } > strcpy(fname, mktemp(fname)); > fd = creat(fname, 0600); > mail_get_stream(mail, NULL, NULL, &input); > output = o_stream_create_fd_file(fd, 0, TRUE); > input = i_stream_create_header_filter(input, > HEADER_FILTER_EXCLUDE | HEADER_FILTER_NO_CR, > exclude_headers, N_ELEMENTS(exclude_headers), > null_header_filter_callback, NULL); > o_stream_send_istream(output, input); > > > But all I get in the temp file is the message body, > i.e. no headers at all. What am I doing wrong here?That looks correct. If you leave out the header filter stream it writes the headers also? -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20071021/dfc3be2e/attachment-0002.bin>