If anyone is interested in looking in the code on master to see how this works:

https://github.com/cyrusimap/cyrus-imapd/

You're looking for mbname_t, and in particular mbname_from_*.

EXPORTED mbname_t *mbname_from_extname(const char *extname, const struct 
namespace *ns, const char *userid)

And their inverses, which are just the same without the from, i.e.

EXPORTED const char *mbname_extname(const mbname_t *mbname, const struct 
namespace *ns, const char *userid)

The struct behind mbname_t allows for caching, parsing, processing the parts 
differently, and generally much nicer manipulation of names, all the while 
converting everything at the last possible moment - so the internal 
representation inside an mbname_t has no separators at all, instead it's a 
strarray_t of individual names, allowing magic like:

EXPORTED char *mbname_pop_boxes(mbname_t *mbname)

and the inverse:

EXPORTED void mbname_push_boxes(mbname_t *mbname, const char *item)

Allowing you to create parent and child mailboxes programatically.

One thing I'm _not_ doing here, and might switch to doing, is converting 
to-and-from modified UTF7.  It seems a little pointless while there is no 
unicode representation of names - but when we do JMAP we'll need it, and at 
that point the internal representation should be as canonical as possible.  We 
can also enforce the correctness of the UTF7 more easily then, because it has 
to be correct to be parsed!

Bron.

On Fri, 23 Sep 2016, at 14:10, Bron Gondwana wrote:
> On Thu, 22 Sep 2016, at 22:11, Eric Luyten via Info-cyrus wrote:
> > On Thu, September 22, 2016 9:46 am, Michael Menge via Info-cyrus wrote:
> > >
> > 
> > > Quoting Paul van der Vlis via Info-cyrus 
> > > <info-cyrus@lists.andrew.cmu.edu>:
> > >
> > 
> > >> I am wondering about the dot. So far I know I cannot use it in a mailbox
> > >> name, but it is in the list.
> > >>
> > >
> > > I suspect that your cyrus is configured to use the . as hierarchy 
> > > seperator.
> > > see "unixhierarchysep:" in imapd.conf manpage for details.
> > 
> > 
> > 
> > Of course one can use a '.' as part of a Cyrus mailbox name, internally it
> > gets translated into a '^' (arrow/caret).
> 
> In master I've changed the behaviour to expose ^ if you're not in unixhs, so 
> that names are fully translatable between the two settings.  We run in a 
> mixed mode at FastMail - the old imapds listening on mail.messagingengine.com 
> (and our internal stuff) are still using the '.' separator for legacy 
> reasons, but new clients connecting to imap.fastmail.com get both 
> altnamespace (which is now robust) and '/' separators, so they can use dots 
> nicely.
> 
> We're not yet at the point that we want to enable dots in usernames, but 
> we're close.
> 
> > I modified our GOODCHARS definition heavily when we migrated to Cyrus 2.2,
> > ten years ago, and never had an issue with square brackets and such.
> 
> Yep, they seem fine.  We've had them enabled for about a year now.
> 
> Bron.
> 
> -- 
>   Bron Gondwana
>   br...@fastmail.fm


-- 
  Bron Gondwana
  br...@fastmail.fm
----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/
To Unsubscribe:
https://lists.andrew.cmu.edu/mailman/listinfo/info-cyrus

Reply via email to