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