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 | |
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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ChangeLog.ja | 5 | ||||
-rw-r--r-- | libsylph/imap.c | 33 |
3 files changed, 42 insertions, 1 deletions
@@ -1,5 +1,10 @@ 2007-09-14 + * libsylph/imap.c: imap_create_folder(): check for \NoInferior and + \Noselect flags. + +2007-09-14 + * libsylph/folder.[ch]: folder_item_copy(): new. It duplicates FolderItem struct. * libsylph/imap.c: imap_scan_tree(): use 'LIST "" "*"' command diff --git a/ChangeLog.ja b/ChangeLog.ja index 9045ea9f..a1e2a9d9 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,10 @@ 2007-09-14 + * libsylph/imap.c: imap_create_folder(): \NoInferior と \Noselect + フラグをチェックするようにした。 + +2007-09-14 + * libsylph/folder.[ch]: folder_item_copy(): 新規。 FolderItem 構造体 を複製する。 * libsylph/imap.c: imap_scan_tree(): フォルダリストを取得するとき 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); |