From 4e718e9066fd3db7796c8f656d7b54f35e0268b7 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 29 Aug 2012 17:51:58 +0200 Subject: Could not create folders in Yahoo! account using imapx --- camel/camel-imapx-server.c | 5 ++++- camel/camel-imapx-store.c | 17 +++++++++-------- camel/camel-imapx-utils.c | 8 ++++++-- 3 files changed, 19 insertions(+), 11 deletions(-) (limited to 'camel') diff --git a/camel/camel-imapx-server.c b/camel/camel-imapx-server.c index 07022535e..6a8fd4f19 100644 --- a/camel/camel-imapx-server.c +++ b/camel/camel-imapx-server.c @@ -1381,8 +1381,11 @@ imapx_untagged_namespace (CamelIMAPXServer *is, /* TODO Need to remove imapx_store->dir_sep to support multiple namespaces */ ns = nsl->personal; - if (ns) + if (ns) { imapx_store->dir_sep = ns->sep; + if (!imapx_store->dir_sep) + imapx_store->dir_sep = '/'; + } return TRUE; } diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c index 061eb320f..88b340a25 100644 --- a/camel/camel-imapx-store.c +++ b/camel/camel-imapx-store.c @@ -319,6 +319,7 @@ get_folder_offline (CamelStore *store, if (si) { gchar *folder_dir, *storage_path; + storage_path = g_build_filename (user_cache_dir, "folders", NULL); /* Note: Although the INBOX is defined to be case-insensitive in the IMAP RFC * it is still up to the server how to acutally name it in a LIST response. Since * we stored the name as the server provided it us in the summary we take that name @@ -326,13 +327,10 @@ get_folder_offline (CamelStore *store, * But for the on-disk cache we do always capitalize the Inbox no matter what the * server provided. */ - if (!g_ascii_strcasecmp (folder_name, "INBOX")) - folder_name = "INBOX"; - - storage_path = g_build_filename (user_cache_dir, "folders", NULL); - folder_dir = imapx_path_to_physical (storage_path, folder_name); + folder_dir = imapx_path_to_physical (storage_path, + g_ascii_strcasecmp (folder_name, "INBOX") == 0 ? "INBOX" : folder_name); g_free (storage_path); - /* FIXME */ + new_folder = camel_imapx_folder_new (store, folder_dir, folder_name, error); g_free (folder_dir); @@ -462,6 +460,8 @@ imapx_match_pattern (CamelIMAPXStoreNamespace *ns, return TRUE; dir_sep = ns->sep; + if (!dir_sep) + dir_sep = '/'; p = *pattern++; n = *name++; while (n && p) { @@ -1373,7 +1373,7 @@ imapx_store_create_folder_sync (CamelStore *store, CamelIMAPXServer *server; gchar *real_name, *full_name, *parent_real; CamelFolderInfo *fi = NULL; - gchar dir_sep; + gchar dir_sep = 0; gboolean success; if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store))) { @@ -1394,7 +1394,8 @@ imapx_store_create_folder_sync (CamelStore *store, ns = camel_imapx_store_summary_namespace_find_path (istore->summary, parent_name); if (ns) dir_sep = ns->sep; - else + + if (!dir_sep) dir_sep = '/'; if (strchr (folder_name, dir_sep)) { diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c index ec56289d1..a1e2782b3 100644 --- a/camel/camel-imapx-utils.c +++ b/camel/camel-imapx-utils.c @@ -2129,12 +2129,16 @@ imapx_concat (CamelIMAPXStore *imapx_store, const gchar *suffix) { gsize len; + gchar dir_sep = imapx_store->dir_sep; + + if (!dir_sep) + dir_sep = '/'; len = strlen (prefix); - if (len == 0 || prefix[len - 1] == imapx_store->dir_sep) + if (len == 0 || prefix[len - 1] == dir_sep) return g_strdup_printf ("%s%s", prefix, suffix); else - return g_strdup_printf ("%s%c%s", prefix, imapx_store->dir_sep, suffix); + return g_strdup_printf ("%s%c%s", prefix, dir_sep, suffix); } static void -- cgit v1.2.1