On Fri, 2008-07-18 at 20:12 +0200, Johannes Berg wrote:
On Fri, 2008-07-18 at 20:58 +0300, Timo Sirainen wrote:
So the quota code eventually sees both ctx->dest_mail = NULL and qt-
tmp_mail = NULL. I'm not really sure what the right fix for this
is.. ctx->dest_mail should be set by something. Perhaps if quota/ antispam overrides it it should set it, and mailbox_save_init()
shouldn't set it if it's already set..Ok, that seems to work, but I think a better alternative would probably be to make dest_mail a struct mail ** like the context.
That'd be an API change and I'd rather not do that for v1.1. But I suppose it would be the best permanent solution, so I'll do that for v1.2. How about these:
http://hg.dovecot.org/dovecot-1.1/rev/8dc6541b4426 http://hg.dovecot.org/dovecot-1.2/rev/dc280df713f4
Alternatively, we could ensure that dest_mail is never NULL to start with, and have mailbox_save_init() create one, but I'm not sure about the performance implications of that. The plugins could, if that's possible (haven't checked) set those flags of what they require, and if there are no plugins then a struct mail with no MAIL_FETCH_* flags wouldn't hurt much, would it?
The problem isn't flags, it's that if the dest_mail is non-NULL then the mail storage backends must assume that caller wants to do something with the mail, so it should be added to index. For example with mbox if dest_mail=NULL the mails are added to index only if the mbox is already fully synchronized. With dest_mail!=NULL the mbox always gets synchronized (which could be slow).