[Dovecot] Mixing MBOX and Maildir?
Is it possible to have some folders be mbox and some be maildir format?
Why you might ask? Sometime for diagnostics I have the Exim MTA archive certain messages in MBOX format and then I want to copy them into an imao folder to look at them with Thunderbird. When I used MBOX all I had to do was copy the file into a folder and it worked. So what I'd like to do is have a folder with a special name that is MBOX and the rest be maildir.
Ideally have Dovecot be smart so that if the file exists then it is assumed to be MBOX and if the directory exists then it is assumed to be maildir. Has anyone done anything like this?
* On 21/04/07 09:38 -0700, Marc Perkel wrote: | Is it possible to have some folders be mbox and some be maildir format? | | Why you might ask? Sometime for diagnostics I have the Exim MTA archive | certain messages in MBOX format and then I want to copy them into an | imao folder to look at them with Thunderbird. Hi there Mark, Why don't you just use a tool like mbox2maildir to do that? -Wash http://www.netmeister.org/news/learn2quote.html DISCLAIMER: See http://www.wananchi.com/bms/terms.php -- +======================================================================+ |\ _,,,---,,_ | Odhiambo Washington <wash@wananchi.com> Zzz /,`.-'`' -. ;-;;,_ | Wananchi Online Ltd. www.wananchi.com |,4- ) )-,_. ,\ ( `'-'| Tel: +254 20 313985-9 +254 20 313922 '---''(_/--' `-'\_) | GSM: +254 722 743223 +254 733 744121 +======================================================================+ "I may not be totally perfect, but parts of me are excellent." -- Ashleigh Brilliant
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi Wash,
- On 21/04/07 09:38 -0700, Marc Perkel wrote: | Is it possible to have some folders be mbox and some be maildir format? | | Why you might ask? Sometime for diagnostics I have the Exim MTA archive | certain messages in MBOX format and then I want to copy them into an | imao folder to look at them with Thunderbird. Why don't you just use a tool like mbox2maildir to do that?
Parallel using of Mbox to Maildir++ could be used for archive old Msgs in a readonly compressed Mbox file. Or is there any other solution?
Mfg. Stefan Klatt
CaC, Computer and Communication Inhaber Stefan Klatt Triftstrasse 9 60528 Frankfurt Germany
Tel.: +49-(0)172-6807809 Tel.: +49-(0)69-67808-900 Email: stefan.klatt@cac-netzwerk.de -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGLH0L+AkeCg4UPr4RAkV5AKCMaEHosPW3OwE9qRypGSywxasvrACg9lCi KOineYhcU6XtZ6LVuKPC0k0= =JLE3 -----END PGP SIGNATURE-----
Odhiambo WASHINGTON wrote:
- On 21/04/07 09:38 -0700, Marc Perkel wrote: | Is it possible to have some folders be mbox and some be maildir format? | | Why you might ask? Sometime for diagnostics I have the Exim MTA archive | certain messages in MBOX format and then I want to copy them into an | imao folder to look at them with Thunderbird.
Hi there Mark,
Why don't you just use a tool like mbox2maildir to do that?
That's the backup plan.
Why couldn't this be done. If you re in maildir mode opening a folder you are expecting a directory structure:
.folder .folder/cur .folder/tmp .folder/new
However if instead you find an mbox file called:
folder
Then you just open it as mbox and have it work automatically. Or alternatively translate it to maildir automagically.
Marc Perkel wrote:
Why couldn't this be done. If you re in maildir mode opening a folder you are expecting a directory structure:
.folder .folder/cur .folder/tmp .folder/new
However if instead you find an mbox file called:
folder
Then you just open it as mbox and have it work automatically. Or alternatively translate it to maildir automagically.
You could, but my impression is that Timo would consider that to be adding too much complexity to the code for the benefit. It could also be a performance issue due to the fact it would probably require at least one extra syscall per access.
He may have suggestions on where to start if you wanted to create a local patch for something like that but I think there are other things he wants to get done first.
Of course I could be totally wrong so take this message with the proverbial grain of salt.
Jonathan
On Sat, 2007-04-21 at 09:38 -0700, Marc Perkel wrote:
Is it possible to have some folders be mbox and some be maildir format?
Why you might ask? Sometime for diagnostics I have the Exim MTA archive certain messages in MBOX format and then I want to copy them into an imao folder to look at them with Thunderbird. When I used MBOX all I had to do was copy the file into a folder and it worked. So what I'd like to do is have a folder with a special name that is MBOX and the rest be maildir.
You could do this with namespaces. http://wiki.dovecot.org/Namespaces has an example.
Ideally have Dovecot be smart so that if the file exists then it is assumed to be MBOX and if the directory exists then it is assumed to be maildir. Has anyone done anything like this?
I was thinking about implementing this to v1.1, but it's not so easy, so I'm not sure.
On Fri, May 11, 2007 at 04:50:41PM +0300, Timo Sirainen wrote:
Ideally have Dovecot be smart so that if the file exists then it is assumed to be MBOX and if the directory exists then it is assumed to be maildir. Has anyone done anything like this?
I was thinking about implementing this to v1.1
I've already asked about it in the past, but since it came again, I just wanted to add my wish for this (before I write a bigger message on another subject). That's one of the features we're most missing - mixing mboxes and Maildirs in the same namespace - that is due to the fact that many users use such mailers like pine, mutt, etc. which support it, and choose to keep some of their bigger mailboxes as maildirs and their smaller ones as mbox, and except for at the time of creation, it's relatively transparent.
Another wish would be a better form of cascading - subfolders as subdirectories, instead of this awkward Maildir++ dot-separated format.
These two together will save me (and some user users who use IMAP in addition to mutt or pine) the need to create two directory full of symbolic links to access thei mail through IMAP.
but it's not so easy, so I'm not sure.
Having looked again at the code, this does indeed not seem all that easy. The code handling the mailbox namespace browsing seems too tightly integrated with the code handling the mailboxes themselves.
I suppose it would be best if those two were separated, so a namespace module will handle issues like "what subfolders does the folder Foo have" and "what is the physical path for folder Foo.Bar", while the mailbox module will handle issues like "what messages are there in folder whose physical path is mail/.Foo.Bar" and "fetch the message with UID 117 from the folder whose physical path is mail/.Foo.Bar". The mailbox access module will query the namespace module to obtain those paths.
I'm not sure how much work this restructuring would be, but it will definitely be useful, as it will enable adding different namespace modules (with more flexibility) and different folder formats separately in a cleaner way.
Which brings the subject of the next message I'm about to write to this list.
-- Tom
-- Tom Alsberg - hacker (being the best description fitting this space) Web page: http://www.cs.huji.ac.il/~alsbergt/ DISCLAIMER: The above message does not even necessarily represent what my fingers have typed on the keyboard, save anything further.
On Sun, 2007-05-13 at 13:45 +0300, Tom Alsberg wrote:
Another wish would be a better form of cascading - subfolders as subdirectories, instead of this awkward Maildir++ dot-separated format.
I think this is possible already with CVS HEAD:
mail_location = Maildir:~/Maildir:LAYOUT=fs
Having looked again at the code, this does indeed not seem all that easy. The code handling the mailbox namespace browsing seems too tightly integrated with the code handling the mailboxes themselves.
Did you look at v1.0 or the CVS HEAD?
I suppose it would be best if those two were separated, so a namespace module will handle issues like "what subfolders does the folder Foo have" and "what is the physical path for folder Foo.Bar", while the mailbox module will handle issues like "what messages are there in folder whose physical path is mail/.Foo.Bar" and "fetch the message with UID 117 from the folder whose physical path is mail/.Foo.Bar". The mailbox access module will query the namespace module to obtain those paths.
This is what mailbox_list and mailbox_storage separation was supposed to do. There is still 1:1:1 with mailbox_list:mail_namespace:mail_storage but I don't think it's too difficult to change that. At least compared to what it's like in v1.0.
On Sun, May 13, 2007 at 03:26:40PM +0300, Timo Sirainen wrote:
On Sun, 2007-05-13 at 13:45 +0300, Tom Alsberg wrote:
Another wish would be a better form of cascading - subfolders as subdirectories, instead of this awkward Maildir++ dot-separated format.
I think this is possible already with CVS HEAD:
mail_location = Maildir:~/Maildir:LAYOUT=fs
I'll try that out. Will be nice if it works.
Having looked again at the code, this does indeed not seem all that easy. The code handling the mailbox namespace browsing seems too tightly integrated with the code handling the mailboxes themselves.
Did you look at v1.0 or the CVS HEAD?
1.0, for now. That's the last version I built here. I'll look at 1.1 now that I have heard there are interesting changes there.
I suppose it would be best if those two were separated, so a namespace module will handle issues like "what subfolders does the folder Foo have" and "what is the physical path for folder Foo.Bar", while the mailbox module will handle issues like "what messages are there in folder whose physical path is mail/.Foo.Bar" and "fetch the message with UID 117 from the folder whose physical path is mail/.Foo.Bar". The mailbox access module will query the namespace module to obtain those paths.
This is what mailbox_list and mailbox_storage separation was supposed to do. There is still 1:1:1 with mailbox_list:mail_namespace:mail_storage
Meaning that every mailbox_list module needs to have a corresponding mail_storage module and vice versa?
but I don't think it's too difficult to change that. At least compared to what it's like in v1.0.
I'll check what has changed in CVS since 1.0...
Thanks, -- Tom
-- Tom Alsberg - hacker (being the best description fitting this space) Web page: http://www.cs.huji.ac.il/~alsbergt/ DISCLAIMER: The above message does not even necessarily represent what my fingers have typed on the keyboard, save anything further.
On Sun, 2007-05-13 at 16:59 +0300, Tom Alsberg wrote:
This is what mailbox_list and mailbox_storage separation was supposed to do. There is still 1:1:1 with mailbox_list:mail_namespace:mail_storage
Meaning that every mailbox_list module needs to have a corresponding mail_storage module and vice versa?
Yes, that's what I meant, although looks like it isn't exactly so.
If you want to support mixed storages within a single namespace, you'd have to do something like:
mailbox_list->iter_is_mailbox() is used to figure out if a file is a valid mailbox. mail_storage overrides that method but doesn't call the super.iter_is_mailbox(). It should do that, and the API should be changed a bit so that you know if the super call really knew for certain that it's a valid mailbox for it, or that the file should definitely be skipped (eg. *.lock files with mboxes).
Add a new mail_storage->is_valid_mailbox() function and some other generic mailbox_open() function that goes through the storages calling the method, and whichever returns TRUE is used to open the mailbox.
Change mail_storage pointer in struct mail_namespace to an array and fix all the callers to use the correct storage. Hmm. Although I'm actually now checking if I could just remove this completely..
participants (6)
-
Jonathan Stewart
-
Marc Perkel
-
Odhiambo WASHINGTON
-
Stefan Klatt
-
Timo Sirainen
-
Tom Alsberg