- for (type = IMAP_NS_PERSONAL; *s; type++)
- {
- s = imap_next_word (s);
- if (*s && ascii_strncasecmp (s, "NIL", 3))
- {
- s++;
- while (*s && *s != ')')
- {
- s++; /* skip ( */
- /* copy namespace */
- n = 0;
- delim = '\0';
-
- if (*s == '\"')
- {
- s++;
- while (*s && *s != '\"')
- {
- if (*s == '\\')
- s++;
- ns[n++] = *s;
- s++;
- }
- if (*s)
- s++;
- }
- else
- while (*s && !ISSPACE (*s))
- {
- ns[n++] = *s;
- s++;
- }
- ns[n] = '\0';
- /* delim? */
- s = imap_next_word (s);
- /* delimiter is meaningless if namespace is "". Why does
- * Cyrus provide one?! */
- if (n && *s && *s == '\"')
- {
- if (s[1] && s[2] == '\"')
- delim = s[1];
- else if (s[1] && s[1] == '\\' && s[2] && s[3] == '\"')
- delim = s[2];
- }
- /* skip "" namespaces, they are already listed at the root */
- if ((ns[0] != '\0') && (nsbused < nsblen) && (*nns < nsilen))
- {
- dprint (3, (debugfile, "browse_get_namespace: adding %s\n", ns));
- nsi->type = type;
- /* Cyrus doesn't append the delimiter to the namespace,
- * but UW-IMAP does. We'll strip it here and add it back
- * as if it were a normal directory, from the browser */
- if (n && (ns[n-1] == delim))
- ns[--n] = '\0';
- strncpy (nsbuf+nsbused,ns,nsblen-nsbused-1);
- nsi->prefix = nsbuf+nsbused;
- nsbused += n+1;
- nsi->delim = delim;
- nsi++;
- (*nns)++;
- }
- while (*s && *s != ')')
- s++;
- if (*s)
- s++;
- }
- }
+ for (type = IMAP_NS_PERSONAL; *s; type++) {
+ s = imap_next_word (s);
+ if (*s && ascii_strncasecmp (s, "NIL", 3)) {
+ s++;
+ while (*s && *s != ')') {
+ s++; /* skip ( */
+ /* copy namespace */
+ n = 0;
+ delim = '\0';
+
+ if (*s == '\"') {
+ s++;
+ while (*s && *s != '\"') {
+ if (*s == '\\')
+ s++;
+ ns[n++] = *s;
+ s++;
+ }
+ if (*s)
+ s++;
+ }
+ else
+ while (*s && !ISSPACE (*s)) {
+ ns[n++] = *s;
+ s++;
+ }
+ ns[n] = '\0';
+ /* delim? */
+ s = imap_next_word (s);
+ /* delimiter is meaningless if namespace is "". Why does
+ * Cyrus provide one?! */
+ if (n && *s && *s == '\"') {
+ if (s[1] && s[2] == '\"')
+ delim = s[1];
+ else if (s[1] && s[1] == '\\' && s[2] && s[3] == '\"')
+ delim = s[2];
+ }
+ /* skip "" namespaces, they are already listed at the root */
+ if ((ns[0] != '\0') && (nsbused < nsblen) && (*nns < nsilen)) {
+ debug_print (3, ("adding %s\n", ns));
+ nsi->type = type;
+ /* Cyrus doesn't append the delimiter to the namespace,
+ * but UW-IMAP does. We'll strip it here and add it back
+ * as if it were a normal directory, from the browser */
+ if (n && (ns[n - 1] == delim))
+ ns[--n] = '\0';
+ strncpy (nsbuf + nsbused, ns, nsblen - nsbused - 1);
+ nsi->prefix = nsbuf + nsbused;
+ nsbused += n + 1;
+ nsi->delim = delim;
+ nsi++;
+ (*nns)++;
+ }
+ while (*s && *s != ')')
+ s++;
+ if (*s)
+ s++;
+ }
+ }