2006/2/12, Timo Sirainen tss@iki.fi:
On Sun, 2006-02-12 at 16:20 +0100, Jonas Olsson wrote:
Questions:
How does Dovecot generate the POP3 UIDL?
Using pop3_uidl_format. %v means UIDVALIDITY and %u means message UID. With maildir those are taken from dovecot-uidlist file.
Is there any workaround that I could use to make Dovecot generate a consistent POP3 UIDL output, enabling a migration from MBOX to Maildir, or am I stuck with using MBOX?
You can convert your mails in a way that preserves the UIDVALIDITY and UIDs. In mboxes the UIDVALIDITY is stored in X-IMAPbase or X-IMAP header in the first mail in the mailbox. UIDs are stored in X-UID header for each mail.
So what you'd need to do is create some script to build the dovecot-uidlist file properly. As far as I know no-one's done this yet, but it shouldn't be too difficult.
dovecot-uidlist file format is:
<uidvalidity> <next-unused-uid> <uid> <filename> <next uid> <next filename> ..
You should also set next-unused-uid value properly. It's also in X-IMAPbase/X-IMAP header as the next number after UIDVALIDITY.
A quick lock through the current mailboxes reveals that 28 of them contain messages but lack an X-IMAPbase/X-IMAP header. A large majority of the mailboxes also lack any X-UID headers.
I can get the UIDVALIDITY base of the the mailboxes missing an X-IMAP header by connecting to the Dovecot POP3 service, I guess, but how about all the mailboxes lacking X-UID headers? Is there a way I can determine, in a scriptable way, which message has which UID or should I assume that the UIDs are assigned in chronological order based on the next-UID value in the X-IMAP header? That is, the last message in the MBOX file has UID = next-UID - 1, the next to last = next-UID - 2, and so on?
Thank you for your replies by the way. They are very helpful in making this migration happen.
-- /Jonas Olsson