aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-12-01 08:34:33 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-12-01 08:34:33 +0800
commitc1d2ec0123694a3b52e9c58de97c60994f5db587 (patch)
treeea4a4de3b8f17e616cd67bc5364e07b533f5b759
parent4ace38162633ccff9497683e67e2f93f3ab850cf (diff)
downloadgsoc2013-evolution-c1d2ec0123694a3b52e9c58de97c60994f5db587.tar.gz
gsoc2013-evolution-c1d2ec0123694a3b52e9c58de97c60994f5db587.tar.zst
gsoc2013-evolution-c1d2ec0123694a3b52e9c58de97c60994f5db587.zip
New convenience function, doesn't do much but it sure makes code cleaner
2000-11-30 Jeffrey Stedfast <fejj@helixcode.com> * camel-folder-summary.c (camel_message_info_new): New convenience function, doesn't do much but it sure makes code cleaner to read. (camel_message_info_new_from_header): This one makes my life heaven. svn path=/trunk/; revision=6749
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-folder-summary.c54
-rw-r--r--camel/camel-folder-summary.h2
3 files changed, 62 insertions, 0 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 855d9654dc..95457c91bd 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,11 @@
2000-11-30 Jeffrey Stedfast <fejj@helixcode.com>
+ * camel-folder-summary.c (camel_message_info_new): New convenience
+ function, doesn't do much but it sure makes code cleaner to read.
+ (camel_message_info_new_from_header): This one makes my life heaven.
+
+2000-11-30 Jeffrey Stedfast <fejj@helixcode.com>
+
* providers/imap/camel-imap-summary.c (camel_imap_summary_new):
Handle the case where the summary failed to load - clear the
summary and then set the dirty bit so that it is sure to save
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 4879d547ee..b7b9b9c421 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -2138,6 +2138,60 @@ void camel_tag_list_free(CamelTag **list)
*list = NULL;
}
+
+/**
+ * camel_message_info_new:
+ *
+ * Returns a new CamelMessageInfo structure.
+ **/
+CamelMessageInfo *
+camel_message_info_new ()
+{
+ CamelMessageInfo *info;
+
+ info = g_new0 (CamelMessageInfo, 1);
+#ifdef DOESTRV
+ info->strings = e_strv_new (CAMEL_MESSAGE_INFO_LAST);
+#endif
+
+ return info;
+}
+
+
+/**
+ * camel_message_info_new_from_header:
+ * @header: raw header
+ *
+ * Returns a new CamelMessageInfo structure populated by the header.
+ **/
+CamelMessageInfo *
+camel_message_info_new_from_header (struct _header_raw *header)
+{
+ CamelMessageInfo *info;
+ char *subject, *from, *to, *cc;
+
+ subject = camel_folder_summary_format_string (header, "subject");
+ from = camel_folder_summary_format_address (header, "from");
+ to = camel_folder_summary_format_address (header, "to");
+ cc = camel_folder_summary_format_address (header, "cc");
+
+ info = g_new0 (CamelMessageInfo, 1);
+#ifdef DOESTRV
+ info->strings = e_strv_new (CAMEL_MESSAGE_INFO_LAST);
+ camel_message_info_set_subject (info, subject);
+ camel_message_info_set_from (info, from);
+ camel_message_info_set_to (info, to);
+ camel_message_info_set_cc (info, cc);
+#else
+ info->subject = subject;
+ info->from = from;
+ info->to = to;
+ info->cc = cc;
+#endif
+
+ return info;
+}
+
/**
* camel_message_info_dup_to:
* @from: source message info
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
index defba693fc..eb8d839822 100644
--- a/camel/camel-folder-summary.h
+++ b/camel/camel-folder-summary.h
@@ -277,6 +277,8 @@ void camel_tag_list_free(CamelTag **list);
/* message info utils for working with pseudo-messageinfo structures
NOTE: These cannot be added to a real summary object, but suffice for all
other external interfaces that use message info's */
+CamelMessageInfo *camel_message_info_new ();
+CamelMessageInfo *camel_message_info_new_from_header (struct _header_raw *header);
void camel_message_info_dup_to(const CamelMessageInfo *from, CamelMessageInfo *to);
void camel_message_info_free(CamelMessageInfo *mi);