dovecot-2.0: Added mailbox_backends_equal().

dovecot at dovecot.org dovecot at dovecot.org
Fri Jul 24 22:58:17 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/6b6d6e094674
changeset: 9650:6b6d6e094674
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jul 24 15:56:21 2009 -0400
description:
Added mailbox_backends_equal().

diffstat:

2 files changed, 18 insertions(+), 1 deletion(-)
src/lib-storage/mail-storage.c |   15 +++++++++++++++
src/lib-storage/mail-storage.h |    4 +++-

diffs (41 lines):

diff -r 47356e8dda45 -r 6b6d6e094674 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri Jul 24 14:40:40 2009 -0400
+++ b/src/lib-storage/mail-storage.c	Fri Jul 24 15:56:21 2009 -0400
@@ -580,6 +580,21 @@ bool mailbox_allow_new_keywords(struct m
 	return box->v.allow_new_keywords(box);
 }
 
+bool mailbox_backends_equal(const struct mailbox *box1,
+			    const struct mailbox *box2)
+{
+	struct mail_namespace *ns1 = box1->list->ns, *ns2 = box2->list->ns;
+
+	if (strcmp(box1->name, box2->name) != 0)
+		return FALSE;
+
+	while (ns1->alias_for != NULL)
+		ns1 = ns1->alias_for;
+	while (ns2->alias_for != NULL)
+		ns2 = ns2->alias_for;
+	return ns1 == ns2;
+}
+
 void mailbox_get_status(struct mailbox *box,
 			enum mailbox_status_items items,
 			struct mailbox_status *status_r)
diff -r 47356e8dda45 -r 6b6d6e094674 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Fri Jul 24 14:40:40 2009 -0400
+++ b/src/lib-storage/mail-storage.h	Fri Jul 24 15:56:21 2009 -0400
@@ -357,9 +357,11 @@ const char *mailbox_get_vname(const stru
 
 /* Returns TRUE if mailbox is read-only. */
 bool mailbox_is_readonly(struct mailbox *box);
-
 /* Returns TRUE if mailbox currently supports adding keywords. */
 bool mailbox_allow_new_keywords(struct mailbox *box);
+/* Returns TRUE if two mailboxes point to the same physical mailbox. */
+bool mailbox_backends_equal(const struct mailbox *box1,
+			    const struct mailbox *box2);
 
 /* Gets the mailbox status information. */
 void mailbox_get_status(struct mailbox *box, enum mailbox_status_items items,


More information about the dovecot-cvs mailing list