From 442fe9209a578c60c755a369e796c6ff78eb2135 Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Mon, 30 Jul 2007 14:36:46 +0000 Subject: Display a information string if a from and sender are different. svn path=/trunk/; revision=33903 --- mail/ChangeLog | 7 ++++++ mail/em-format-html.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 2ba70b9dfa..5122d9d747 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,10 @@ +2007-07-30 Chenthill Palanisamy + + * em-format-html.c: (efh_format_headers): Displaying a message + to the recipient of the mail informing him about delegated mails. + The message is displayed for all mails containing the "Sender" field + Committing on behalf of Bharath Acharya + 2007-07-29 Rob Bradford ** Potential fix for: #453668 diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 3334e65ce3..325035490b 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1776,6 +1776,7 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) gboolean face_decoded = FALSE; char *face_header_value = NULL; int face_header_len = 0; + char *header_sender = NULL, *header_from = NULL, *name; ct = camel_mime_part_get_content_type((CamelMimePart *)part); charset = camel_content_type_param (ct, "charset"); @@ -1784,8 +1785,64 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (!efh->simple_headers) camel_stream_printf(stream, "\n" - "
\n", + "
", efh->text_colour & 0xffffff); + + + header = ((CamelMimePart *)part)->headers; + while (header) { + if(!g_ascii_strcasecmp (header->name, "Sender")) { + struct _camel_header_address *addrs; + GString *html; + + if (!(addrs = camel_header_address_decode(header->value, emf->charset ? emf->charset : emf->default_charset))) + return; + + html = g_string_new(""); + name = efh_format_address(efh, html, addrs, header->name); + + header_sender= html->str; + camel_header_address_unref(addrs); + + g_string_free(html, FALSE); + g_free (name); + } + + if(!g_ascii_strcasecmp (header->name, "From")) { + struct _camel_header_address *addrs; + GString *html; + + if (!(addrs = camel_header_address_decode(header->value, emf->charset ? emf->charset : emf->default_charset))) + return; + + html = g_string_new(""); + name = efh_format_address(efh, html, addrs, header->name); + + header_from= html->str; + camel_header_address_unref(addrs); + + g_string_free(html, FALSE); + g_free(name); + } + + if (header_sender && header_from) { + camel_stream_printf(stream, ""); + break; + } + + header = header->next; + } + + g_free (header_sender); + g_free (header_from); + + camel_stream_printf(stream, "
"); + camel_stream_printf(stream, "
"); + /* To translators: This message suggests to the receipients that the sender of the mail is + different from the one listed in From field. + */ + camel_stream_printf(stream, "This message was sent by %s on behalf of %s", header_sender, header_from); + camel_stream_printf(stream, "
\n"); /* dump selected headers */ h = (EMFormatHeader *)emf->header_list.head; -- cgit v1.2.3