The mailboxes table

mailboxes lists all the mailboxes that ever existed. When a mailbox is deleted, its mailboxes row stays.

The mailbox name is a UTF-8 string. Archiveopteryx uses case-insensitive mailbox names, so this should be matched with ilike, not like. The name stored is the full name, e.g. /users/nirmala/inbox.

uidnext is the ID which will be given to the next message stored in this mailbox. It is used mostly by IMAP.

nextmodseq is used for the IMAP Conditional Store extension, which permits a client to ask for changes which have happened after a certain change number, etc. The most common use of Condstore is to update offline clients. Archiveopteryx also uses it to manage view mailboxes.

first_recent is the UID (see mailbox_messages.uid) of the first message which has not yet been announced as recent in any IMAP session. (If you don't know about IMAP \Recent, just ignore this field.)

uidvalidity numbers the universes in which UIDs are valid. It mainly serves to distinguish between mailboxes which have the same name but exist at different times. In Archiveopteryx it is almost always 1.

deleted is true if a mailbox is deleted. (If a new mailbox of the same name is created, Archiveopteryx uses this row to make sure uidnext and uidvalidity have sensible values.)

By convention, anyone who updates or inserts rows into mailboxes also sends NOTIFY mailboxes_updated in the same transaction.

create table mailboxes ( -- Grant: select, insert, update id serial primary key, name text not null unique, owner integer references users(id), -- The UID that will be assigned to the next delivered message. -- Incremented after each successful delivery. uidnext integer not null default 1, -- The next modsequence value for this mailbox. nextmodseq bigint not null default 1, -- The UID of the first message that should be marked \Recent. -- Set to uidnext when each new IMAP session is created. first_recent integer not null default 1, -- The IMAP mailbox UIDVALIDITY value, which, along with a message UID, -- is forever guaranteed to uniquely refer to a single message. uidvalidity integer not null default 1, -- When a mailbox is deleted, its entry is marked (not removed), so -- that its UIDVALIDITY can be incremented if it is ever re-created. deleted boolean not null default false );

The mailboxes table was introduced in version 0.93.

In case of questions, please write to info@aox.org.

Relevant links

About this page

Last modified: 2010-11-19
Location: aox.org/db/mailboxes