aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-05-25 01:27:51 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-05-25 01:27:51 +0800
commita0c112f4dc29fbca62a69220a7d950a02a007963 (patch)
tree8d0ed8355552e1cbf8053bf4480a475a49b15e47
parent942827fe409de6f37f02b4315795120fac09c685 (diff)
downloadgsoc2013-evolution-a0c112f4dc29fbca62a69220a7d950a02a007963.tar
gsoc2013-evolution-a0c112f4dc29fbca62a69220a7d950a02a007963.tar.gz
gsoc2013-evolution-a0c112f4dc29fbca62a69220a7d950a02a007963.tar.bz2
gsoc2013-evolution-a0c112f4dc29fbca62a69220a7d950a02a007963.tar.lz
gsoc2013-evolution-a0c112f4dc29fbca62a69220a7d950a02a007963.tar.xz
gsoc2013-evolution-a0c112f4dc29fbca62a69220a7d950a02a007963.tar.zst
gsoc2013-evolution-a0c112f4dc29fbca62a69220a7d950a02a007963.zip
Populate the extra_hdr_* arrays with any non-special-case headers.
2001-05-24 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (e_msg_composer_new_with_message): Populate the extra_hdr_* arrays with any non-special-case headers. (is_special_header): New convenience function to determine if a header is a "special" header or not. svn path=/trunk/; revision=9963
-rw-r--r--composer/ChangeLog7
-rw-r--r--composer/e-msg-composer.c56
2 files changed, 63 insertions, 0 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 89ad7a14ee..e62b6bc979 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,10 @@
+2001-05-24 Jeffrey Stedfast <fejj@ximian.com>
+
+ * e-msg-composer.c (e_msg_composer_new_with_message): Populate the
+ extra_hdr_* arrays with any non-special-case headers.
+ (is_special_header): New convenience function to determine if a
+ header is a "special" header or not.
+
2001-05-24 Radek Doulik <rodo@ximian.com>
* e-msg-composer.c (menu_edit_delete_all_cb): new callback
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index d6c6a70f10..fa531c14a4 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -2131,6 +2131,50 @@ handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth)
}
}
+/* FIXME: are there any other headers?? */
+/* This is a list of headers that we DO NOT want to append to the
+ * extra_hdr_* arrays.
+ *
+ * Note: a '*' char can be used for a simple wilcard match.
+ * is_special_header() will use g_strNcasecmp() with the first '*'
+ * char being the end of the match string. If no '*' is present, then
+ * it will be assumed that the header must be an exact match.
+ */
+static char *special_headers[] = {
+ "Subject",
+ "Date",
+ "From",
+ "To",
+ "Cc",
+ "Bcc",
+ "Received",
+ "Message-Id",
+ "X-Evolution*",
+ "Content-*",
+ "MIME-Version",
+ NULL
+};
+
+static gboolean
+is_special_header (const char *hdr_name)
+{
+ int i;
+
+ for (i = 0; special_headers[i]; i++) {
+ char *p;
+
+ if ((p = strchr (special_headers[i], '*'))) {
+ if (!g_strncasecmp (special_headers[i], hdr_name, p - special_headers[i]))
+ return TRUE;
+ } else {
+ if (!g_strcasecmp (special_headers[i], hdr_name))
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
/**
* e_msg_composer_new_with_message:
*
@@ -2144,6 +2188,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg)
const CamelInternetAddress *to, *cc, *bcc;
GList *To = NULL, *Cc = NULL, *Bcc = NULL;
CamelContentType *content_type;
+ struct _header_raw *headers;
const gchar *subject;
EMsgComposer *new;
guint len, i;
@@ -2208,6 +2253,17 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg)
free_recipients (Cc);
free_recipients (Bcc);
+ /* set extra headers */
+ headers = CAMEL_MIME_PART (msg)->headers;
+ while (headers) {
+ if (!is_special_header (headers->name)) {
+ g_ptr_array_add (new->extra_hdr_names, g_strdup (headers->name));
+ g_ptr_array_add (new->extra_hdr_values, g_strdup (headers->value));
+ }
+
+ headers = headers->next;
+ }
+
content_type = camel_mime_part_get_content_type (CAMEL_MIME_PART (msg));
if (header_content_type_is (content_type, "multipart", "alternative")) {
/* multipart/alternative contains the text/plain and text/html versions of the message body */