Hi all,

I'm implementing maildir support for the GNOME's messaging library
Camel. Camel uses a provider abstraction for mail stores. A store
provider object allows a MUA to access mail folders and messages through
a simple storage-independent API. The folder abstraction has support for
both messages and subfolders although a provider is not required to
implement both.

It was quite easy and straightforward to implement the basic message
handling operations for isolated maildir folders. I'm now wondering
whether I should also add support for subfolders. It doesn't seem too
difficult and I already have a few ideas for doing it. I'd like to know
if anyone has already implemented subfolders in maildirs and how it has
been done.

I searched through the mailing list archives for more information about
maildir subfolders and found a number of messages discussing the matter.
There however doesn't seem to be any standard way to implement
subfolders. I'm asking anyone who's developed or used maildir subfolders
to share his/her experiences so I can make the Camel library support any
extensions to the maildir format.

Here's a bunch of specific questions for which I'd like to have answers.

1) Should the maildir format be extended to support subfolders?
The official documentation only mentions the three subdirectories and a
couple of meta files in a maildir folder. Perhaps it's not a good idea
to add subfolders in the maildir format?

2) If subfolders shouldn't be used, then how should I handle multiple
maildirs?
A user might want to store mail in multiple different maildir folders.
Is there a  standard place where such folders should be located? I've
seem people use ~/Mail, ~/IMAP, ~/Maildirs and other places to store
multiple maildir folders in addition to the default $MAILDIR.

3) If subfolders are used, then how they should be formatted?
It seems to me that subfolders should be fullblown maildir folders in
themselves and not just extra "cur" directories with different names. If
the subfolders are true maildirs then mail can be directly delivered to
them.

4) If subfolders are used, then how they should be named/located?
The subfolders could be additional maildir subdirectories of the maildir
folder. That way it would be easy to access the folders, the subfolder
"bar" in the subfolder "foo" of the default maildir would be in
$MAILDIR/foo/bar. What should be done with folders named "new" or "tmp"?
A solution could be to use some kind of name mapping or a specific
directory for holding the subfolders. Examples: $MAILDIR/.foo/.bar,
$MAILDIR/folder-foo/folder-bar, $MAILDIR/sub/foo/sub/bar. 

I also started wondering about caching of message summary information.
It could be quite slow to open and parse each message file in a folder
just to list the folder contents. Camel will probably have an internal
summary cache, but knowledge of other caching mechanisms wouldn't hurt.
Question:

5) How should message contents be changed in a maildir?
When a MUA want's to add a header or otherwise modify the message,
should it assign a new name to the message file? It's generally a bad
idea to rewrite received messages and Camel probably wont do that, but
I'd like to know about other implementations. If the filename of the
message is changed whenever the message is modified, then caching will
be much easier as a single stat on the "cur" directory will be enough to
determine whether folder contents have changed.

Thanks for your attention!

Jukka Zitting
[EMAIL PROTECTED]

Reply via email to