aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-utils.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-20 15:30:25 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-20 15:30:25 +0800
commit3d36457b2cd4b52492f58e16914ca75d7932a46e (patch)
treef815041010f5e9a8e106cb9e5d36d52663854ba9 /camel/providers/imap/camel-imap-utils.c
parent41dcb0c01b44af388aa51a200d411ea4fe2eeb83 (diff)
downloadgsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar
gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.gz
gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.bz2
gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.lz
gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.xz
gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.tar.zst
gsoc2013-evolution-3d36457b2cd4b52492f58e16914ca75d7932a46e.zip
Get the entire directory structure for the folder we just created, meaning
2001-08-20 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-store.c (create_folder): Get the entire directory structure for the folder we just created, meaning if we created a folder named "test.mailbox" where test didn't previously exist, get the listing for "test" and "test.mailbox". * providers/imap/camel-imap-utils.c (imap_parse_folder_name): New function. svn path=/trunk/; revision=12258
Diffstat (limited to 'camel/providers/imap/camel-imap-utils.c')
-rw-r--r--camel/providers/imap/camel-imap-utils.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index ce547a5198..25154755f4 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -138,6 +138,56 @@ imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, ch
return TRUE;
}
+
+/**
+ * imap_parse_folder_name:
+ * @store:
+ * @folder_name:
+ *
+ * Return an array of folder paths representing the folder heirarchy.
+ * For example:
+ * Full/Path/"to / from"/Folder
+ * Results in:
+ * Full, Full/Path, Full/Path/"to / from", Full/Path/"to / from"/Folder
+ **/
+char **
+imap_parse_folder_name (CamelImapStore *store, const char *folder_name)
+{
+ GPtrArray *heirarchy;
+ char **paths;
+ const char *p;
+
+ p = folder_name;
+ if (*p == store->dir_sep)
+ p++;
+
+ heirarchy = g_ptr_array_new ();
+
+ while (*p) {
+ if (*p == '"') {
+ p++;
+ while (*p && *p != '"')
+ p++;
+ if (*p)
+ p++;
+ continue;
+ }
+
+ if (*p == store->dir_sep)
+ g_ptr_array_add (heirarchy, g_strndup (folder_name, p - folder_name));
+
+ p++;
+ }
+
+ g_ptr_array_add (heirarchy, g_strdup (folder_name));
+ g_ptr_array_add (heirarchy, NULL);
+
+ paths = (char **) heirarchy->pdata;
+ g_ptr_array_free (heirarchy, FALSE);
+
+ return paths;
+}
+
char *
imap_create_flag_list (guint32 flags)
{