Mercurial > dovecot > core-2.2
changeset 1775:99cf3e9393a6 HEAD
CREATE mailbox/ with maildir now creates the mailbox instead of ignoring it.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 15 Sep 2003 20:38:36 +0300 |
parents | 57bd9be0ecff |
children | 850bf9389a73 |
files | src/imap/cmd-create.c src/lib-storage/index/maildir/maildir-storage.c src/lib-storage/index/mbox/mbox-storage.c src/lib-storage/mail-storage.h |
diffstat | 4 files changed, 15 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-create.c Mon Sep 15 17:13:47 2003 +0300 +++ b/src/imap/cmd-create.c Mon Sep 15 20:38:36 2003 +0300 @@ -7,7 +7,7 @@ { struct mail_storage *storage; const char *mailbox; - int only_hiearchy; + int directory; size_t len; /* <mailbox> */ @@ -20,19 +20,19 @@ 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; }
--- a/src/lib-storage/index/maildir/maildir-storage.c Mon Sep 15 17:13:47 2003 +0300 +++ b/src/lib-storage/index/maildir/maildir-storage.c Mon Sep 15 20:38:36 2003 +0300 @@ -452,7 +452,8 @@ } 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 @@ 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) {
--- a/src/lib-storage/index/mbox/mbox-storage.c Mon Sep 15 17:13:47 2003 +0300 +++ b/src/lib-storage/index/mbox/mbox-storage.c Mon Sep 15 20:38:36 2003 +0300 @@ -455,7 +455,7 @@ } 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 @@ } /* 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 @@ return FALSE; } - if (only_hierarchy) { + if (directory) { /* wanted to create only the directory */ return TRUE; }
--- a/src/lib-storage/mail-storage.h Mon Sep 15 17:13:47 2003 +0300 +++ b/src/lib-storage/mail-storage.h Mon Sep 15 20:38:36 2003 +0300 @@ -154,10 +154,11 @@ 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. */