On Mon, 2010-12-27 at 12:08 +0100, Antonio Perez-Aranda wrote:
I get a similar behavior between dovecot quota plugin and courier quota with the attached patch.
When the client change flags, then is forced to recalc. This is because I don't know how to get the changed flags on quota sync method.
Right, there's no way to see what flags changed with the current API. I guess you could modify the API for that.. In maildir_sync_flags() the old flags are in ctx->flags after:
/* get the current flags and keywords */
maildir_filename_get_flags(ctx->keywords_sync_ctx,
fname, &ctx->flags, &ctx->keywords);
And new flags are set to ctx->flags also later.
The API change could be something like:
struct mailbox_sync_notify { enum mailbox_sync_type sync_type; uint8_t old_flags, new_flags; };
void (*sync_notify)(struct mailbox *box, uint32_t uid,
const struct mailbox_sync_notify *notify);
I guess I could do this change for v2.1.
The courier quota behavior is avoid to count all deleted mails, include "mark as deleted" mails.
I don't much like this feature though..
/* YACO: Avoid to count in dirsize Trash Marked mails*/
p = strchr(dp->d_name, 'T');
if (p != NULL){
continue;
}
This isn't always reliable (e.g. hostname could have 'T' letter in it). You should first find the ':' in the filename and look for 'T' only after that.