aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-store.c36
-rw-r--r--camel/camel-store.h1
3 files changed, 41 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 8a13bcc98f..d638cf6671 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2001-10-17 <NotZed@Ximian.com>
+
+ * camel-store.c (camel_folder_info_clone): New function to clone a
+ folderinfo tree.
+
2001-10-17 Jeffrey Stedfast <fejj@ximian.com>
* providers/local/camel-mh-folder.c (mh_append_message): Same as
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 4bc5de3f83..3cd695f1bc 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -838,7 +838,41 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace,
top = fi;
}
- return top;
+ return top;
+}
+
+static CamelFolderInfo *folder_info_clone_rec(CamelFolderInfo *fi, CamelFolderInfo *parent)
+{
+ CamelFolderInfo *info;
+
+ info = g_malloc(sizeof(*info));
+ info->parent = parent;
+ info->url = g_strdup(fi->url);
+ info->name = g_strdup(fi->name);
+ info->full_name = g_strdup(fi->full_name);
+ info->path = g_strdup(fi->path);
+ info->unread_message_count = fi->unread_message_count;
+
+ if (fi->sibling)
+ info->sibling = folder_info_clone_rec(fi->sibling, parent);
+ else
+ info->sibling = NULL;
+
+ if (fi->child)
+ info->child = folder_info_clone_rec(fi->child, info);
+ else
+ info->child = NULL;
+
+ return info;
+}
+
+CamelFolderInfo *
+camel_folder_info_clone(CamelFolderInfo *fi)
+{
+ if (fi == NULL)
+ return NULL;
+
+ return folder_info_clone_rec(fi, NULL);
}
gboolean
diff --git a/camel/camel-store.h b/camel/camel-store.h
index 8f7f566d3a..2cb1e4c7fb 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -183,6 +183,7 @@ CamelFolderInfo *camel_folder_info_build (GPtrArray *folders,
const char *namespace,
char separator,
gboolean short_names);
+CamelFolderInfo *camel_folder_info_clone (CamelFolderInfo *fi);
gboolean camel_store_supports_subscriptions (CamelStore *store);