]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added mailbox_backends_equal().
authorTimo Sirainen <tss@iki.fi>
Fri, 24 Jul 2009 19:56:21 +0000 (15:56 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 24 Jul 2009 19:56:21 +0000 (15:56 -0400)
--HG--
branch : HEAD

src/lib-storage/mail-storage.c
src/lib-storage/mail-storage.h

index 07958eebc4d82bbb27e4ac2fe289aa5d9e7dfd2d..dfac3a7d0ade1e5be6f3eddb850e6796c7c43a6f 100644 (file)
@@ -580,6 +580,21 @@ bool mailbox_allow_new_keywords(struct mailbox *box)
        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)
index ce85c89147c27d84f5f984b42f26c7952ad359e3..3fecc12a57a9f088f01dc58c52ba6d507494c9e5 100644 (file)
@@ -357,9 +357,11 @@ const char *mailbox_get_vname(const struct mailbox *box) ATTR_PURE;
 
 /* 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,