[dovecot-cvs] dovecot/src/imap cmd-list.c, 1.49, 1.50 namespace.c,
1.11, 1.12 namespace.h, 1.4, 1.5
cras at dovecot.org
cras at dovecot.org
Sat Jan 14 19:10:05 EET 2006
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv10365
Modified Files:
cmd-list.c namespace.c namespace.h
Log Message:
Fixes to returning namespace root with "" mask.
Index: cmd-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-list.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- cmd-list.c 14 Jan 2006 16:48:52 -0000 1.49
+++ cmd-list.c 14 Jan 2006 17:10:02 -0000 1.50
@@ -444,7 +444,7 @@
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);
+ ns = namespace_find_visible(client->namespaces, &ref);
if (ns == NULL) {
const char *empty = "";
ns = namespace_find(client->namespaces, &empty);
Index: namespace.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/namespace.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- namespace.c 13 Jan 2006 20:25:59 -0000 1.11
+++ namespace.c 14 Jan 2006 17:10:02 -0000 1.12
@@ -193,9 +193,12 @@
return ret;
}
-struct namespace *
-namespace_find(struct namespace *namespaces, const char **mailbox)
+static struct namespace *
+namespace_find_int(struct namespace *namespaces, const char **mailbox,
+ int show_hidden)
{
+#define CHECK_VISIBILITY(ns, show_hidden) \
+ ((!(ns)->hidden) || (show_hidden))
struct namespace *ns = namespaces;
const char *box = *mailbox;
struct namespace *best = NULL;
@@ -207,7 +210,7 @@
/* find the INBOX namespace */
*mailbox = "INBOX";
while (ns != NULL) {
- if (ns->inbox)
+ if (ns->inbox && CHECK_VISIBILITY(ns, show_hidden))
return ns;
if (*ns->prefix == '\0')
best = ns;
@@ -220,7 +223,8 @@
if (ns->prefix_len >= best_len &&
(strncmp(ns->prefix, box, ns->prefix_len) == 0 ||
(inbox && strncmp(ns->prefix, "INBOX", 5) == 0 &&
- strncmp(ns->prefix+5, box+5, ns->prefix_len-5) == 0))) {
+ strncmp(ns->prefix+5, box+5, ns->prefix_len-5) == 0)) &&
+ CHECK_VISIBILITY(ns, show_hidden)) {
best = ns;
best_len = ns->prefix_len;
}
@@ -237,3 +241,15 @@
return best;
}
+
+struct namespace *
+namespace_find(struct namespace *namespaces, const char **mailbox)
+{
+ return namespace_find_int(namespaces, mailbox, TRUE);
+}
+
+struct namespace *
+namespace_find_visible(struct namespace *namespaces, const char **mailbox)
+{
+ return namespace_find_int(namespaces, mailbox, FALSE);
+}
Index: namespace.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/namespace.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- namespace.h 22 Jul 2004 21:20:00 -0000 1.4
+++ namespace.h 14 Jan 2006 17:10:02 -0000 1.5
@@ -27,5 +27,7 @@
struct namespace *
namespace_find(struct namespace *namespaces, const char **mailbox);
+struct namespace *
+namespace_find_visible(struct namespace *namespaces, const char **mailbox);
#endif
More information about the dovecot-cvs
mailing list