[dovecot-cvs] dovecot/src/lib-storage mail-namespace.c, 1.5, 1.6 mail-namespace.h, 1.2, 1.3
tss at dovecot.org
tss at dovecot.org
Tue Apr 17 20:59:51 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv2705
Modified Files:
mail-namespace.c mail-namespace.h
Log Message:
Added mail_namespace_update_name()
Index: mail-namespace.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-namespace.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- mail-namespace.c 17 Apr 2007 15:39:30 -0000 1.5
+++ mail-namespace.c 17 Apr 2007 17:59:49 -0000 1.6
@@ -250,6 +250,16 @@
return mail_namespace_find_int(namespaces, mailbox, FALSE);
}
+bool mail_namespace_update_name(struct mail_namespace *ns,
+ const char **mailbox)
+{
+ struct mail_namespace tmp_ns = *ns;
+
+ /* FIXME: a bit kludgy.. */
+ tmp_ns.next = NULL;
+ return mail_namespace_find_int(&tmp_ns, mailbox, TRUE) != NULL;
+}
+
struct mail_namespace *
mail_namespace_find_prefix(struct mail_namespace *namespaces,
const char *prefix)
Index: mail-namespace.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-namespace.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mail-namespace.h 11 Apr 2007 10:55:34 -0000 1.2
+++ mail-namespace.h 17 Apr 2007 17:59:49 -0000 1.3
@@ -27,13 +27,24 @@
struct mail_namespace *mail_namespaces_init_empty(pool_t pool);
void mail_namespaces_deinit(struct mail_namespace **namespaces);
+/* Update hierarchy separators in given name to real_sep characters. */
const char *mail_namespace_fix_sep(struct mail_namespace *ns, const char *name);
+/* Returns namespace based on the mailbox name's prefix. Updates mailbox to
+ be a valid name inside the namespace (prefix is skipped, hierarchy separator
+ is changed to real_sep). If no namespaces were found, returns NULL. */
struct mail_namespace *
mail_namespace_find(struct mail_namespace *namespaces, const char **mailbox);
+/* Like above, but ignore hidden namespaces. */
struct mail_namespace *
mail_namespace_find_visible(struct mail_namespace *namespaces,
const char **mailbox);
+/* Returns TRUE if the given namespace matches the mailbox's prefix.
+ Updates mailbox name to be a valid name inside the namespace. */
+bool mail_namespace_update_name(struct mail_namespace *ns,
+ const char **mailbox);
+
+/* Find a namespace with given prefix. */
struct mail_namespace *
mail_namespace_find_prefix(struct mail_namespace *namespaces,
const char *prefix);
More information about the dovecot-cvs
mailing list