Hi Timo,
I Trying to integrate my antispam with dovecot, using the imap folder to do certain actions. I Do almost every thing, but i have some problems saving the message.
Explaining this function, i try to use a imap folder like a "collector folder", the user append a message from outside (ie another imap or pop message) to this folder, and i don't want to copy this message, i need to redirect it to another folder outside from user's maildir.
Well, i try to base it in zlib plugin, with was the o_stream_create_gz().
Inside the o_stream_create_gz has the Output, it's a copy from the original output.
I Try to replace this output, with another one, that i try to create to another location, without sucessfull.
struct ostream * o_stream_create_X_list(struct ostream *output, struct istream *input, const char *type) { struct emexis_ostream *X_stream; struct ostream *new_output; int fd;
fd = open("/tmp/email",O_WRONLY);
new_output = o_stream_create_fd_file(fd, 0, TRUE); o_stream_cork(new_output);
emexis_stream = i_new(struct emexis_ostream, 1); emexis_stream->ostream.sendv = o_stream_X_sendv; emexis_stream->ostream.flush = o_stream_X_flush; emexis_stream->ostream.iostream.close = o_stream_X_close; emexis_stream->output = new_output; emexis_stream->input = input;
o_stream_ref(new_output);
return o_stream_create(&X_stream->ostream); }
With this new o_stream, i got this error.
Oct 27 15:14:24 brc dovecot: imap(alex@exemplo.com.br): Error: o_stream_send_istream(/storage/gss/emexis/messages/ exemplo.com.br/alex/Maildir/.Emexis.Ext-Blacklist/tmp/1319735664.M568409P30815.brc) failed: Bad file descriptor Oct 27 15:14:24 brc dovecot: imap(alex@exemplo.com.br): Error: o_stream_flush(/storage/gss/emexis/messages/ exemplo.com.br/alex/Maildir/.Emexis.Ext-Blacklist/tmp/1319735664.M568409P30815.brc) failed: Bad file descriptor Oct 27 15:14:24 brc dovecot: imap(alex@exemplo.com.br): Error: write(/storage/gss/emexis/messages/ exemplo.com.br/alex/Maildir/.Emexis.Ext-Blacklist/tmp/1319735664.M568409P30815.brc) failed: Bad file descriptor
There is something wrong Timo ? Like missing something or i need to rewrite another funcion ?
Tks !!!