]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Implemented mailbox_is_autosubscribed().
authorStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 19 Sep 2017 19:08:38 +0000 (21:08 +0200)
committerTimo Sirainen <tss@dovecot.fi>
Wed, 4 Oct 2017 22:07:46 +0000 (01:07 +0300)
Indicates whether the mailbox is automatically subscribed to when it is automatically created.

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

index 9c9e9161c3c06ef9bf7d7f84cb3e0c6f81513dd1..78e307f18ca39f9d9603c136b5579cefaa10e9dc 100644 (file)
@@ -779,6 +779,8 @@ int mailbox_create_missing_dir(struct mailbox *box,
                               enum mailbox_list_path_type type);
 /* Returns TRUE if mailbox is autocreated. */
 bool mailbox_is_autocreated(struct mailbox *box);
+/* Returns TRUE if mailbox is autosubscribed. */
+bool mailbox_is_autosubscribed(struct mailbox *box);
 
 /* Returns -1 if error, 0 if failed with EEXIST, 1 if ok */
 int mailbox_create_fd(struct mailbox *box, const char *path, int flags,
index c6306e578abfccb3bfbf790725824c9c81bed144..43d52b598516da5fb0053cf59269f1c6602c9e4c 100644 (file)
@@ -884,6 +884,12 @@ bool mailbox_is_autocreated(struct mailbox *box)
                strcmp(box->set->autocreate, MAILBOX_SET_AUTO_NO) != 0;
 }
 
+bool mailbox_is_autosubscribed(struct mailbox *box)
+{
+       return box->set != NULL &&
+               strcmp(box->set->autocreate, MAILBOX_SET_AUTO_SUBSCRIBE) == 0;
+}
+
 static int mailbox_autocreate(struct mailbox *box)
 {
        const char *errstr;
@@ -897,9 +903,7 @@ static int mailbox_autocreate(struct mailbox *box)
                                box->vname, errstr);
                        return -1;
                }
-       } else if (box->set != NULL &&
-                  strcmp(box->set->autocreate,
-                         MAILBOX_SET_AUTO_SUBSCRIBE) == 0) {
+       } else if (mailbox_is_autosubscribed(box)) {
                if (mailbox_set_subscribed(box, TRUE) < 0) {
                        mail_storage_set_critical(box->storage,
                                "Failed to autosubscribe to mailbox %s: %s",