From 068e5e40b09717f630f6bb12bc199d6a739db4e3 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 1 Jun 2007 21:41:12 +0000 Subject: ** Adds support for Contact Image in the preview pane svn path=/trunk/; revision=33613 --- mail/em-format-html.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'mail/em-format-html.c') diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 66ca8885b9..3ce658cfe1 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1748,7 +1748,9 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) CamelContentType *ct; struct _camel_header_raw *header; gboolean have_icon = FALSE; - + const char *photo_name = NULL; + CamelInternetAddress *cia = NULL; + ct = camel_mime_part_get_content_type((CamelMimePart *)part); charset = camel_content_type_param (ct, "charset"); charset = e_iconv_charset_name(charset); @@ -1777,6 +1779,10 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) mailer = !g_ascii_strcasecmp (h->name, "X-Evolution-Mailer"); while (header) { + + if (emf->show_photo && !photo_name && !g_ascii_strcasecmp (header->name, "From")) + photo_name = header->value; + if (!mailer_shown && mailer && (!g_ascii_strcasecmp (header->name, "X-Mailer") || !g_ascii_strcasecmp (header->name, "User-Agent") || !g_ascii_strcasecmp (header->name, "X-Newsreader"))) { @@ -1801,6 +1807,29 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (!efh->simple_headers) { camel_stream_printf(stream, ""); + if (photo_name) { + char *classid; + CamelMimePart *photopart; + + cia = camel_internet_address_new(); + camel_address_decode((CamelAddress *) cia, (const char *) photo_name); + photopart = em_utils_contact_photo (cia, emf->photo_local); + + if (photopart) { + classid = g_strdup_printf("icon:///em-format-html/%s/photo/header", + emf->part_id->str); + camel_stream_printf(stream, + "", + classid); + em_format_add_puri(emf, sizeof(EMFormatPURI), classid, + photopart, efh_write_image); + camel_object_unref(photopart); + + g_free(classid); + } + camel_object_unref(cia); + } + if (have_icon && efh->show_icon) { GtkIconInfo *icon_info; char *classid; -- cgit