[Dovecot] There is a way to know if a email has been expunged ?

Timo Sirainen tss at iki.fi
Mon Feb 13 22:18:42 EET 2012


On 13.2.2012, at 19.28, Alex Baule wrote:

> static void emexis_mailbox_allocated(struct mailbox *box)
> {
>    union mailbox_module_context *zbox;
> 
>    zbox = p_new(box->pool, union mailbox_module_context, 1);
>    zbox->super = box->v;
>    box->v.open = Mplugin_mailbox_open;
>    box->v.sync_notify = Mplugin_mailbox_sync_notify;
> 
>    MODULE_CONTEXT_SET_SELF(box, emexis_storage_module, zbox);
> }

The above is an "old way" to do it. It doesn't work well if you have any other plugins loaded.

> struct mailbox_vfuncs *v = box->vlast;
> v->sync_notify = Mplugin_mailbox_sync_notify;
> 
> But in this two cases, the Mplugin_mailbox_sync_notify is never
> called... i missing something ??

Never called at all? What storage backend are you using as the base? Maildir?

Anyway, the way you should be calling it is the exact same way quota plugin does:

void Mplugin_mailbox_allocated(struct mailbox *box)
{
	struct mailbox_vfuncs *v = box->vlast;
	union mailbox_module_context *zbox;

	zbox = p_new(box->pool, union mailbox_module_context, 1);
	zbox->super = *v;
	box->vlast = &zbox->super;

	v->open = Mplugin_mailbox_open;
	v->sync_notify = Mplugin_mailbox_sync_notify;
	MODULE_CONTEXT_SET_SELF(box, Mplugin_storage_module, zbox);
}



More information about the dovecot mailing list