changeset 9237:72f159e0aaa6 HEAD

Added mailbox_backends_equal().
author Timo Sirainen <tss@iki.fi>
date Fri, 24 Jul 2009 16:02:03 -0400
parents a878a0897eb9
children 1eb00fd62d1c
files src/lib-storage/mail-storage.c src/lib-storage/mail-storage.h
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.c	Tue Jul 21 17:14:41 2009 -0400
+++ b/src/lib-storage/mail-storage.c	Fri Jul 24 16:02:03 2009 -0400
@@ -529,6 +529,22 @@
 	return box->v.allow_new_keywords(box);
 }
 
+bool mailbox_backends_equal(const struct mailbox *box1,
+			    const struct mailbox *box2)
+{
+	struct mail_namespace *ns1 = box1->storage->ns;
+	struct mail_namespace *ns2 = box2->storage->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)
--- a/src/lib-storage/mail-storage.h	Tue Jul 21 17:14:41 2009 -0400
+++ b/src/lib-storage/mail-storage.h	Fri Jul 24 16:02:03 2009 -0400
@@ -349,9 +349,11 @@
 
 /* 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,