From 8bb42c6de2eb99cb84d1f8acf8c102cbed1d3f5e Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 10 Mar 2004 22:01:32 +0000 Subject: Fix for bug #55298. 2004-03-10 Jeffrey Stedfast Fix for bug #55298. * em-format-html.c (efh_format_header): Now takes a default txt argument (header value). For address/date headers, if this isn't set, default back to the old behaviour of looking it up. (efh_format_headers): If we are iterating thru the camel raw headers, always pas the header value as the txt argument, otherwise always pass NULL. svn path=/trunk/; revision=25015 --- mail/ChangeLog | 11 +++++++++++ mail/em-format-html.c | 23 +++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index b3e3f8072f..5be2dcecc7 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,14 @@ +2004-03-10 Jeffrey Stedfast + + Fix for bug #55298. + + * em-format-html.c (efh_format_header): Now takes a default txt + argument (header value). For address/date headers, if this isn't + set, default back to the old behaviour of looking it up. + (efh_format_headers): If we are iterating thru the camel raw + headers, always pas the header value as the txt argument, + otherwise always pass NULL. + 2004-03-10 Jeffrey Stedfast * em-format-html-display.c (efhd_xpkcs7mime_validity_clicked): diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 19e43c366c..046d250de4 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1430,12 +1430,12 @@ efh_format_address (GString *out, struct _camel_header_address *a) } static void -efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const char *namein, guint32 flags, const char *charset) +efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const char *namein, const char *txt, guint32 flags, const char *charset) { CamelMimeMessage *msg = (CamelMimeMessage *) part; EMFormatHTML *efh = (EMFormatHTML *) emf; char *name, *value = NULL, *p; - const char *txt, *label; + const char *label; int addrspec = 0, i; name = alloca(strlen(namein)+1); @@ -1453,7 +1453,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const c struct _camel_header_address *addrs; GString *html; - if (!(txt = camel_medium_get_header (part, name))) + if (!txt && !(txt = camel_medium_get_header (part, name))) return; if (!(addrs = camel_header_address_decode (txt, emf->charset ? emf->charset : emf->default_charset))) @@ -1494,13 +1494,12 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const c int msg_offset, local_tz; time_t msg_date; struct tm local; - const char *date; - if (!(date = camel_medium_get_header (part, name))) + if (!txt && !(txt = camel_medium_get_header (part, name))) return; /* Show the local timezone equivalent in brackets if the sender is remote */ - msg_date = camel_header_decode_date (date, &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) */ @@ -1520,12 +1519,10 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const c e_utf8_strftime (buf, sizeof (buf), _(" (%R %Z)"), &local); } - html = camel_text_to_html (date, 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; - } else { - txt = date; } if (!strcmp (name, "date")) @@ -1535,9 +1532,7 @@ efh_format_header(EMFormat *emf, CamelStream *stream, CamelMedium *part, const c flags |= EM_FORMAT_HEADER_BOLD; } else { - txt = camel_medium_get_header (part, name); - value = camel_header_decode_string (txt, charset); - txt = value; + txt = value = camel_header_decode_string (txt, charset); label = namein; } @@ -1571,12 +1566,12 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) header = ((CamelMimePart *)part)->headers; while (header) { - efh_format_header(emf, stream, part, header->name, EM_FORMAT_HTML_HEADER_NOCOLUMNS, charset); + efh_format_header(emf, stream, part, header->name, header->value, EM_FORMAT_HTML_HEADER_NOCOLUMNS, charset); header = header->next; } } else { while (h->next) { - efh_format_header(emf, stream, part, h->name, h->flags, charset); + efh_format_header(emf, stream, part, h->name, NULL, h->flags, charset); h = h->next; } } -- cgit v1.2.3