From 1e8594bb3a42972bfe46a2d5155742f717398dd5 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 30 Mar 2001 02:25:38 +0000 Subject: Don't blindly append "/INBOX", construct a CamelURL and set the path that 2001-03-29 Jeffrey Stedfast * providers/imap/camel-imap-store.c (get_folder_info): Don't blindly append "/INBOX", construct a CamelURL and set the path that way. (parse_list_response_as_folder_info): Don't blindly append "/", construct a CamelURL and set the path that way instead. (get_folders_offline): And again here. svn path=/trunk/; revision=9036 --- camel/ChangeLog | 10 ++++++++ camel/providers/imap/camel-imap-store.c | 41 +++++++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 7 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 2a31b36b9b..1b0ea88d07 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,13 @@ +2001-03-29 Jeffrey Stedfast + + * providers/imap/camel-imap-store.c (get_folder_info): Don't + blindly append "/INBOX", construct a CamelURL and set the path + that way. + (parse_list_response_as_folder_info): Don't blindly append + "/", construct a CamelURL and set the path that way + instead. + (get_folders_offline): And again here. + 2001-03-30 Not Zed * camel-service.c (camel_get_host_byname): Dont overwrite an diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 40b603acfc..1de6049180 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -885,7 +885,9 @@ static char * imap_concat (CamelImapStore *imap_store, const char *prefix, const char *suffix) { int len; - + + g_warning ("in imap_concat(): prefix=%s; suffix=%s.", prefix, suffix); + len = strlen (prefix); if (len == 0 || prefix[len - 1] == imap_store->dir_sep) return g_strdup_printf ("%s%s", prefix, suffix); @@ -944,8 +946,15 @@ parse_list_response_as_folder_info (CamelImapStore *imap_store, fi->name = g_strdup (name); else fi->name = g_strdup (dir); - if (!(flags & IMAP_LIST_FLAG_NOSELECT)) - fi->url = g_strdup_printf ("%s/%s", imap_store->base_url, dir); + if (!(flags & IMAP_LIST_FLAG_NOSELECT)) { + CamelURL *url; + + url = camel_url_new (imap_store->base_url, NULL); + g_free (url->path); + url->path = g_strdup_printf ("/%s", dir); + fi->url = camel_url_to_string (url, 0); + camel_url_free (url); + } if (!(flags & IMAP_LIST_FLAG_UNMARKED)) fi->unread_message_count = -1; @@ -1068,11 +1077,15 @@ get_folders_offline (CamelImapStore *imap_store, GPtrArray *folders, CamelException *ex) { CamelFolderInfo *fi; + CamelURL *url; int i; i = folders->len; g_hash_table_foreach (imap_store->subscribed_folders, add_folder, folders); + + url = camel_url_new (imap_store->base_url, NULL); + while (i < folders->len) { fi = g_new0 (CamelFolderInfo, 1); fi->full_name = g_strdup (folders->pdata[i]); @@ -1081,11 +1094,16 @@ get_folders_offline (CamelImapStore *imap_store, GPtrArray *folders, fi->name = g_strdup (fi->name + 1); else fi->name = g_strdup (fi->full_name); - fi->url = g_strdup_printf ("%s/%s", imap_store->base_url, - fi->full_name); + + g_free (url->path); + url->path = g_strdup_printf ("/%s", fi->full_name); + fi->url = camel_url_to_string (url, 0); + fi->unread_message_count = -1; folders->pdata[i++] = fi; } + + camel_url_free (url); } static void @@ -1174,12 +1192,21 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast, } } if (need_inbox) { + CamelURL *url; + char *uri; + + url = camel_url_new (imap_store->base_url, NULL); + g_free (url->path); + url->path = g_strdup ("/INBOX"); + uri = camel_url_to_string (url, 0); + camel_url_free (url); + fi = g_new0 (CamelFolderInfo, 1); fi->full_name = g_strdup ("INBOX"); fi->name = g_strdup ("INBOX"); - fi->url = g_strdup_printf ("%s/INBOX", imap_store->base_url); + fi->url = uri; fi->unread_message_count = -1; - + g_ptr_array_add (folders, fi); } -- cgit v1.2.3