On Mon, 2009-06-22 at 18:40 +0200, Alessandro Ranellucci wrote:
On 22-06-2009 at 17:35, Timo Sirainen wrote:
Hmm. Out of these two possibilities, I think it's easier to just return a modified message from mail_get_stream(). You could probably do something similar to what mbox does and use i_stream_create_header_filter() where you simply return a new X-Mailbox: header after the headers are sent.
Thank you, Timo. I'll need to get familiar with Dovecot sources.
That would be implemented as a patch against the virtual plugin? Or as a patch against the maildir code?
I'm actually again beginning to wonder what's a good way to implement this. The main problem is that messages must never change and Dovecot relies on this. For example messages' virtual sizes are stored in dovecot.index.cache file. If you change the message, the virtual size and other similar cached metadata is broken. So simply changing the message stream in virtual mailboxes won't work, because the cached metadata would also have to be changed and that makes it much more difficult.
So the somewhat easy to implement possibilities require the X-Mailbox: header to exists always for non-virtual mailboxes too. You can either implement code that actually saves it to the maildir files, or you can write a plugin that overrides mail_get_stream() and adds the header, similar to how zlib plugin works.