[Dovecot] patch: list shared namespace

Timo Sirainen tss at iki.fi
Sat Nov 1 23:43:28 EET 2008


On Fri, 2008-10-31 at 17:51 +0200, Timo Sirainen wrote:
> LIST % -> List "foo" as non-existing
> LIST foo -> List "foo" as non-existing
> LIST * -> List "foo/bar" only

There are also some truly horrible cases. For example:

1 list "" foo*
* LIST (\HasNoChildren) "." "foo.foo.foo"
* LIST (\HasNoChildren) "." "foo.bar.baz"
1 ok

2 list "" f*o.%
* LIST (\HasNoChildren) "." "foo.foo.foo"
* LIST (\Noselect \HasChildren) "." "foo.bar"
2 OK List completed.

3 list "" f*r
* LIST (\Noselect \HasChildren) "." "foo.bar"
3 OK List completed.

As you can see, the non-existing "foo.foo" isn't returned because its
child "foo.foo.foo" also matches the pattern and is returned. But the
non-existing "foo.bar" is returned because its children don't match the
pattern. It took me forever to get all this stuff working right with
Maildir++. :)

I think it would be possible to implement the same somewhat easily in
ACL code:

1. When ACL code sees that a non-existing mailbox is to be returned,
find out if there are any patterns that match the mailbox and that ends
with "*" character. If yes, don't return the mailbox (because its
children will be returned anyway). If not:

2. Start a new mailbox listing that lists children of the non-existing
mailbox (mailbox/*). If you find:

a) A visible mailbox that matches the original patterns -> don't return
the original non-existing mailbox (since its child will be returned
later)

b) No visible mailboxes -> don't return the original non-existing
mailbox

c) Fallback to returning the non-existing mailbox

The same logic should also be used when determining if shared namespace
prefixes should be returned (I think ACL code can do that too?)

Also that code should work properly when mailbox names contain "*" or
"%" characters. Basically it means that when generating the mailbox/*
pattern replace all "*" chars with "%" chars in the mailbox name and
then later when going through the results skip over everything that
doesn't begin with the real mailbox name.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20081101/1ec6a272/attachment.bin 


More information about the dovecot mailing list