[Dovecot] Know when a Folder is Expunged or Deleted

Timo Sirainen tss at iki.fi
Tue Nov 2 15:37:29 EET 2010


On Mon, 2010-11-01 at 14:26 -0200, Alex Baule wrote:

> I intercept the expunge function, to treat my files expunged, but when i
> expunge a folder, this function it's not called, and my emails don't get my
> treatment to be expunged.

Yeah.. Maybe some day I should change the mailbox deletion to work by
sending expunge to all mails and then simply removing the empty mailbox.
This is how it works with multi-dbox, but not with others.

> Basically i need to do something like this:
> 
> It's empty ? No --> return OK but Dont Delete folder, because it's not
> empty.
>                   Yes --> Return OK and Delete the Folder to be expunged.

So you want to disallow deleting non-empty folders? Anyway, you need to
hook into struct mailbox.delete. See quota_mailbox_delete() in quota
plugin. box->opened=TRUE if it was a real selectable mailbox, while it's
FALSE if it was simply a directory (Maildir++ has only selectable
mailboxes).




More information about the dovecot mailing list