On Fri, 18 Mar 2005 19:52:34 +0200 Timo Sirainen <tss@iki.fi> wrote:
On 18.3.2005, at 19:36, Chris Wakelin wrote:
An empty ("" string) mailbox name argument is a special request to return the hierarchy delimiter and the root name of the name given in the reference. The value returned as the root MAY be null if the reference is non-rooted or is null. In all cases, the hierarchy delimiter is returned. This permits a client to get the hierarchy delimiter even when no mailboxes by that name currently exist. .. Mind you, it looks like at least our UW-IMAP also gets it wrong for "~/mail/". Of course, I may be misunderstanding something!
No, after reading it through several times and testing how UW-IMAP reacts to different input, I finally understood it. The "root name" means the first part of the hierarchical mailbox name (um. is that any more understandable?). Eg. "foo/bar/baz" -> "foo/". I'll change it to return that.
Ah! That makes more sense, and in that case UW-IMAP isn't getting it wrong for "~/mail/" after all. I've tried your fix, but it doesn't seem to work. I'm still getting '* LIST (\NoSelect) "/" ""' for all the hidden namespaces. Looking at the code, my guess is that the namespace_find() call is modifying "ref" and so the strchr() never finds a match. This patch --- dovecot-1.0-stable.orig/src/imap/cmd-list.c Fri Mar 18 20:00:44 2005 +++ dovecot-1.0-stable/src/imap/cmd-list.c Mon Mar 21 11:53:26 2005 @@ -366,7 +366,8 @@ concept which probably no other client uses than Pine. Just try our best to emulate UW-IMAP behavior and hopefully we're fine. */ - ns = namespace_find(client->namespaces, &ref); + const char *ref_copy = t_strdup(ref); + ns = namespace_find(client->namespaces, &ref_copy); if (ns == NULL) { const char *empty = ""; ns = namespace_find(client->namespaces, &empty); seems to work, but I'm no expert in C (I program by imitation ;-) ), so I may have made a mistake with pointers, consts, string functions etc. Having said that, Pine is still getting confused. This time it's trying 'LIST "" ~/mail' and getting no results whereas UW-IMAP gives '* LIST (\NoSelect) "/" ~/mail'. Best Wishes, Chris --+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-- Christopher Wakelin, c.d.wakelin@reading.ac.uk IT Services Centre, The University of Reading, Tel: +44 (0)118 378 8439 Whiteknights, Reading, RG6 2AF, UK Fax: +44 (0)118 975 3094