]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
CREATE mailbox/ with maildir now creates the mailbox instead of ignoring it.
authorTimo Sirainen <tss@iki.fi>
Mon, 15 Sep 2003 17:38:36 +0000 (20:38 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 15 Sep 2003 17:38:36 +0000 (20:38 +0300)
--HG--
branch : HEAD

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

index 449b98261c61cf84985d59d8414dd5e60c44bbac..82f3a62779c68c06bfdfa642a6b38309c320735b 100644 (file)
@@ -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;
 
        /* <mailbox> */
@@ -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;
        }
index 5ab8f0e722a0b9800e29153028367e3d49d4ed3e..88bac8ee1ea6f78aacb46195165b9a8ea807bcf4 100644 (file)
@@ -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) {
index 6a3f47bb866ec04614097dc26501e220775c214a..80dfe93d0ab2b067b547acd1c06a65a86cebf601 100644 (file)
@@ -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;
                }
index 605c4c85de38c7043c81af2e425658c7de4b1019..95c07d4750d6c4b4c5c9e31f04b7670ca2f0b625 100644 (file)
@@ -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. */