This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.

Mailbox List

src/lib-storage/mailbox-list.h and mailbox-list-private.h describes mailbox list. The purpose of mailbox list is to manage mailbox storage name <-> physical directory path mapping. Its most important functions are:

Mailbox list code also internally creates and updates mailbox changelog (in dovecot.mailbox.log file), which keeps track of mailbox deletions, renames and subscription changes. This is primarily useful for dsync utility.

Mailbox list is configured by mail_location setting, which fills struct mailbox_list_settings:

Listing mailboxes

First the list operation is initialized with one of the init functions:

The patterns are IMAP-style patterns with '%' and '*' wildcards as described by RFC 3501: '%' matches only up to next hierarchy separator, while '*' matches the rest of the string.

These flags control what mailboxes are returned:

These flags control what is returned for matching mailboxes:

Other flags:

Once listing is initialized, mailbox_list_iter_next() can be called until it returns NULL. The returned mailbox_info struct contains:

Finally the listing is deinitalized with mailbox_list_iter_deinit(). If it returns -1, it means that some mailboxes perhaps weren't listed due to some internal error.

If you wish to get mailbox_info flags only for a single mailbox, you can use mailbox_list_mailbox().

Directory permissions

mailbox_list_get_permissions() and mailbox_list_get_dir_permissions() can be used to get wanted permissions for newly created files and directories.

The returned permissions are:

If changing the group fails with EPERM, eperm_error_get_chgrp() can be used to log a nice and understandable error message.

None: Design/Storage/MailboxList (last edited 2009-12-16 01:07:25 by TimoSirainen)