diff options
author | bertrand <Bertrand.Guiheneuf@aful.org> | 1999-08-05 01:30:17 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-08-05 01:30:17 +0800 |
commit | bbd88805c2120aec425e133f11a5bb3f5168d9a3 (patch) | |
tree | 28435078085ade60b94a34c45947670e15a74773 /camel/providers/MH/camel-mh-folder.c | |
parent | b92cd47ad5105869b66b2166e2dafecbf8d29c93 (diff) | |
download | gsoc2013-evolution-bbd88805c2120aec425e133f11a5bb3f5168d9a3.tar gsoc2013-evolution-bbd88805c2120aec425e133f11a5bb3f5168d9a3.tar.gz gsoc2013-evolution-bbd88805c2120aec425e133f11a5bb3f5168d9a3.tar.bz2 gsoc2013-evolution-bbd88805c2120aec425e133f11a5bb3f5168d9a3.tar.lz gsoc2013-evolution-bbd88805c2120aec425e133f11a5bb3f5168d9a3.tar.xz gsoc2013-evolution-bbd88805c2120aec425e133f11a5bb3f5168d9a3.tar.zst gsoc2013-evolution-bbd88805c2120aec425e133f11a5bb3f5168d9a3.zip |
implemented.
1999-08-04 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/providers/MH/camel-mh-folder.c (_list_subfolders):
implemented.
svn path=/trunk/; revision=1077
Diffstat (limited to 'camel/providers/MH/camel-mh-folder.c')
-rw-r--r-- | camel/providers/MH/camel-mh-folder.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c index 8027be95b6..ad910f4005 100644 --- a/camel/providers/MH/camel-mh-folder.c +++ b/camel/providers/MH/camel-mh-folder.c @@ -47,6 +47,7 @@ static gboolean _exists (CamelFolder *folder); static gboolean _create(CamelFolder *folder); static gboolean _delete (CamelFolder *folder, gboolean recurse); static gboolean _delete_messages (CamelFolder *folder); +static GList *_list_subfolders (CamelFolder *folder); static void camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class) @@ -62,6 +63,7 @@ camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class) camel_folder_class->exists = _exists; camel_folder_class->delete = _delete; camel_folder_class->delete_messages = _delete_messages; + camel_folder_class->list_subfolders = _list_subfolders; } @@ -279,6 +281,54 @@ _delete_messages (CamelFolder *folder) +static GList * +_list_subfolders(CamelFolder *folder) +{ + GList *subfolder_name_list = NULL; + + CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder); + const gchar *directory_path; + struct stat stat_buf; + gint stat_error = 0; + GList *file_list; + gchar *entry_name; + struct dirent *dir_entry; + DIR *dir_handle; + + g_assert(folder); + + /* call default implementation */ + parent_class->delete_messages (folder); + + directory_path = mh_folder->directory_path; + if (!directory_path) return FALSE; + + if (!camel_folder_exists (folder)) return TRUE; + + dir_handle = opendir (directory_path); + + /* read first entry in the directory */ + dir_entry = readdir (dir_handle); + while ((stat_error != -1) && (unlink_error != -1) && (dir_entry != NULL)) { + + /* get the name of the next entry in the dir */ + entry_name = dir_entry->d_name; + stat_error = stat (mh_folder->directory_path, &stat_buf); + + /* is it a directory ? */ + if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) { + /* yes, add it to the list */ + CAMEL_LOG_FULL_DEBUG ("CamelMhFolder::list_subfolders adding %s\n", entry_name); + subfolder_name_list = g_list_append (subfolder_name_list, g_strdup (entry_name)); + } + /* read next entry */ + dir_entry = readdir (dir_handle); + } + + closedir (dir_handle); + + return subfolder_name_list; +} |