182 lines
6 KiB
Diff
182 lines
6 KiB
Diff
diff -up evolution-3.16.5/em-format/e-mail-formatter-attachment.c.crash-message-digest evolution-3.16.5/em-format/e-mail-formatter-attachment.c
|
|
--- evolution-3.16.5/em-format/e-mail-formatter-attachment.c.crash-message-digest 2015-05-29 12:40:05.000000000 +0200
|
|
+++ evolution-3.16.5/em-format/e-mail-formatter-attachment.c 2015-08-19 17:22:36.616380858 +0200
|
|
@@ -320,7 +320,7 @@ emfe_attachment_format (EMailFormatterEx
|
|
}
|
|
|
|
if (success) {
|
|
- gchar *wrapper_element_id, *inner_html_data;
|
|
+ gchar *wrapper_element_id;
|
|
gconstpointer data;
|
|
gsize size;
|
|
|
|
@@ -332,20 +332,33 @@ emfe_attachment_format (EMailFormatterEx
|
|
size = g_memory_output_stream_get_data_size (
|
|
G_MEMORY_OUTPUT_STREAM (content_stream));
|
|
|
|
- inner_html_data = g_markup_escape_text (data, size);
|
|
-
|
|
g_string_append_printf (
|
|
buffer,
|
|
"<tr><td colspan=\"2\">"
|
|
- "<div class=\"attachment-wrapper\" id=\"%s\" inner-html-data=\"%s\">",
|
|
- wrapper_element_id, inner_html_data);
|
|
+ "<div class=\"attachment-wrapper\" id=\"%s\"",
|
|
+ wrapper_element_id);
|
|
+
|
|
+ if (e_mail_part_should_show_inline (part)) {
|
|
+ g_string_append (buffer, ">");
|
|
+ g_string_append_len (buffer, data, size);
|
|
+ } else {
|
|
+ gchar *inner_html_data;
|
|
+
|
|
+ inner_html_data = g_markup_escape_text (data, size);
|
|
+
|
|
+ g_string_append_printf (
|
|
+ buffer,
|
|
+ " inner-html-data=\"%s\">",
|
|
+ inner_html_data);
|
|
+
|
|
+ g_free (inner_html_data);
|
|
+ }
|
|
|
|
g_string_append (buffer, "</div></td></tr>");
|
|
|
|
- e_mail_part_attachment_set_expandable (E_MAIL_PART_ATTACHMENT (part), TRUE);
|
|
+ e_mail_part_attachment_set_expandable (empa, TRUE);
|
|
|
|
g_free (wrapper_element_id);
|
|
- g_free (inner_html_data);
|
|
}
|
|
|
|
g_object_unref (content_stream);
|
|
diff -up evolution-3.16.5/em-format/e-mail-part.c.crash-message-digest evolution-3.16.5/em-format/e-mail-part.c
|
|
--- evolution-3.16.5/em-format/e-mail-part.c.crash-message-digest 2014-03-24 10:25:23.000000000 +0100
|
|
+++ evolution-3.16.5/em-format/e-mail-part.c 2015-08-19 17:22:36.616380858 +0200
|
|
@@ -26,10 +26,15 @@
|
|
* message.
|
|
*/
|
|
|
|
+#ifdef HAVE_CONFIG_H
|
|
+#include <config.h>
|
|
+#endif
|
|
+
|
|
#include "e-mail-part.h"
|
|
|
|
#include <string.h>
|
|
|
|
+#include "e-mail-part-attachment.h"
|
|
#include "e-mail-part-list.h"
|
|
|
|
#define E_MAIL_PART_GET_PRIVATE(obj) \
|
|
@@ -441,6 +446,46 @@ e_mail_part_set_mime_type (EMailPart *pa
|
|
g_object_notify (G_OBJECT (part), "mime-type");
|
|
}
|
|
|
|
+gboolean
|
|
+e_mail_part_should_show_inline (EMailPart *part)
|
|
+{
|
|
+ CamelMimePart *mime_part;
|
|
+ const CamelContentDisposition *disposition;
|
|
+ gboolean res = FALSE;
|
|
+
|
|
+ g_return_val_if_fail (E_IS_MAIL_PART (part), FALSE);
|
|
+
|
|
+ /* Automatically expand attachments that have inline
|
|
+ * disposition or the EMailParts have specific
|
|
+ * force_inline flag set. */
|
|
+
|
|
+ if (part->force_collapse)
|
|
+ return FALSE;
|
|
+
|
|
+ if (part->force_inline)
|
|
+ return TRUE;
|
|
+
|
|
+ if (E_IS_MAIL_PART_ATTACHMENT (part)) {
|
|
+ EMailPartAttachment *empa = E_MAIL_PART_ATTACHMENT (part);
|
|
+
|
|
+ if (g_strcmp0 (empa->snoop_mime_type, "message/rfc822") == 0)
|
|
+ return TRUE;
|
|
+ }
|
|
+
|
|
+ mime_part = e_mail_part_ref_mime_part (part);
|
|
+ if (!mime_part)
|
|
+ return FALSE;
|
|
+
|
|
+ disposition = camel_mime_part_get_content_disposition (mime_part);
|
|
+ if (disposition && disposition->disposition &&
|
|
+ g_ascii_strncasecmp (disposition->disposition, "inline", 6) == 0)
|
|
+ res = TRUE;
|
|
+
|
|
+ g_object_unref (mime_part);
|
|
+
|
|
+ return res;
|
|
+}
|
|
+
|
|
EMailPartList *
|
|
e_mail_part_ref_part_list (EMailPart *part)
|
|
{
|
|
diff -up evolution-3.16.5/em-format/e-mail-part.h.crash-message-digest evolution-3.16.5/em-format/e-mail-part.h
|
|
--- evolution-3.16.5/em-format/e-mail-part.h.crash-message-digest 2014-03-24 10:25:23.000000000 +0100
|
|
+++ evolution-3.16.5/em-format/e-mail-part.h 2015-08-19 17:22:36.616380858 +0200
|
|
@@ -107,6 +107,7 @@ CamelMimePart * e_mail_part_ref_mime_par
|
|
const gchar * e_mail_part_get_mime_type (EMailPart *part);
|
|
void e_mail_part_set_mime_type (EMailPart *part,
|
|
const gchar *mime_type);
|
|
+gboolean e_mail_part_should_show_inline (EMailPart *part);
|
|
struct _EMailPartList *
|
|
e_mail_part_ref_part_list (EMailPart *part);
|
|
void e_mail_part_set_part_list (EMailPart *part,
|
|
diff -up evolution-3.16.5/mail/e-mail-display.c.crash-message-digest evolution-3.16.5/mail/e-mail-display.c
|
|
--- evolution-3.16.5/mail/e-mail-display.c.crash-message-digest 2015-05-29 12:40:05.000000000 +0200
|
|
+++ evolution-3.16.5/mail/e-mail-display.c 2015-08-19 17:23:52.369377648 +0200
|
|
@@ -471,6 +471,8 @@ attachment_button_expanded (GObject *obj
|
|
|
|
html_element = WEBKIT_DOM_HTML_ELEMENT (element);
|
|
webkit_dom_html_element_set_inner_html (html_element, inner_html_data, NULL);
|
|
+
|
|
+ webkit_dom_element_remove_attribute (element, "inner-html-data");
|
|
}
|
|
|
|
g_free (inner_html_data);
|
|
@@ -668,9 +670,6 @@ mail_display_plugin_widget_requested (We
|
|
e_mail_part_attachment_get_expandable (empa));
|
|
|
|
if (e_mail_part_attachment_get_expandable (empa)) {
|
|
- CamelMimePart *mime_part;
|
|
- const CamelContentDisposition *disposition;
|
|
-
|
|
/* Show/hide the attachment when the EAttachmentButton
|
|
* is expanded/collapsed or shown/hidden. */
|
|
g_signal_connect (
|
|
@@ -682,20 +681,7 @@ mail_display_plugin_widget_requested (We
|
|
G_CALLBACK (attachment_button_expanded),
|
|
display);
|
|
|
|
- mime_part = e_mail_part_ref_mime_part (part);
|
|
-
|
|
- /* Automatically expand attachments that have inline
|
|
- * disposition or the EMailParts have specific
|
|
- * force_inline flag set. */
|
|
- disposition =
|
|
- camel_mime_part_get_content_disposition (mime_part);
|
|
- if (!part->force_collapse &&
|
|
- (part->force_inline ||
|
|
- (g_strcmp0 (empa->snoop_mime_type, "message/rfc822") == 0) ||
|
|
- (disposition && disposition->disposition &&
|
|
- g_ascii_strncasecmp (
|
|
- disposition->disposition, "inline", 6) == 0))) {
|
|
-
|
|
+ if (e_mail_part_should_show_inline (part)) {
|
|
e_attachment_button_set_expanded (
|
|
E_ATTACHMENT_BUTTON (widget), TRUE);
|
|
} else {
|
|
@@ -704,8 +690,6 @@ mail_display_plugin_widget_requested (We
|
|
attachment_button_expanded (
|
|
G_OBJECT (widget), NULL, display);
|
|
}
|
|
-
|
|
- g_object_unref (mime_part);
|
|
}
|
|
}
|
|
|