dovecot-2.1: lib-storage: Added mail_namespace_find_unalias()
dovecot at dovecot.org
dovecot at dovecot.org
Fri Sep 16 12:40:31 EEST 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/ff6272a52f0d
changeset: 13465:ff6272a52f0d
user: Timo Sirainen <tss at iki.fi>
date: Fri Sep 16 12:39:19 2011 +0300
description:
lib-storage: Added mail_namespace_find_unalias()
diffstat:
src/lib-storage/mail-namespace.c | 17 +++++++++++++++++
src/lib-storage/mail-namespace.h | 6 ++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diffs (43 lines):
diff -r 61d3544f8fdf -r ff6272a52f0d src/lib-storage/mail-namespace.c
--- a/src/lib-storage/mail-namespace.c Thu Sep 15 23:39:33 2011 +0300
+++ b/src/lib-storage/mail-namespace.c Fri Sep 16 12:39:19 2011 +0300
@@ -581,6 +581,23 @@
}
struct mail_namespace *
+mail_namespace_find_unalias(struct mail_namespace *namespaces,
+ const char **mailbox)
+{
+ struct mail_namespace *ns;
+ const char *storage_name;
+
+ ns = mail_namespace_find(namespaces, *mailbox);
+ if (ns->alias_for != NULL) {
+ storage_name =
+ mailbox_list_get_storage_name(ns->list, *mailbox);
+ ns = ns->alias_for;
+ *mailbox = mailbox_list_get_vname(ns->list, storage_name);
+ }
+ return ns;
+}
+
+struct mail_namespace *
mail_namespace_find_visible(struct mail_namespace *namespaces,
const char *mailbox)
{
diff -r 61d3544f8fdf -r ff6272a52f0d src/lib-storage/mail-namespace.h
--- a/src/lib-storage/mail-namespace.h Thu Sep 15 23:39:33 2011 +0300
+++ b/src/lib-storage/mail-namespace.h Fri Sep 16 12:39:19 2011 +0300
@@ -108,6 +108,12 @@
namespace could be found. */
struct mail_namespace *
mail_namespace_find(struct mail_namespace *namespaces, const char *mailbox);
+/* Find namespace for mailbox and return it. If the namespace has alias_for
+ set, return that namespace instead and change mailbox name to be a valid
+ inside it. */
+struct mail_namespace *
+mail_namespace_find_unalias(struct mail_namespace *namespaces,
+ const char **mailbox);
/* Like above, but ignore hidden namespaces. */
struct mail_namespace *
mail_namespace_find_visible(struct mail_namespace *namespaces,
More information about the dovecot-cvs
mailing list