<<< Date Index >>>     <<< Thread Index >>>

Re: Using a maildir or mh folder for the message cache?



Hi,

* Kyle Wheeler [06-08-08 10:06:49 -0400] wrote:
On Tuesday, August  8 at 10:29 AM, quoth Rocco Rutte:

[...]

I don't know very much about mh, but at least for maildir an operation like 'flag' or 'reply' could change the filename so that next time, the body cache won't find the message because of the rename.

Nonsense.

[...]

Thus, you can extract the original filename with this simple code:

  char * tail = strrchr(filename, ':');
  if (tail) *tail = 0;
  printf("IMAP UID is %s\n", filename);

Tada!

No. You can't do this efficiently.

What your code does is: 'I have a filename and now tell me which server UID it is'. This works, of course, but it's not what we want.

What we want is: 'I have a unique server ID and now give me the local filename'.

If a client mangled the maildir filenames (_not_ just mutt!), we'd have go through all of them one by one, and compare the first n characters and check for the maildir suffix.

If you have an IMAP folder with >1k messages, for every single cache check we'd have to perform this check at worst 1k times. And this is IMHO bad as depending on storage and network link, downloading may even be faster.

But: if one understands that very clearly, it's trivial to set up symlinks to use either a POP or IMAP body cache as a read-only maildir folder. This works nicely.

Perhaps a script to do so would be a nice thing to add to the docs?

That could be done, of course. But Brendan's intention (which I support) is to prevent the majority of user doing this (for now) to prevent bug reports or the like because filenames are mangled.

Just many things are misleading here. For example, if a maildir message is flagged, replied, etc it has a proper maildir suffix, but from the name in the body cache you can't tell as flags are managed at a different place. So enabling by default _could_ produce many mails by people complaining about 'wrong' or 'missing' flags when viewing it as maildir.

I doubt most user are willing to read the maildir docs to get an idea of what exactly what they're doing. Well, most on this list are, so just go with symlinks and folder-hooks to open them read-only.

  bye, Rocco
--
:wq!