From 2dab41615b9ed522ab0587681b1f875ab20d1607 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 11 Mar 2004 16:14:23 +0000 Subject: Fixed a bug where txt wasn't being properly initialised in all cases for 2004-03-11 Jeffrey Stedfast * em-format-html.c (efh_format_header): Fixed a bug where txt wasn't being properly initialised in all cases for Date headers. Also fixed the x-evolution-mailer code to simply use the ehader->value that was passed in. (efh_format_headers): Fixed to handle the special X-Evolution-Mailer header. svn path=/trunk/; revision=25028 --- mail/ChangeLog | 9 +++++++++ mail/em-format-html.c | 32 ++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 3756840b54..c4d617d6e2 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,12 @@ +2004-03-11 Jeffrey Stedfast + + * em-format-html.c (efh_format_header): Fixed a bug where txt + wasn't being properly initialised in all cases for Date + headers. Also fixed the x-evolution-mailer code to simply use the + ehader->value that was passed in. + (efh_format_headers): Fixed to handle the special + X-Evolution-Mailer header. + 2004-03-11 Not Zed * em-folder-browser.c (emfb_set_folder): a really gross hack, diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 10ed59260f..87440664b3 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1480,20 +1480,22 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct txt = camel_mime_message_get_subject (msg); label = _("Subject"); flags |= EM_FORMAT_HEADER_BOLD; - } else if (!strcmp (name, "x-evolution-mailer")) { /* pseudo-header */ - if (!(txt = camel_medium_get_header (part, "x-mailer"))) - if (!(txt = camel_medium_get_header (part, "user-agent"))) - return; - + } else if (!strcmp (name, "x-evolution-mailer")) { + /* pseudo-header */ label = _("Mailer"); + txt = header->value; flags |= EM_FORMAT_HEADER_BOLD; } else if (!strcmp (name, "date") || !strcmp (name, "resent-date")) { int msg_offset, local_tz; time_t msg_date; struct tm local; + txt = header->value; + while (*txt == ' ') + txt++; + /* Show the local timezone equivalent in brackets if the sender is remote */ - msg_date = camel_header_decode_date (header->value, &msg_offset); + msg_date = camel_header_decode_date (txt, &msg_offset); e_localtime_with_offset (msg_date, &local, &local_tz); /* Convert message offset to minutes (e.g. -0400 --> -240) */ @@ -1513,7 +1515,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, struct e_utf8_strftime (buf, sizeof (buf), _(" (%R %Z)"), &local); } - html = camel_text_to_html (header->value, efh->text_html_flags, 0); + html = camel_text_to_html (txt, efh->text_html_flags, 0); txt = value = g_strdup_printf ("%s %s", html, buf); g_free (html); flags |= EM_FORMAT_HTML_HEADER_HTML; @@ -1564,10 +1566,24 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) } } else { while (h->next) { + int mailer; + header = ((CamelMimePart *)part)->headers; + + mailer = !g_ascii_strcasecmp (h->name, "X-Evolution-Mailer"); + while (header) { - if (!g_ascii_strcasecmp(header->name, h->name)) + if (mailer && (!g_ascii_strcasecmp (header->name, "X-Mailer") || + !g_ascii_strcasecmp (header->name, "User-Agent"))) { + struct _camel_header_raw xmailer; + + xmailer.name = "X-Evolution-Mailer"; + xmailer.value = header->value; + + efh_format_header (emf, stream, part, &xmailer, h->flags, charset); + } else if (!g_ascii_strcasecmp (header->name, h->name)) { efh_format_header(emf, stream, part, header, h->flags, charset); + } header = header->next; } h = h->next; -- cgit v1.2.3