Subject: bug#58872: nnimap-use-namespaces doesn't work with empty prefix

From: Björn Bidar <[email-masked]>
Date: Fri, 11 Nov 2022 14:47:47 +0200

I notice that the option only works if the inbox namespace has a prefix.
If the prefix to the inbox is empty `nnimap-namespace` stays empty even
if nnimap-use-namespaces is set to true and the server returns a
namespace.

Dovecot returns this when asking for namespaces without a prefix set:
~/:telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ STARTTLS AUTH=PLAIN] Dovecot ready.
a login user password
a OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY PREVIEW STATUS=SIZE SAVEDATE LITERAL+ NOTIFY SPECIAL-USE] Logged in
namespace 
b namespace            
* NAMESPACE (("INBOX." ".")) NIL NIL
b OK Namespace completed (0.001 + 0.000 secs).

If the namespace has a prefix e.g. INBOX., nnimap-namespace is set to
INBOX.

Br,

Björn