dovecot-1.2: deliver: Moved mailbox autocreate/autosubscribe set...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Sep 29 12:43:13 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/8e5c93f37e48
changeset: 8220:8e5c93f37e48
user: Timo Sirainen <tss at iki.fi>
date: Mon Sep 29 12:43:09 2008 +0300
description:
deliver: Moved mailbox autocreate/autosubscribe settings to struct deliver_settings.
diffstat:
2 files changed, 9 insertions(+), 7 deletions(-)
src/deliver/deliver.c | 14 +++++++-------
src/deliver/deliver.h | 2 ++
diffs (72 lines):
diff -r ec83f6dcb585 -r 8e5c93f37e48 src/deliver/deliver.c
--- 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
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 mai
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 mai
/* 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;
diff -r ec83f6dcb585 -r 8e5c93f37e48 src/deliver/deliver.h
--- 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 @@ 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;
More information about the dovecot-cvs
mailing list