diff options
author | Sankar P <psankar@novell.com> | 2007-07-17 19:50:23 +0800 |
---|---|---|
committer | Sankarasivasubramanian Pasupathilingam <psankar@src.gnome.org> | 2007-07-17 19:50:23 +0800 |
commit | aa91270269f7363fb6443cf3a9e731fb471de2ba (patch) | |
tree | 4b68b4cf3d85246fd6677c1e2986a715e6b8e546 | |
parent | b89c23045fdd540c5e9f50492cf6d1d6ab59e178 (diff) | |
download | gsoc2013-evolution-aa91270269f7363fb6443cf3a9e731fb471de2ba.tar.gz gsoc2013-evolution-aa91270269f7363fb6443cf3a9e731fb471de2ba.tar.zst gsoc2013-evolution-aa91270269f7363fb6443cf3a9e731fb471de2ba.zip |
Decodes Face header and displays the image.
2007-07-17 Sankar P <psankar@novell.com>
* em-format-html.c: (efh_format_headers):
Decodes Face header and displays the image.
svn path=/trunk/; revision=33814
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/em-format-html.c | 30 |
2 files changed, 33 insertions, 2 deletions
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 <psankar@novell.com> + + * em-format-html.c: (efh_format_headers): + Decodes Face header and displays the image. + 2007-07-16 Sankar P <psankar@novell.com> * 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, "<td align=\"right\" valign=\"top\"><img width=64 src=\"%s\"></td>", classid); + em_format_add_puri(emf, sizeof(EMFormatPURI), classid, part, efh_write_image); + camel_object_unref(part); + } if (have_icon && efh->show_icon) { |