[Dovecot] Know when a Folder is Expunged or Deleted

Alex Baule alexwbaule at gmail.com
Wed Nov 3 17:09:03 EET 2010


Using the mail_storage_set_error()  works well, i set my messages with
this..!

I said use the rename, because to delete a folder call the rename function,
ex(MyFolder --> Trash.MyFolder)

i will use the mailbox_status() in rename hook, because if i return -1, the
Folder will remain unchanged, and don't be moved to Trash.


2010/11/3 Timo Sirainen <tss at iki.fi>

> On Wed, 2010-11-03 at 09:38 -0200, Alex Baule wrote:
>
> > I try to do what you said, but i can't delete a folder from maildir,
> because
> > the box->opened it's allways true.
>
> It's supposed to be, yes.
>
> >     if (!box->opened) {
> >         i_warning("Empty Folder...");
>
> No, box->opened doesn't mean it's empty. It means it's not a mailbox at
> all. For example with mbox you could have:
>
> ~/mail/archive/
> ~/mail/archive/2009
>
> Now you would have "archive" directory which would show up as
> box->opened=FALSE, but "archive/2009" would be box->opened=TRUE,
> regardless of how many messages it has.
>
> If you want to check if the mailbox is empty, you need to check for it
> manually with mailbox_status().
>
> >         return zbox->super.delete(box);
> >     }
> >     i_warning("Full Folder...");
> >     return -1;
> > }
> >
> > Can i do that in "rename mailbox" function ? If Rename has .Trash in the
> > name, i don't rename and return -1.
>
> I'm not sure what you mean.. Yes, you can cancel a rename operation if
> you want to.
>
> > i Try too, don't let the user "move" one message from any folder to my
> > "quarantine" folder, i intercept the copy function with a hook, but i
> only
> > can do this, returning -1 in the copy function, but with -1 i will get a
> > error message in the client like "Mailbox already exist" if i return 0
> the
> > source email is flaged as Trash and don't show anymore in the source
> > folder... Can i do this, returning some value that works well and dont
> cause
> > a client message ?
>
> Use mail_storage_set_error() before returning -1.
>
>


More information about the dovecot mailing list