From: Timo Sirainen Date: Mon, 15 Sep 2003 17:38:36 +0000 (+0300) Subject: CREATE mailbox/ with maildir now creates the mailbox instead of ignoring it. X-Git-Tag: 1.1.alpha1~4331 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00bb3f3db48a9e80a633a7c4d3d768b8ff1a72c5;p=thirdparty%2Fdovecot%2Fcore.git CREATE mailbox/ with maildir now creates the mailbox instead of ignoring it. --HG-- branch : HEAD --- diff --git a/src/imap/cmd-create.c b/src/imap/cmd-create.c index 449b98261c..82f3a62779 100644 --- a/src/imap/cmd-create.c +++ b/src/imap/cmd-create.c @@ -7,7 +7,7 @@ int cmd_create(struct client *client) { struct mail_storage *storage; const char *mailbox; - int only_hiearchy; + int directory; size_t len; /* */ @@ -20,19 +20,19 @@ int cmd_create(struct client *client) len = strlen(mailbox); if (mailbox[len-1] != storage->hierarchy_sep) - only_hiearchy = FALSE; + directory = FALSE; else { /* name ends with hierarchy separator - client is just - informing us that it wants to create a mailbox under - this name. */ - only_hiearchy = TRUE; + informing us that it wants to create children under this + mailbox. */ + directory = TRUE; mailbox = t_strndup(mailbox, len-1); } if (!client_verify_mailbox_name(client, mailbox, FALSE, TRUE)) return TRUE; - if (!storage->create_mailbox(storage, mailbox, only_hiearchy)) { + if (!storage->create_mailbox(storage, mailbox, directory)) { client_send_storage_error(client, storage); return TRUE; } diff --git a/src/lib-storage/index/maildir/maildir-storage.c b/src/lib-storage/index/maildir/maildir-storage.c index 5ab8f0e722..88bac8ee1e 100644 --- a/src/lib-storage/index/maildir/maildir-storage.c +++ b/src/lib-storage/index/maildir/maildir-storage.c @@ -452,7 +452,8 @@ maildir_open_mailbox(struct mail_storage *storage, } static int maildir_create_mailbox(struct mail_storage *storage, - const char *name, int only_hierarchy) + const char *name, + int directory __attr_unused__) { const char *path; @@ -464,11 +465,6 @@ static int maildir_create_mailbox(struct mail_storage *storage, return FALSE; } - if (only_hierarchy) { - /* no need to do anything */ - return TRUE; - } - path = maildir_get_path(storage, name); if (!create_maildir(storage, path, FALSE)) { if (errno == EEXIST) { diff --git a/src/lib-storage/index/mbox/mbox-storage.c b/src/lib-storage/index/mbox/mbox-storage.c index 6a3f47bb86..80dfe93d0a 100644 --- a/src/lib-storage/index/mbox/mbox-storage.c +++ b/src/lib-storage/index/mbox/mbox-storage.c @@ -455,7 +455,7 @@ mbox_open_mailbox(struct mail_storage *storage, } static int mbox_create_mailbox(struct mail_storage *storage, const char *name, - int only_hierarchy) + int directory) { const char *path, *p; struct stat st; @@ -489,7 +489,7 @@ static int mbox_create_mailbox(struct mail_storage *storage, const char *name, } /* create the hierarchy if needed */ - p = only_hierarchy ? path + strlen(path) : strrchr(path, '/'); + p = directory ? path + strlen(path) : strrchr(path, '/'); if (p != NULL) { p = t_strdup_until(path, p); if (mkdir_parents(p, CREATE_MODE) < 0) { @@ -501,7 +501,7 @@ static int mbox_create_mailbox(struct mail_storage *storage, const char *name, return FALSE; } - if (only_hierarchy) { + if (directory) { /* wanted to create only the directory */ return TRUE; } diff --git a/src/lib-storage/mail-storage.h b/src/lib-storage/mail-storage.h index 605c4c85de..95c07d4750 100644 --- a/src/lib-storage/mail-storage.h +++ b/src/lib-storage/mail-storage.h @@ -154,10 +154,11 @@ struct mail_storage { enum mailbox_open_flags flags); /* name is allowed to contain multiple new hierarchy levels. - If only_hierarchy is TRUE, the mailbox itself isn't created, just - the hierarchy structure (if needed). */ + If directory is TRUE, the mailbox should be created so that it + can contain children. The mailbox itself doesn't have to be + created as long as it shows in LIST. */ int (*create_mailbox)(struct mail_storage *storage, const char *name, - int only_hierarchy); + int directory); /* Only the specified mailbox is deleted, ie. folders under the specified mailbox must not be deleted. */