]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
deliver: Moved mailbox autocreate/autosubscribe settings to struct deliver_settings.
authorTimo Sirainen <tss@iki.fi>
Mon, 29 Sep 2008 09:43:09 +0000 (12:43 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 29 Sep 2008 09:43:09 +0000 (12:43 +0300)
--HG--
branch : HEAD

src/deliver/deliver.c
src/deliver/deliver.h

index 6c9f413219d5a70acce817bd62c4e1bf2f701d17..cc399bc4264642a650b51f3639b134ac169b5730 100644 (file)
@@ -60,8 +60,6 @@ deliver_mail_func_t *deliver_mail = NULL;
 static const char *default_mailbox_name = NULL;
 static bool saved_mail = FALSE;
 static bool tried_default_save = FALSE;
-static bool no_mailbox_autocreate = FALSE;
-static bool mailbox_autosubscribe = FALSE;
 static char *explicit_envelope_sender = NULL;
 
 static struct module *modules;
@@ -166,7 +164,7 @@ mailbox_open_or_create_synced(struct mail_namespace *namespaces,
 
        box = mailbox_open(ns->storage, name, NULL, MAILBOX_OPEN_FAST |
                           MAILBOX_OPEN_KEEP_RECENT);
-       if (box != NULL || no_mailbox_autocreate)
+       if (box != NULL || !deliver_set->mailbox_autocreate)
                return box;
 
        (void)mail_storage_get_last_error(ns->storage, &error);
@@ -176,7 +174,7 @@ mailbox_open_or_create_synced(struct mail_namespace *namespaces,
        /* try creating it. */
        if (mail_storage_mailbox_create(ns->storage, name, FALSE) < 0)
                return NULL;
-       if (mailbox_autosubscribe) {
+       if (deliver_set->mailbox_autosubscribe) {
                /* (try to) subscribe to it */
                (void)mailbox_list_set_subscribed(ns->list, name, TRUE);
        }
@@ -822,6 +820,9 @@ int main(int argc, char *argv[])
         lib_signals_ignore(SIGXFSZ, TRUE);
 #endif
 
+       deliver_set = i_new(struct deliver_settings, 1);
+       deliver_set->mailbox_autocreate = TRUE;
+
        destaddr = user = path = NULL;
        for (i = 1; i < argc; i++) {
                if (strcmp(argv[i], "-a") == 0) {
@@ -865,9 +866,9 @@ int main(int argc, char *argv[])
                        if (*argv[i] != '\0')
                                mailbox = argv[i];
                } else if (strcmp(argv[i], "-n") == 0) {
-                       no_mailbox_autocreate = TRUE;
+                       deliver_set->mailbox_autocreate = FALSE;
                } else if (strcmp(argv[i], "-s") == 0) {
-                       mailbox_autosubscribe = TRUE;
+                       deliver_set->mailbox_autosubscribe = TRUE;
                } else if (strcmp(argv[i], "-f") == 0) {
                        /* envelope sender address */
                        i++;
@@ -988,7 +989,6 @@ int main(int argc, char *argv[])
                i = 0077;
        (void)umask(i);
 
-       deliver_set = i_new(struct deliver_settings, 1);
        deliver_set->hostname = getenv("HOSTNAME");
        if (deliver_set->hostname == NULL)
                deliver_set->hostname = my_hostname;
index 5130f9bb332576d22e8597bda68fd3f443702f96..143e71831c0dbd8cde07b3183cc11f7fe68d1b03 100644 (file)
@@ -20,6 +20,8 @@ struct deliver_settings {
        const char *sendmail_path;
        const char *rejection_reason;
        const char *log_format;
+       bool mailbox_autosubscribe;
+       bool mailbox_autocreate;
 };
 
 extern struct deliver_settings *deliver_set;