Mercurial > dovecot > core-2.2
changeset 15028:c00df434bfb9
lib-storage: Added mailbox_is_subscribed()
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 04 Sep 2012 19:04:52 +0300 |
parents | fcd480c4a0db |
children | 13e7c1e30c0e |
files | src/lib-storage/mail-storage.c src/lib-storage/mail-storage.h |
diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage.c Tue Sep 04 18:51:43 2012 +0300 +++ b/src/lib-storage/mail-storage.c Tue Sep 04 19:04:52 2012 +0300 @@ -12,6 +12,7 @@ #include "var-expand.h" #include "mail-index-private.h" #include "mail-index-alloc-cache.h" +#include "mailbox-tree.h" #include "mailbox-list-private.h" #include "mail-storage-private.h" #include "mail-storage-settings.h" @@ -1251,6 +1252,16 @@ return box->v.set_subscribed(box, set); } +bool mailbox_is_subscribed(struct mailbox *box) +{ + struct mailbox_node *node; + + i_assert(box->list->subscriptions != NULL); + + node = mailbox_tree_lookup(box->list->subscriptions, box->vname); + return node != NULL && (node->flags & MAILBOX_SUBSCRIBED) != 0; +} + struct mail_storage *mailbox_get_storage(const struct mailbox *box) { return box->storage;
--- a/src/lib-storage/mail-storage.h Tue Sep 04 18:51:43 2012 +0300 +++ b/src/lib-storage/mail-storage.h Tue Sep 04 19:04:52 2012 +0300 @@ -447,6 +447,10 @@ /* Subscribe/unsubscribe mailbox. Subscribing to nonexistent mailboxes is optional. */ int mailbox_set_subscribed(struct mailbox *box, bool set); +/* Returns TRUE if mailbox is subscribed, FALSE if not. This function + doesn't refresh the subscriptions list, but assumes that it's been done by + e.g. mailbox_list_iter*(). */ +bool mailbox_is_subscribed(struct mailbox *box); /* Enable the given feature for the mailbox. */ int mailbox_enable(struct mailbox *box, enum mailbox_feature features);