Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8220:8e5c93f37e48 HEAD
deliver: Moved mailbox autocreate/autosubscribe settings to struct deliver_settings.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 29 Sep 2008 12:43:09 +0300 |
parents | ec83f6dcb585 |
children | f6ef01a25db9 |
files | src/deliver/deliver.c src/deliver/deliver.h |
diffstat | 2 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/deliver/deliver.c Sat Sep 27 12:20:26 2008 +0300 +++ b/src/deliver/deliver.c Mon Sep 29 12:43:09 2008 +0300 @@ -60,8 +60,6 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ 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 @@ 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;
--- a/src/deliver/deliver.h Sat Sep 27 12:20:26 2008 +0300 +++ b/src/deliver/deliver.h Mon Sep 29 12:43:09 2008 +0300 @@ -20,6 +20,8 @@ const char *sendmail_path; const char *rejection_reason; const char *log_format; + bool mailbox_autosubscribe; + bool mailbox_autocreate; }; extern struct deliver_settings *deliver_set;