aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c23
-rw-r--r--camel/providers/imap/camel-imap-utils.c10
2 files changed, 23 insertions, 10 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;
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index f1c4c17782..3378758a69 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -94,9 +94,13 @@ imap_parse_list_response (char *buf, char *namespace, char **flags, char **sep,
/* get the directory separator */
word = imap_next_word (ep);
if (*word) {
- for (ep = word; *ep && *ep != ' '; ep++);
- *sep = g_strndup (word, (gint)(ep - word));
- string_unquote (*sep);
+ if (!strncmp (word, "NIL", 3)) {
+ *sep = NULL;
+ } else {
+ for (ep = word; *ep && *ep != ' '; ep++);
+ *sep = g_strndup (word, (gint)(ep - word));
+ string_unquote (*sep);
+ }
} else {
return FALSE;
}