aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-folder.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/imap/camel-imap-folder.c')
-rw-r--r--camel/providers/imap/camel-imap-folder.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index ca99da671c..82d133b0ab 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -734,6 +734,7 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
CamelStore *store = CAMEL_STORE (folder->parent_store);
CamelURL *url = CAMEL_SERVICE (store)->url;
GPtrArray *listing;
+ gboolean found_inbox = FALSE;
gint status;
gchar *result, *namespace, *dir_sep;
@@ -776,17 +777,17 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
char *ptr = result;
while (ptr && *ptr == '*') {
- gchar *flags, *sep, *folder, *buf, *end;
+ gchar *flags, *sep, *dir, *buf, *end;
for (end = ptr; *end && *end != '\n'; end++);
buf = g_strndup (ptr, (gint)(end - ptr));
ptr = end;
- if (!imap_parse_list_response (buf, namespace, &flags, &sep, &folder)) {
+ if (!imap_parse_list_response (buf, namespace, &flags, &sep, &dir)) {
g_free (buf);
g_free (flags);
g_free (sep);
- g_free (folder);
+ g_free (dir);
if (*ptr == '\n')
ptr++;
@@ -797,9 +798,12 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
g_free (buf);
g_free (flags);
- d(fprintf (stderr, "adding folder: %s\n", folder));
-
- g_ptr_array_add (listing, folder);
+ if (*dir) {
+ d(fprintf (stderr, "adding folder: %s\n", dir));
+ if (!strcmp (dir, "INBOX"))
+ found_inbox = TRUE;
+ g_ptr_array_add (listing, dir);
+ }
g_free (sep);
@@ -807,9 +811,14 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
ptr++;
}
}
+
+ if (!strcmp (folder->name, namespace) && !found_inbox) {
+ g_ptr_array_add (listing, "INBOX");
+ }
+
g_free (result);
g_free (namespace);
-
+
imap_folder->lsub = listing;
return listing;