aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder-summary.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-07-10 06:40:49 +0800
committerDan Winship <danw@src.gnome.org>2000-07-10 06:40:49 +0800
commit90d51074c9c7c5284e3ff3e0a0eb4b5f5d96761f (patch)
treeab290885dfa6763006ef2480643e918725810448 /camel/camel-folder-summary.c
parentb90d829757ffe516f8853ddd462f64220cc46b07 (diff)
downloadgsoc2013-evolution-90d51074c9c7c5284e3ff3e0a0eb4b5f5d96761f.tar
gsoc2013-evolution-90d51074c9c7c5284e3ff3e0a0eb4b5f5d96761f.tar.gz
gsoc2013-evolution-90d51074c9c7c5284e3ff3e0a0eb4b5f5d96761f.tar.bz2
gsoc2013-evolution-90d51074c9c7c5284e3ff3e0a0eb4b5f5d96761f.tar.lz
gsoc2013-evolution-90d51074c9c7c5284e3ff3e0a0eb4b5f5d96761f.tar.xz
gsoc2013-evolution-90d51074c9c7c5284e3ff3e0a0eb4b5f5d96761f.tar.zst
gsoc2013-evolution-90d51074c9c7c5284e3ff3e0a0eb4b5f5d96761f.zip
New function to copy a header_references structure.
* camel-mime-utils.c (header_references_dup): New function to copy a header_references structure. * camel-folder-summary.c (camel_message_info_dup_to): New function to (deep) copy the data from one CamelMessageInfo into another. (camel_message_info_free): And free the data. * providers/vee/camel-vee-folder.c (vee_sync): Implement. (empty). (vee_search_by_expression): belatedly update for camel_folder_search change. (vee_folder_build): belatedly update for camel_folder_search change. Use camel_message_info_dup_to and camel_message_info_free (in particular, so that we get message_id and references info so vfolders can be threaded). (vee_folder_build_folder): Ditto. svn path=/trunk/; revision=4024
Diffstat (limited to 'camel/camel-folder-summary.c')
-rw-r--r--camel/camel-folder-summary.c71
1 files changed, 62 insertions, 9 deletions
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 1558616653..73de29986a 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -1054,15 +1054,7 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
static void
message_info_free(CamelFolderSummary *s, CamelMessageInfo *mi)
{
- g_free(mi->uid);
- g_free(mi->subject);
- g_free(mi->from);
- g_free(mi->to);
- g_free(mi->cc);
- g_free(mi->message_id);
- header_references_list_clear(&mi->references);
- camel_flag_list_free(&mi->user_flags);
- g_free(mi);
+ camel_message_info_free(mi);
}
static CamelMessageContentInfo *
@@ -1357,6 +1349,67 @@ camel_flag_list_free(CamelFlag **list)
*list = NULL;
}
+/**
+ * camel_message_info_dup_to:
+ * @from: source message info
+ * @to: destination message info
+ *
+ * Duplicates the contents of one CamelMessageInfo structure into another.
+ * (The destination is assumed to be empty: its contents are not freed.)
+ * The slightly odd interface is to allow this to be used to initialize
+ * "subclasses" of CamelMessageInfo.
+ **/
+void
+camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to)
+{
+ CamelFlag *flag;
+
+ /* Copy numbers */
+ to->flags = from->flags;
+ to->size = from->size;
+ to->date_sent = from->date_sent;
+ to->date_received = from->date_received;
+
+ /* Copy strings */
+ to->subject = g_strdup(from->subject);
+ to->from = g_strdup(from->from);
+ to->to = g_strdup(from->to);
+ to->cc = g_strdup(from->cc);
+ to->uid = g_strdup(from->uid);
+ to->message_id = g_strdup(from->message_id);
+
+ /* Copy structures */
+ to->references = header_references_dup(from->references);
+ flag = from->user_flags;
+ while (flag) {
+ camel_flag_set(&to->user_flags, flag->name, TRUE);
+ flag = flag->next;
+ }
+
+ /* FIXME some day */
+ to->content = NULL;
+}
+
+/**
+ * camel_message_info_free:
+ * @mi: the message info
+ *
+ * Frees a CamelMessageInfo and its contents.
+ **/
+void
+camel_message_info_free(CamelMessageInfo *mi)
+{
+ g_free(mi->uid);
+ g_free(mi->subject);
+ g_free(mi->from);
+ g_free(mi->to);
+ g_free(mi->cc);
+ g_free(mi->message_id);
+ header_references_list_clear(&mi->references);
+ camel_flag_list_free(&mi->user_flags);
+ /* FIXME: content info? */
+ g_free(mi);
+}
#if 0
static void