dovecot-1.1: deliver: Added -s parameter to autosubscribe to aut...

dovecot at dovecot.org dovecot at dovecot.org
Sat Aug 30 13:32:12 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/1820f139660f
changeset: 7845:1820f139660f
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Aug 30 13:32:08 2008 +0300
description:
deliver: Added -s parameter to autosubscribe to autocreated mailboxes.

diffstat:

1 file changed, 8 insertions(+), 2 deletions(-)
src/deliver/deliver.c |   10 ++++++++--

diffs (42 lines):

diff -r f690d84a9fcb -r 1820f139660f src/deliver/deliver.c
--- a/src/deliver/deliver.c	Sat Aug 30 13:21:35 2008 +0300
+++ b/src/deliver/deliver.c	Sat Aug 30 13:32:08 2008 +0300
@@ -61,6 +61,7 @@ static bool saved_mail = FALSE;
 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;
@@ -175,6 +176,10 @@ 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) {
+		/* (try to) subscribe to it */
+		(void)mailbox_list_set_subscribed(ns->list, name, TRUE);
+	}
 
 	/* and try opening again */
 	box = mailbox_open(ns->storage, name, NULL, MAILBOX_OPEN_FAST |
@@ -694,7 +699,7 @@ static void print_help(void)
 {
 	printf(
 "Usage: deliver [-c <config file>] [-a <address>] [-d <username>] [-p <path>]\n"
-"               [-f <envelope sender>] [-m <mailbox>] [-n] [-e] [-k]\n");
+"               [-f <envelope sender>] [-m <mailbox>] [-n] [-s] [-e] [-k]\n");
 }
 
 void deliver_env_clean(void)
@@ -860,8 +865,9 @@ int main(int argc, char *argv[])
 			if (*argv[i] != '\0')
 				mailbox = argv[i];
 		} else if (strcmp(argv[i], "-n") == 0) {
-			/* destination mailbox */
 			no_mailbox_autocreate = TRUE;
+		} else if (strcmp(argv[i], "-s") == 0) {
+			mailbox_autosubscribe = TRUE;
 		} else if (strcmp(argv[i], "-f") == 0) {
 			/* envelope sender address */
 			i++;


More information about the dovecot-cvs mailing list