From 7f30996e2851a6ecdd54ae4d6e7840d46b1b0e34 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 16 Oct 2000 18:10:42 +0000 Subject: [PATCH] Deal with the possibility of not getting a LIST response back for the top * providers/imap/camel-imap-store.c (get_folder_info): Deal with the possibility of not getting a LIST response back for the top level. --- camel/ChangeLog | 6 ++++++ camel/providers/imap/camel-imap-store.c | 26 ++++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 15d9a4e..d2e8bc5 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2000-10-16 Dan Winship + + * providers/imap/camel-imap-store.c (get_folder_info): Deal with + the possibility of not getting a LIST response back for the top + level. + 2000-10-12 Dan Winship * providers/imap/camel-imap-summary.c: Simple subclass of diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 1042160..a561cab 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -520,7 +520,7 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast, CamelImapResponse *response; GPtrArray *folders; char *dir_sep, *namespace, *base_url, *list; - CamelFolderInfo *topfi, *fi; + CamelFolderInfo *topfi = NULL, *fi; if (!top) top = ""; @@ -542,19 +542,21 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast, response = camel_imap_command (imap_store, NULL, ex, "LIST \"\" \"%s\"", namespace); - if (!response) { - g_free (namespace); - g_free (base_url); - return NULL; + if (response) { + list = camel_imap_response_extract (response, "LIST", ex); + if (list) { + topfi = parse_list_response_as_folder_info (list, + namespace, + base_url); + g_free (list); + } } - list = camel_imap_response_extract (response, "LIST", ex); - if (!list) { - g_free (namespace); - g_free (base_url); - return NULL; + if (!topfi) { + camel_exception_clear (ex); + topfi = g_new0 (CamelFolderInfo, 1); + fi->full_name = g_strdup (namespace); + fi->name = g_strdup (namespace); } - topfi = parse_list_response_as_folder_info (list, namespace, base_url); - g_free (list); response = camel_imap_command (imap_store, NULL, ex, "LIST \"\" \"%s%s%c\"", -- 2.7.4