dovecot-2.2: lib-storage: Added mailbox_is_subscribed()
dovecot at dovecot.org
dovecot at dovecot.org
Tue Sep 4 19:05:57 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/c00df434bfb9
changeset: 15028:c00df434bfb9
user: Timo Sirainen <tss at iki.fi>
date: Tue Sep 04 19:04:52 2012 +0300
description:
lib-storage: Added mailbox_is_subscribed()
diffstat:
src/lib-storage/mail-storage.c | 11 +++++++++++
src/lib-storage/mail-storage.h | 4 ++++
2 files changed, 15 insertions(+), 0 deletions(-)
diffs (42 lines):
diff -r fcd480c4a0db -r c00df434bfb9 src/lib-storage/mail-storage.c
--- 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;
diff -r fcd480c4a0db -r c00df434bfb9 src/lib-storage/mail-storage.h
--- 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);
More information about the dovecot-cvs
mailing list