From aa91270269f7363fb6443cf3a9e731fb471de2ba Mon Sep 17 00:00:00 2001 From: Sankar P Date: Tue, 17 Jul 2007 11:50:23 +0000 Subject: Decodes Face header and displays the image. 2007-07-17 Sankar P * em-format-html.c: (efh_format_headers): Decodes Face header and displays the image. svn path=/trunk/; revision=33814 --- mail/ChangeLog | 5 +++++ mail/em-format-html.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index df105d97a1..ca93b87aad 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2007-07-17 Sankar P + + * em-format-html.c: (efh_format_headers): + Decodes Face header and displays the image. + 2007-07-16 Sankar P * em-composer-prefs.c: (em_composer_prefs_construct): diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 80392ebc6b..f7617b59f9 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1764,7 +1764,10 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) gboolean have_icon = FALSE; const char *photo_name = NULL; CamelInternetAddress *cia = NULL; - + gboolean face_decoded = FALSE; + char *face_header_value; + int face_header_len; + ct = camel_mime_part_get_content_type((CamelMimePart *)part); charset = camel_content_type_param (ct, "charset"); charset = e_iconv_charset_name(charset); @@ -1785,7 +1788,6 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) } } else { int mailer_shown = FALSE; - while (h->next) { int mailer; @@ -1809,9 +1811,22 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) efh_format_header (emf, stream, part, &xmailer, h->flags, charset); if (strstr(header->value, "Evolution")) have_icon = TRUE; + } else if (!g_ascii_strcasecmp (header->name, "Face") && !face_decoded) { + char *tmp; + + face_decoded = TRUE; + tmp = g_strdup (header->value); + for (; *tmp == ' '; tmp++); + + face_header_len = camel_base64_decode_simple (tmp, strlen(tmp)); + tmp[face_header_len] = 0; + + face_header_value = tmp; + } 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; @@ -1842,6 +1857,17 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) g_free(classid); } camel_object_unref(cia); + } else if (face_decoded) { + char *classid; + CamelMimePart *part; + + part = camel_mime_part_new (); + camel_mime_part_set_content ((CamelMimePart *) part, (const char *) face_header_value, face_header_len, "image/png"); + classid = g_strdup_printf("icon:///em-format-html/face/photo/header"); + camel_stream_printf(stream, "", classid); + em_format_add_puri(emf, sizeof(EMFormatPURI), classid, part, efh_write_image); + camel_object_unref(part); + } if (have_icon && efh->show_icon) { -- cgit v1.2.3