diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-08-20 15:30:25 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-08-20 15:30:25 +0800 |
commit | 3d36457b2cd4b52492f58e16914ca75d7932a46e (patch) | |
tree | f815041010f5e9a8e106cb9e5d36d52663854ba9 /camel/providers/imap/camel-imap-store.c | |
parent | 41dcb0c01b44af388aa51a200d411ea4fe2eeb83 (diff) | |
download | gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.gz gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.bz2 gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.lz gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.xz gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.zst gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.zip |
Get the entire directory structure for the folder we just created, meaning
2001-08-20 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-store.c (create_folder): Get the
entire directory structure for the folder we just created, meaning
if we created a folder named "test.mailbox" where test didn't
previously exist, get the listing for "test" and "test.mailbox".
* providers/imap/camel-imap-utils.c (imap_parse_folder_name): New function.
svn path=/trunk/; revision=12258
Diffstat (limited to 'camel/providers/imap/camel-imap-store.c')
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index cde667d9cc..fbdc092dc8 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -992,10 +992,11 @@ create_folder (CamelStore *store, const char *parent_name, const char *folder_name, CamelException *ex) { CamelImapStore *imap_store = CAMEL_IMAP_STORE (store); - CamelImapResponse *response; - CamelFolderInfo *fi; char *full_name, *resp, *thisone; + CamelImapResponse *response; + CamelFolderInfo *root, *fi; gboolean need_convert; + char **pathnames; int i, flags; if (!camel_disco_store_check_online (CAMEL_DISCO_STORE (store), ex)) @@ -1063,14 +1064,37 @@ create_folder (CamelStore *store, const char *parent_name, full_name = imap_concat (imap_store, parent_name, folder_name); response = camel_imap_command (imap_store, NULL, ex, "CREATE %F", full_name); + g_free (full_name); + if (response) { + CamelFolderInfo *parent; + camel_imap_response_free (imap_store, response); - fi = get_folder_info_online (store, full_name, 0, ex); + + /* We have to do this in case we are creating a + recursive directory structure */ + pathnames = imap_parse_folder_name (imap_store, folder_name); + full_name = imap_concat (imap_store, parent_name, pathnames[0]); + g_free (pathnames); + parent = root = get_folder_info_online (store, full_name, 0, ex); + g_free (full_name); + for (i = 1; parent && pathnames[i]; i++) { + full_name = imap_concat (imap_store, parent_name, pathnames[i]); + g_free (pathnames); + fi = get_folder_info_online (store, full_name, 0, ex); + g_free (full_name); + + if (!fi) + break; + + fi->parent = parent; + parent->child = fi; + parent = fi; + } } else - fi = NULL; + root = NULL; - g_free (full_name); - return fi; + return root; } static CamelFolderInfo * |