diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-09-14 09:04:19 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2007-09-14 09:04:19 +0000 |
commit | 186e216d1ced120e31c7cde45995827499fc728e (patch) | |
tree | 184d8470e8f5ced0612bed2b4c213e7487956fc7 /libsylph | |
parent | ab880a9066b4f32d08ba99903d09a4a5675dd214 (diff) |
check for noinferior and noselect flags when creating a new imap folder.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1901 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/imap.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/libsylph/imap.c b/libsylph/imap.c index 35c053e7..cc33ab2a 100644 --- a/libsylph/imap.c +++ b/libsylph/imap.c @@ -2131,6 +2131,7 @@ static FolderItem *imap_create_folder(Folder *folder, FolderItem *parent, gchar separator; gchar *new_name; const gchar *p; + gboolean no_sub = FALSE, no_select = FALSE; gint ok; g_return_val_if_fail(folder != NULL, NULL); @@ -2186,10 +2187,13 @@ static FolderItem *imap_create_folder(Folder *folder, FolderItem *parent, str = g_ptr_array_index(argbuf, i); if (!strncmp(str, "LIST ", 5)) { exist = TRUE; + if (strcasestr(str + 5, "\\Noinferiors")) + no_sub = TRUE; + if (strcasestr(str + 5, "\\Noselect")) + no_select = TRUE; break; } } - g_ptr_array_free(argbuf, TRUE); if (!exist) { ok = imap_cmd_create(session, imap_path); @@ -2199,10 +2203,37 @@ static FolderItem *imap_create_folder(Folder *folder, FolderItem *parent, g_free(dirpath); return NULL; } + + g_ptr_array_free(argbuf, TRUE); + argbuf = g_ptr_array_new(); + ok = imap_cmd_list(session, NULL, imap_path, argbuf); + if (ok != IMAP_SUCCESS) { + log_warning("LIST failed\n"); + g_free(imap_path); + g_free(dirpath); + g_ptr_array_free(argbuf, TRUE); + return NULL; + } + + for (i = 0; i < argbuf->len; i++) { + gchar *str; + str = g_ptr_array_index(argbuf, i); + if (!strncmp(str, "LIST ", 5)) { + if (strcasestr(str + 5, "\\Noinferiors")) + no_sub = TRUE; + if (strcasestr(str + 5, "\\Noselect")) + no_select = TRUE; + break; + } + } } + + g_ptr_array_free(argbuf, TRUE); } new_item = folder_item_new(new_name, dirpath); + new_item->no_sub = no_sub; + new_item->no_select = no_select; folder_item_append(parent, new_item); g_free(imap_path); g_free(dirpath); |