aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--em-format/e-mail-formatter-attachment-bar.c25
-rw-r--r--em-format/e-mail-formatter-attachment.c80
-rw-r--r--em-format/e-mail-formatter-error.c2
-rw-r--r--em-format/e-mail-formatter-image.c11
-rw-r--r--em-format/e-mail-formatter-print-headers.c30
-rw-r--r--em-format/e-mail-formatter-print.c51
-rw-r--r--em-format/e-mail-formatter-quote-attachment.c2
-rw-r--r--em-format/e-mail-formatter-quote-headers.c3
-rw-r--r--em-format/e-mail-formatter-quote.c7
-rw-r--r--em-format/e-mail-formatter-secure-button.c1
-rw-r--r--em-format/e-mail-formatter-utils.c4
-rw-r--r--em-format/e-mail-formatter.c8
-rw-r--r--em-format/e-mail-parser-attachment-bar.c4
-rw-r--r--em-format/e-mail-parser-message-external.c19
-rw-r--r--em-format/e-mail-parser-multipart-digest.c7
-rw-r--r--em-format/e-mail-parser-multipart-mixed.c8
-rw-r--r--em-format/e-mail-parser-text-plain.c8
-rw-r--r--em-format/e-mail-parser.c23
-rw-r--r--em-format/e-mail-part-attachment-bar.h14
-rw-r--r--em-format/e-mail-part-attachment.h14
-rw-r--r--em-format/e-mail-part-list.c22
-rw-r--r--em-format/e-mail-part.c11
-rw-r--r--em-format/e-mail-part.h16
-rw-r--r--mail/e-mail-display.c2
-rw-r--r--mail/e-mail-reader-utils.c3
-rw-r--r--mail/e-mail-request.c8
-rw-r--r--mail/em-utils.c21
-rw-r--r--mail/em-utils.h2
-rw-r--r--modules/audio-inline/evolution-module-audio-inline.c2
-rw-r--r--modules/itip-formatter/e-mail-formatter-itip.c3
-rw-r--r--modules/itip-formatter/e-mail-part-itip.h11
-rw-r--r--modules/text-highlight/e-mail-formatter-text-highlight.c70
-rw-r--r--modules/vcard-inline/e-mail-formatter-vcard-inline.c3
-rw-r--r--modules/vcard-inline/e-mail-part-vcard-inline.h3
-rw-r--r--modules/vcard-inline/evolution-module-vcard-inline.c2
35 files changed, 294 insertions, 206 deletions
diff --git a/em-format/e-mail-formatter-attachment-bar.c b/em-format/e-mail-formatter-attachment-bar.c
index f91500ed1d..61c1509cd1 100644
--- a/em-format/e-mail-formatter-attachment-bar.c
+++ b/em-format/e-mail-formatter-attachment-bar.c
@@ -64,17 +64,8 @@ emfe_attachment_bar_format (EMailFormatterExtension *extension,
camel_stream_write_string (stream, str, cancellable, NULL);
g_free (str);
- return TRUE;
-}
-static void
-unset_bar_from_store_data (GObject *store,
- EAttachmentBar *bar)
-{
- /*
- if (E_IS_ATTACHMENT_STORE (store))
- g_object_set_data (store, "attachment-bar", NULL);
- */
+ return TRUE;
}
static GtkWidget *
@@ -83,17 +74,15 @@ emfe_attachment_bar_get_widget (EMailFormatterExtension *extension,
EMailPart *part,
GHashTable *params)
{
- EMailPartAttachmentBar *empab;
+ EAttachmentStore *store;
GtkWidget *widget;
- g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartAttachmentBar), NULL);
+ g_return_val_if_fail (E_IS_MAIL_PART_ATTACHMENT_BAR (part), NULL);
+
+ store = E_MAIL_PART_ATTACHMENT_BAR (part)->store;
- empab = (EMailPartAttachmentBar *) part;
- widget = e_attachment_bar_new (empab->store);
- g_object_set_data (G_OBJECT (empab->store), "attachment-bar", widget);
- g_object_weak_ref (
- G_OBJECT (widget),
- (GWeakNotify) unset_bar_from_store_data, empab->store);
+ widget = e_attachment_bar_new (store);
+ g_object_set_data (G_OBJECT (store), "attachment-bar", widget);
return widget;
}
diff --git a/em-format/e-mail-formatter-attachment.c b/em-format/e-mail-formatter-attachment.c
index 54647edd4a..08b0da2042 100644
--- a/em-format/e-mail-formatter-attachment.c
+++ b/em-format/e-mail-formatter-attachment.c
@@ -44,22 +44,25 @@ G_DEFINE_TYPE (
E_TYPE_MAIL_FORMATTER_EXTENSION)
static const gchar *formatter_mime_types[] = {
- "application/vnd.evolution.attachment",
+ E_MAIL_PART_ATTACHMENT_MIME_TYPE,
"application/vnd.evolution.widget.attachment-button",
NULL
};
static EAttachmentStore *
find_attachment_store (EMailPartList *part_list,
- const gchar *start_id)
+ EMailPart *start)
{
EAttachmentStore *store = NULL;
GQueue queue = G_QUEUE_INIT;
GList *head, *link;
+ const gchar *start_id;
gchar *tmp, *pos;
EMailPart *part;
gchar *id;
+ start_id = start->id;
+
e_mail_part_list_queue_parts (part_list, NULL, &queue);
head = g_queue_peek_head_link (&queue);
@@ -94,7 +97,7 @@ find_attachment_store (EMailPartList *part_list,
g_free (tmp);
if (part != NULL)
- store = ((EMailPartAttachmentBar *) part)->store;
+ store = E_MAIL_PART_ATTACHMENT_BAR (part)->store;
while (!g_queue_is_empty (&queue))
e_mail_part_unref (g_queue_pop_head (&queue));
@@ -117,17 +120,21 @@ emfe_attachment_format (EMailFormatterExtension *extension,
GQueue *extensions;
EMailPartAttachment *empa;
CamelMimeFilterToHTMLFlags flags;
- gchar *attachment_part_id;
+ const gchar *attachment_part_id;
- g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartAttachment), FALSE);
+ g_return_val_if_fail (E_IS_MAIL_PART_ATTACHMENT (part), FALSE);
empa = (EMailPartAttachment *) part;
if ((context->mode == E_MAIL_FORMATTER_MODE_NORMAL) ||
(context->mode == E_MAIL_FORMATTER_MODE_PRINTING) ||
(context->mode == E_MAIL_FORMATTER_MODE_ALL_HEADERS)) {
+ EAttachment *attachment;
GList *head, *link;
+ attachment = g_object_ref (
+ E_MAIL_PART_ATTACHMENT (part)->attachment);
+
head = g_queue_peek_head_link (&part->validities);
for (link = head; link != NULL; link = g_list_next (link)) {
@@ -138,43 +145,45 @@ emfe_attachment_format (EMailFormatterExtension *extension,
if ((pair->validity_type & E_MAIL_PART_VALIDITY_SIGNED) != 0)
e_attachment_set_signed (
- empa->attachment,
+ attachment,
pair->validity->sign.status);
if ((pair->validity_type & E_MAIL_PART_VALIDITY_ENCRYPTED) != 0)
e_attachment_set_encrypted (
- empa->attachment,
+ attachment,
pair->validity->encrypt.status);
}
- store = find_attachment_store (context->part_list, part->id);
+ store = find_attachment_store (context->part_list, part);
if (store) {
GList *attachments = e_attachment_store_get_attachments (store);
- if (!g_list_find (attachments, empa->attachment)) {
+ if (!g_list_find (attachments, attachment)) {
e_attachment_store_add_attachment (
- store, empa->attachment);
+ store, attachment);
}
g_list_free (attachments);
} else {
g_warning ("Failed to locate attachment-bar for %s", part->id);
}
+
+ g_object_unref (attachment);
}
- /* If the attachment is requested as RAW, then call the handler directly
- * and do not append any other code. */
+ /* If the attachment is requested as RAW, then call the
+ * handler directly and do not append any other code. */
if ((context->mode == E_MAIL_FORMATTER_MODE_RAW) ||
(context->mode == E_MAIL_FORMATTER_MODE_PRINTING)) {
- EMailExtensionRegistry *reg;
+ EMailExtensionRegistry *registry;
GQueue *extensions;
GList *iter;
- reg = e_mail_formatter_get_extension_registry (formatter);
+
+ registry = e_mail_formatter_get_extension_registry (formatter);
extensions = e_mail_extension_registry_get_for_mime_type (
- reg, empa->snoop_mime_type);
- if (!extensions) {
+ registry, empa->snoop_mime_type);
+ if (extensions == NULL)
extensions = e_mail_extension_registry_get_fallback (
- reg, empa->snoop_mime_type);
- }
+ registry, empa->snoop_mime_type);
if (!extensions)
return FALSE;
@@ -184,23 +193,29 @@ emfe_attachment_format (EMailFormatterExtension *extension,
EAttachment *attachment;
GFileInfo *fi;
const gchar *description;
+ const gchar *display_name;
+
+ attachment = g_object_ref (
+ E_MAIL_PART_ATTACHMENT (part)->attachment);
- attachment = empa->attachment;
fi = e_attachment_get_file_info (attachment);
+ display_name = g_file_info_get_display_name (fi);
description = e_attachment_get_description (attachment);
if (description && *description) {
name = g_strdup_printf (
"<h2>Attachment: %s (%s)</h2>\n",
- description, g_file_info_get_display_name (fi));
+ description, display_name);
} else {
name = g_strdup_printf (
"<h2>Attachment: %s</h2>\n",
- g_file_info_get_display_name (fi));
+ display_name);
}
camel_stream_write_string (stream, name, cancellable, NULL);
g_free (name);
+
+ g_object_unref (attachment);
}
for (iter = g_queue_peek_head_link (extensions); iter; iter = iter->next) {
@@ -343,28 +358,35 @@ emfe_attachment_get_widget (EMailFormatterExtension *extension,
EMailPart *part,
GHashTable *params)
{
- EMailPartAttachment *empa;
+ EAttachment *attachment;
EAttachmentStore *store;
EAttachmentView *view;
GtkWidget *widget;
- g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartAttachment), NULL);
- empa = (EMailPartAttachment *) part;
+ g_return_val_if_fail (E_IS_MAIL_PART_ATTACHMENT (part), NULL);
+
+ attachment = g_object_ref (
+ E_MAIL_PART_ATTACHMENT (part)->attachment);
- store = find_attachment_store (context, part->id);
+ store = find_attachment_store (context, part);
widget = e_attachment_button_new ();
- g_object_set_data (G_OBJECT (widget), "uri", part->id);
+ g_object_set_data_full (
+ G_OBJECT (widget),
+ "uri", g_strdup (part->id),
+ (GDestroyNotify) g_free);
e_attachment_button_set_attachment (
- E_ATTACHMENT_BUTTON (widget), empa->attachment);
+ E_ATTACHMENT_BUTTON (widget), attachment);
+
view = g_object_get_data (G_OBJECT (store), "attachment-bar");
- if (view) {
+ if (view != NULL)
e_attachment_button_set_view (
E_ATTACHMENT_BUTTON (widget), view);
- }
gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_show (widget);
+ g_object_unref (attachment);
+
return widget;
}
diff --git a/em-format/e-mail-formatter-error.c b/em-format/e-mail-formatter-error.c
index d5fd64b50d..a329abfffd 100644
--- a/em-format/e-mail-formatter-error.c
+++ b/em-format/e-mail-formatter-error.c
@@ -54,7 +54,7 @@ emfe_error_format (EMailFormatterExtension *extension,
CamelDataWrapper *dw;
gchar *html;
- dw = camel_medium_get_content ((CamelMedium *) part->part);
+ dw = camel_medium_get_content (CAMEL_MEDIUM (part->part));
html = g_strdup_printf (
"<div class=\"part-container\" style=\""
diff --git a/em-format/e-mail-formatter-image.c b/em-format/e-mail-formatter-image.c
index 82c635827a..f69a59cdba 100644
--- a/em-format/e-mail-formatter-image.c
+++ b/em-format/e-mail-formatter-image.c
@@ -104,8 +104,8 @@ emfe_image_format (EMailFormatterExtension *extension,
}
} else {
-
gchar *buffer;
+ const gchar *mime_type;
if (!e_mail_formatter_get_animate_images (formatter)) {
@@ -121,11 +121,16 @@ emfe_image_format (EMailFormatterExtension *extension,
content = g_base64_encode ((guchar *) ba->data, ba->len);
}
+ mime_type = part->mime_type;
+ if (mime_type == NULL)
+ mime_type = "image/*";
+
/* The image is already base64-encrypted so we can directly
* paste it to the output */
buffer = g_strdup_printf (
- "<img src=\"data:%s;base64,%s\" style=\"max-width: 100%%;\" />",
- part->mime_type ? part->mime_type : "image/*", content);
+ "<img src=\"data:%s;base64,%s\" "
+ " style=\"max-width: 100%%;\" />",
+ mime_type, content);
camel_stream_write_string (stream, buffer, cancellable, NULL);
g_free (buffer);
diff --git a/em-format/e-mail-formatter-print-headers.c b/em-format/e-mail-formatter-print-headers.c
index 03d35c300c..b739d6ce96 100644
--- a/em-format/e-mail-formatter-print-headers.c
+++ b/em-format/e-mail-formatter-print-headers.c
@@ -87,7 +87,8 @@ emfpe_headers_format (EMailFormatterExtension *extension,
if (header->value && *header->value) {
raw_header.value = header->value;
- e_mail_formatter_format_header (formatter, str,
+ e_mail_formatter_format_header (
+ formatter, str,
CAMEL_MEDIUM (part->part), &raw_header,
header->flags | E_MAIL_FORMATTER_HEADER_FLAG_NOLINKS,
"UTF-8");
@@ -102,7 +103,8 @@ emfpe_headers_format (EMailFormatterExtension *extension,
raw_header.value = g_strdup (header_value);
if (raw_header.value && *raw_header.value) {
- e_mail_formatter_format_header (formatter, str,
+ e_mail_formatter_format_header (
+ formatter, str,
CAMEL_MEDIUM (part->part), &raw_header,
header->flags | E_MAIL_FORMATTER_HEADER_FLAG_NOLINKS,
"UTF-8");
@@ -115,7 +117,7 @@ emfpe_headers_format (EMailFormatterExtension *extension,
g_queue_free_full (headers_queue, (GDestroyNotify) e_mail_formatter_header_free);
- /* Get prefix of this PURI */
+ /* Get prefix of this PURI */
part_id_prefix = g_strndup (part->id, g_strrstr (part->id, ".") - part->id);
/* Add encryption/signature header */
@@ -164,7 +166,8 @@ emfpe_headers_format (EMailFormatterExtension *extension,
if (tmp->len > 0) {
raw_header.value = tmp->str;
e_mail_formatter_format_header (
- formatter, str, CAMEL_MEDIUM (part->part), &raw_header,
+ formatter, str,
+ CAMEL_MEDIUM (part->part), &raw_header,
E_MAIL_FORMATTER_HEADER_FLAG_BOLD |
E_MAIL_FORMATTER_HEADER_FLAG_NOLINKS, "UTF-8");
}
@@ -174,22 +177,29 @@ emfpe_headers_format (EMailFormatterExtension *extension,
attachments_count = 0;
for (link = head; link != NULL; link = g_list_next (link)) {
- EMailPart *mail_part = link->data;
+ EMailPart *mail_part = E_MAIL_PART (link->data);
if (!g_str_has_prefix (mail_part->id, part_id_prefix))
continue;
- if (mail_part->is_attachment && !mail_part->cid &&
- !mail_part->is_hidden) {
- attachments_count++;
- }
+ if (!mail_part->is_attachment)
+ continue;
+
+ if (mail_part->is_hidden)
+ continue;
+
+ if (mail_part->cid != NULL)
+ continue;
+
+ attachments_count++;
}
if (attachments_count > 0) {
raw_header.name = _("Attachments");
raw_header.value = g_strdup_printf ("%d", attachments_count);
e_mail_formatter_format_header (
- formatter, str, CAMEL_MEDIUM (part->part), &raw_header,
+ formatter, str,
+ CAMEL_MEDIUM (part->part), &raw_header,
E_MAIL_FORMATTER_HEADER_FLAG_BOLD |
E_MAIL_FORMATTER_HEADER_FLAG_NOLINKS, "UTF-8");
g_free (raw_header.value);
diff --git a/em-format/e-mail-formatter-print.c b/em-format/e-mail-formatter-print.c
index a2e19ed4bd..f73fc493cf 100644
--- a/em-format/e-mail-formatter-print.c
+++ b/em-format/e-mail-formatter-print.c
@@ -37,17 +37,12 @@ void e_mail_formatter_print_internal_extensions_load (EMailExtensionRegistry *er
static gpointer e_mail_formatter_print_parent_class = 0;
static void
-write_attachments_list (EMailFormatter *formatter,
- EMailFormatterContext *context,
- GSList *attachments,
- CamelStream *stream,
- GCancellable *cancellable)
+mail_formatter_print_write_attachments (EMailFormatter *formatter,
+ GQueue *attachments,
+ CamelStream *stream,
+ GCancellable *cancellable)
{
GString *str;
- GSList *link;
-
- if (attachments == NULL)
- return;
str = g_string_new (
"<table border=\"0\" cellspacing=\"5\" cellpadding=\"0\" "
@@ -58,21 +53,22 @@ write_attachments_list (EMailFormatter *formatter,
"<tr><th>%s</th><th>%s</th></tr>\n",
_("Attachments"), _("Name"), _("Size"));
- for (link = attachments; link != NULL; link = g_slist_next (link)) {
- EMailPartAttachment *part = link->data;
+ while (!g_queue_is_empty (attachments)) {
+ EMailPartAttachment *part;
EAttachment *attachment;
GFileInfo *file_info;
gchar *name, *size;
const gchar *description;
const gchar *display_name;
- if (part == NULL)
- continue;
+ part = g_queue_pop_head (attachments);
+ attachment = g_object_ref (part->attachment);
- attachment = part->attachment;
file_info = e_attachment_get_file_info (attachment);
- if (file_info == NULL)
+ if (file_info == NULL) {
+ g_object_unref (attachment);
continue;
+ }
description = e_attachment_get_description (attachment);
display_name = g_file_info_get_display_name (file_info);
@@ -92,6 +88,8 @@ write_attachments_list (EMailFormatter *formatter,
g_free (name);
g_free (size);
+
+ g_object_unref (attachment);
}
g_string_append (str, "</table>\n");
@@ -108,8 +106,8 @@ mail_formatter_print_run (EMailFormatter *formatter,
GCancellable *cancellable)
{
GQueue queue = G_QUEUE_INIT;
+ GQueue attachments = G_QUEUE_INIT;
GList *head, *link;
- GSList *attachments;
context->mode = E_MAIL_FORMATTER_MODE_PRINTING;
@@ -126,14 +124,13 @@ mail_formatter_print_run (EMailFormatter *formatter,
"<body style=\"background: #FFF; color: #000;\">",
cancellable, NULL);
- attachments = NULL;
-
e_mail_part_list_queue_parts (context->part_list, NULL, &queue);
head = g_queue_peek_head_link (&queue);
for (link = head; link != NULL; link = g_list_next (link)) {
- EMailPart *part = link->data;
+ EMailPart *part = E_MAIL_PART (link->data);
+ const gchar *mime_type;
gboolean ok;
if (g_cancellable_is_cancelled (cancellable))
@@ -147,19 +144,20 @@ mail_formatter_print_run (EMailFormatter *formatter,
continue;
}
- if (part->mime_type == NULL)
+ mime_type = part->mime_type;
+ if (mime_type == NULL)
continue;
if (part->is_attachment) {
if (part->cid != NULL)
continue;
- attachments = g_slist_append (attachments, part);
+ g_queue_push_tail (&attachments, part);
}
ok = e_mail_formatter_format_as (
formatter, context, part, stream,
- part->mime_type, cancellable);
+ mime_type, cancellable);
/* If the written part was message/rfc822 then
* jump to the end of the message, because content
@@ -175,10 +173,11 @@ mail_formatter_print_run (EMailFormatter *formatter,
while (!g_queue_is_empty (&queue))
e_mail_part_unref (g_queue_pop_head (&queue));
- write_attachments_list (
- formatter, context, attachments, stream, cancellable);
-
- g_slist_free (attachments);
+ /* This consumes the attachments queue. */
+ if (!g_queue_is_empty (&attachments))
+ mail_formatter_print_write_attachments (
+ formatter, &attachments,
+ stream, cancellable);
camel_stream_write_string (stream, "</body></html>", cancellable, NULL);
}
diff --git a/em-format/e-mail-formatter-quote-attachment.c b/em-format/e-mail-formatter-quote-attachment.c
index fd44249819..6f5068bae1 100644
--- a/em-format/e-mail-formatter-quote-attachment.c
+++ b/em-format/e-mail-formatter-quote-attachment.c
@@ -43,7 +43,7 @@ G_DEFINE_TYPE (
E_TYPE_MAIL_FORMATTER_QUOTE_EXTENSION)
static const gchar *formatter_mime_types[] = {
- "application/vnd.evolution.attachment",
+ E_MAIL_PART_ATTACHMENT_MIME_TYPE,
NULL
};
diff --git a/em-format/e-mail-formatter-quote-headers.c b/em-format/e-mail-formatter-quote-headers.c
index ce4fd785fa..fa6c02752b 100644
--- a/em-format/e-mail-formatter-quote-headers.c
+++ b/em-format/e-mail-formatter-quote-headers.c
@@ -219,7 +219,8 @@ emqfe_headers_format (EMailFormatterExtension *extension,
if (g_strcmp0 (raw_header->name, h->name) == 0) {
emfqe_format_header (
- formatter, buffer, (CamelMedium *) part->part,
+ formatter, buffer,
+ (CamelMedium *) part->part,
raw_header, flags, charset);
break;
}
diff --git a/em-format/e-mail-formatter-quote.c b/em-format/e-mail-formatter-quote.c
index c8f83860ee..f810f231a7 100644
--- a/em-format/e-mail-formatter-quote.c
+++ b/em-format/e-mail-formatter-quote.c
@@ -103,7 +103,7 @@ mail_formatter_quote_run (EMailFormatter *formatter,
head = g_queue_peek_head_link (&queue);
for (link = head; link != NULL; link = g_list_next (link)) {
- EMailPart *part = link->data;
+ EMailPart *part = E_MAIL_PART (link->data);
if (g_str_has_suffix (part->id, ".headers") &&
!(qf_context->qf_flags & E_MAIL_FORMATTER_QUOTE_FLAG_HEADERS)) {
@@ -115,7 +115,10 @@ mail_formatter_quote_run (EMailFormatter *formatter,
continue;
}
- if (part->is_hidden || part->is_attachment)
+ if (part->is_hidden)
+ continue;
+
+ if (part->is_attachment)
continue;
e_mail_formatter_format_as (
diff --git a/em-format/e-mail-formatter-secure-button.c b/em-format/e-mail-formatter-secure-button.c
index 442a6d3e26..83e88d5752 100644
--- a/em-format/e-mail-formatter-secure-button.c
+++ b/em-format/e-mail-formatter-secure-button.c
@@ -93,6 +93,7 @@ emfe_secure_button_format (EMailFormatterExtension *extension,
camel_stream_write_string (stream, str, cancellable, NULL);
g_free (str);
+
return TRUE;
}
diff --git a/em-format/e-mail-formatter-utils.c b/em-format/e-mail-formatter-utils.c
index d5bff2ecd0..775ef1d6cc 100644
--- a/em-format/e-mail-formatter-utils.c
+++ b/em-format/e-mail-formatter-utils.c
@@ -474,13 +474,13 @@ e_mail_formatter_find_rfc822_end_iter (GList *rfc822_start_iter)
g_return_val_if_fail (rfc822_start_iter != NULL, NULL);
- part = (EMailPart *) link->data;
+ part = E_MAIL_PART (link->data);
g_return_val_if_fail (part != NULL, NULL);
end = g_strconcat (part->id, ".end", NULL);
while (link != NULL) {
- part = (EMailPart *) link->data;
+ part = E_MAIL_PART (link->data);
g_return_val_if_fail (part != NULL, NULL);
if (g_strcmp0 (part->id, end) == 0)
diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c
index 4bc8dcd7fd..ad203d83ad 100644
--- a/em-format/e-mail-formatter.c
+++ b/em-format/e-mail-formatter.c
@@ -1035,16 +1035,18 @@ e_mail_formatter_format_text (EMailFormatter *formatter,
CamelMimeFilter *windows = NULL;
CamelStream *mem_stream = NULL;
CamelDataWrapper *dw;
+ CamelContentType *mime_type;
if (g_cancellable_is_cancelled (cancellable))
return;
dw = CAMEL_DATA_WRAPPER (part->part);
+ mime_type = dw->mime_type;
- if (formatter->priv->charset) {
+ if (formatter->priv->charset != NULL) {
charset = formatter->priv->charset;
- } else if (dw->mime_type
- && (charset = camel_content_type_param (dw->mime_type, "charset"))
+ } else if (mime_type != NULL
+ && (charset = camel_content_type_param (mime_type, "charset"))
&& g_ascii_strncasecmp (charset, "iso-8859-", 9) == 0) {
CamelStream *null;
diff --git a/em-format/e-mail-parser-attachment-bar.c b/em-format/e-mail-parser-attachment-bar.c
index 5e36b83b6f..1ceebe577c 100644
--- a/em-format/e-mail-parser-attachment-bar.c
+++ b/em-format/e-mail-parser-attachment-bar.c
@@ -49,7 +49,7 @@ G_DEFINE_TYPE (
E_TYPE_MAIL_PARSER_EXTENSION)
static const gchar *parser_mime_types[] = {
- "application/vnd.evolution.widget.attachment-bar",
+ E_MAIL_PART_ATTACHMENT_BAR_MIME_TYPE,
NULL
};
@@ -69,7 +69,7 @@ empe_attachment_bar_parse (EMailParserExtension *extension,
empab = (EMailPartAttachmentBar *) e_mail_part_subclass_new (
part, part_id->str, sizeof (EMailPartAttachmentBar),
(GFreeFunc) mail_part_attachment_bar_free);
- empab->parent.mime_type = g_strdup ("application/vnd.evolution.widget.attachment-bar");
+ empab->parent.mime_type = g_strdup (parser_mime_types[0]);
empab->store = E_ATTACHMENT_STORE (e_attachment_store_new ());
g_string_truncate (part_id, len);
diff --git a/em-format/e-mail-parser-message-external.c b/em-format/e-mail-parser-message-external.c
index 32ba0515dd..1868796884 100644
--- a/em-format/e-mail-parser-message-external.c
+++ b/em-format/e-mail-parser-message-external.c
@@ -55,10 +55,10 @@ empe_msg_external_parse (EMailParserExtension *extension,
CamelMimePart *newpart;
CamelContentType *type;
const gchar *access_type;
+ const gchar *mime_type;
gchar *url = NULL, *desc = NULL;
gchar *content;
gint len;
- gchar *mime_type;
newpart = camel_mime_part_new ();
@@ -67,8 +67,9 @@ empe_msg_external_parse (EMailParserExtension *extension,
access_type = camel_content_type_param (type, "access-type");
if (!access_type) {
const gchar *msg = _("Malformed external-body part");
- mime_type = g_strdup ("text/plain");
- camel_mime_part_set_content (newpart, msg, strlen (msg), mime_type);
+ mime_type = "text/plain";
+ camel_mime_part_set_content (
+ newpart, msg, strlen (msg), mime_type);
goto addPart;
}
@@ -135,9 +136,10 @@ empe_msg_external_parse (EMailParserExtension *extension,
goto fail;
}
- mime_type = g_strdup ("text/html");
+ mime_type = "text/html";
content = g_strdup_printf ("<a href=\"%s\">%s</a>", url, desc);
- camel_mime_part_set_content (newpart, content, strlen (content), mime_type);
+ camel_mime_part_set_content (
+ newpart, content, strlen (content), mime_type);
g_free (content);
g_free (url);
@@ -149,15 +151,16 @@ fail:
content = g_strdup_printf (
_("Pointer to unknown external data (\"%s\" type)"),
access_type);
- mime_type = g_strdup ("text/plain");
- camel_mime_part_set_content (newpart, content, strlen (content), mime_type);
+ mime_type = "text/plain";
+ camel_mime_part_set_content (
+ newpart, content, strlen (content), mime_type);
g_free (content);
addPart:
len = part_id->len;
g_string_append (part_id, ".msg_external");
mail_part = e_mail_part_new (part, part_id->str);
- mail_part->mime_type = mime_type;
+ mail_part->mime_type = g_strdup (mime_type);
g_string_truncate (part_id, len);
g_queue_push_tail (out_mail_parts, mail_part);
diff --git a/em-format/e-mail-parser-multipart-digest.c b/em-format/e-mail-parser-multipart-digest.c
index 5d33103b1e..8cf80be00f 100644
--- a/em-format/e-mail-parser-multipart-digest.c
+++ b/em-format/e-mail-parser-multipart-digest.c
@@ -88,6 +88,7 @@ empe_mp_digest_parse (EMailParserExtension *extension,
} else {
GQueue work_queue = G_QUEUE_INIT;
EMailPart *mail_part;
+ gboolean wrap_as_attachment;
e_mail_parser_parse_part_as (
parser, subpart, part_id, "message/rfc822",
@@ -95,8 +96,12 @@ empe_mp_digest_parse (EMailParserExtension *extension,
mail_part = g_queue_peek_head (&work_queue);
+ wrap_as_attachment =
+ (mail_part != NULL) &&
+ !mail_part->is_attachment;
+
/* Force the message to be collapsable */
- if (mail_part != NULL && !mail_part->is_attachment)
+ if (wrap_as_attachment)
e_mail_parser_wrap_as_attachment (
parser, subpart, part_id, &work_queue);
diff --git a/em-format/e-mail-parser-multipart-mixed.c b/em-format/e-mail-parser-multipart-mixed.c
index 1d14fced68..5b8f9c1d7f 100644
--- a/em-format/e-mail-parser-multipart-mixed.c
+++ b/em-format/e-mail-parser-multipart-mixed.c
@@ -89,15 +89,17 @@ empe_mp_mixed_parse (EMailParserExtension *extension,
* not multipart/related. */
if (mail_part != NULL &&
mail_part->cid != NULL &&
- (!mail_part->is_attachment || mail_part->is_hidden)) {
+ (!mail_part->is_attachment ||
+ mail_part->is_hidden)) {
e_mail_parser_wrap_as_attachment (
parser, subpart, part_id, &work_queue);
- /* Force messages to be expandable */
+ /* Force messages to be expandable */
} else if (mail_part == NULL ||
(camel_content_type_is (ct, "message", "rfc822") &&
- mail_part != NULL && !mail_part->is_attachment)) {
+ mail_part != NULL &&
+ !mail_part->is_attachment)) {
e_mail_parser_wrap_as_attachment (
parser, subpart, part_id, &work_queue);
diff --git a/em-format/e-mail-parser-text-plain.c b/em-format/e-mail-parser-text-plain.c
index b6cd0ec6ca..24b4b24344 100644
--- a/em-format/e-mail-parser-text-plain.c
+++ b/em-format/e-mail-parser-text-plain.c
@@ -78,7 +78,7 @@ process_part (EMailParser *parser,
GQueue *out_mail_parts)
{
CamelContentType *type;
- EMailPart *empart;
+ EMailPart *mail_part;
gint s_len = part_id->len;
if (part_is_empty (part))
@@ -95,12 +95,12 @@ process_part (EMailParser *parser,
g_string_append_printf (part_id, ".plain_text.%d", part_number);
- empart = e_mail_part_new (part, part_id->str);
- empart->mime_type = camel_content_type_simple (type);
+ mail_part = e_mail_part_new (part, part_id->str);
+ mail_part->mime_type = camel_content_type_simple (type);
g_string_truncate (part_id, s_len);
- g_queue_push_tail (&work_queue, empart);
+ g_queue_push_tail (&work_queue, mail_part);
if (is_attachment)
e_mail_parser_wrap_as_attachment (
diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c
index 294b058766..174d88ca69 100644
--- a/em-format/e-mail-parser.c
+++ b/em-format/e-mail-parser.c
@@ -356,12 +356,16 @@ e_mail_parser_parse_sync (EMailParser *parser,
e_mail_part_list_queue_parts (part_list, NULL, &queue);
while (!g_queue_is_empty (&queue)) {
- EMailPart *part = g_queue_pop_head (&queue);
+ EMailPart *part;
+
+ part = g_queue_pop_head (&queue);
printf (
" id: %s | cid: %s | mime_type: %s | "
"is_hidden: %d | is_attachment: %d\n",
- part->id, part->cid, part->mime_type,
+ part->id,
+ part->cid,
+ part->mime_type,
part->is_hidden ? 1 : 0,
part->is_attachment ? 1 : 0);
@@ -456,12 +460,16 @@ e_mail_parser_parse_finish (EMailParser *parser,
e_mail_part_list_queue_parts (part_list, NULL, &queue);
while (!g_queue_is_empty (&queue)) {
- EMailPart *part = g_queue_pop_head (&queue);
+ EMailPart *part;
+
+ part = g_queue_pop_head (&queue);
printf (
" id: %s | cid: %s | mime_type: %s | "
"is_hidden: %d | is_attachment: %d\n",
- part->id, part->cid, part->mime_type,
+ part->id,
+ part->cid,
+ part->mime_type,
part->is_hidden ? 1 : 0,
part->is_attachment ? 1 : 0);
@@ -567,6 +575,7 @@ e_mail_parser_error (EMailParser *parser,
const gchar *format,
...)
{
+ const gchar *mime_type = "application/vnd.evolution.error";
EMailPart *mail_part;
CamelMimePart *part;
gchar *errmsg;
@@ -582,9 +591,7 @@ e_mail_parser_error (EMailParser *parser,
part = camel_mime_part_new ();
camel_mime_part_set_content (
- part,
- errmsg, strlen (errmsg),
- "application/vnd.evolution.error");
+ part, errmsg, strlen (errmsg), mime_type);
g_free (errmsg);
va_end (ap);
@@ -594,7 +601,7 @@ e_mail_parser_error (EMailParser *parser,
g_mutex_unlock (&parser->priv->mutex);
mail_part = e_mail_part_new (part, uri);
- mail_part->mime_type = g_strdup ("application/vnd.evolution.error");
+ mail_part->mime_type = g_strdup (mime_type);
mail_part->is_error = TRUE;
g_free (uri);
diff --git a/em-format/e-mail-part-attachment-bar.h b/em-format/e-mail-part-attachment-bar.h
index 87b6311b5d..38e644f801 100644
--- a/em-format/e-mail-part-attachment-bar.h
+++ b/em-format/e-mail-part-attachment-bar.h
@@ -1,4 +1,6 @@
/*
+ * e-mail-part-attachment-bar.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -17,12 +19,16 @@
#ifndef E_MAIL_PART_ATTACHMENT_BAR_H
#define E_MAIL_PART_ATTACHMENT_BAR_H
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <em-format/e-mail-part.h>
+#define E_MAIL_PART_ATTACHMENT_BAR(part) \
+ ((EMailPartAttachmentBar *) part)
+#define E_IS_MAIL_PART_ATTACHMENT_BAR(part) \
+ (E_MAIL_PART_IS (part, EMailPartAttachmentBar))
+
+#define E_MAIL_PART_ATTACHMENT_BAR_MIME_TYPE \
+ "application/vnd.evolution.widget.attachment-bar"
+
typedef struct _EMailPartAttachmentBar {
EMailPart parent;
diff --git a/em-format/e-mail-part-attachment.h b/em-format/e-mail-part-attachment.h
index cd07e3634b..d44c599e4c 100644
--- a/em-format/e-mail-part-attachment.h
+++ b/em-format/e-mail-part-attachment.h
@@ -1,4 +1,6 @@
/*
+ * e-mail-part-attachment.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -17,13 +19,15 @@
#ifndef E_MAIL_PART_ATTACHMENT_H
#define E_MAIL_PART_ATTACHMENT_H
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <em-format/e-mail-part.h>
-#define E_MAIL_PART_ATTACHMENT(p) ((EMailPartAttachment *) p)
+#define E_MAIL_PART_ATTACHMENT(part) \
+ ((EMailPartAttachment *) part)
+#define E_IS_MAIL_PART_ATTACHMENT(part) \
+ (E_MAIL_PART_IS (part, EMailPartAttachment))
+
+#define E_MAIL_PART_ATTACHMENT_MIME_TYPE \
+ "application/vnd.evolution.attachment"
G_BEGIN_DECLS
diff --git a/em-format/e-mail-part-list.c b/em-format/e-mail-part-list.c
index 641a88c947..e6ccc5733b 100644
--- a/em-format/e-mail-part-list.c
+++ b/em-format/e-mail-part-list.c
@@ -318,15 +318,16 @@ e_mail_part_list_ref_part (EMailPartList *part_list,
head = g_queue_peek_head_link (&part_list->priv->queue);
for (link = head; link != NULL; link = g_list_next (link)) {
- EMailPart *part = link->data;
+ EMailPart *candidate = E_MAIL_PART (link->data);
+ const gchar *candidate_id;
- if (by_cid && (g_strcmp0 (part->cid, part_id) == 0)) {
- match = e_mail_part_ref (part);
- break;
- }
+ if (by_cid)
+ candidate_id = candidate->cid;
+ else
+ candidate_id = candidate->id;
- if (!by_cid && (g_strcmp0 (part->id, part_id) == 0)) {
- match = e_mail_part_ref (part);
+ if (g_strcmp0 (candidate_id, part_id) == 0) {
+ match = e_mail_part_ref (candidate);
break;
}
}
@@ -368,9 +369,12 @@ e_mail_part_list_queue_parts (EMailPartList *part_list,
if (part_id != NULL) {
for (; link != NULL; link = g_list_next (link)) {
- EMailPart *part = link->data;
+ EMailPart *candidate = E_MAIL_PART (link->data);
+ const gchar *candidate_id;
+
+ candidate_id = candidate->id;
- if (g_strcmp0 (part->id, part_id) == 0)
+ if (g_strcmp0 (candidate_id, part_id) == 0)
break;
}
}
diff --git a/em-format/e-mail-part.c b/em-format/e-mail-part.c
index 9e280e07bf..5b39e0a8f5 100644
--- a/em-format/e-mail-part.c
+++ b/em-format/e-mail-part.c
@@ -16,10 +16,6 @@
*
*/
-#include <camel/camel.h>
-
-#include "e-mail-part.h"
-
/**
* EMailPart:
*
@@ -28,10 +24,13 @@
*
* #EMailPart is not GObject-based, but has a simple reference counting.
*
- * Each #EMailPart must have a unique ID. The ID is a dot-separated hierarchical
- * description of the location of the part within the email message.
+ * Each #EMailPart must have a unique ID. The ID is a dot-separated
+ * hierarchical description of the location of the part within the email
+ * message.
*/
+#include "e-mail-part.h"
+
struct _EMailPartPrivate {
guint ref_cnt;
gsize instance_size;
diff --git a/em-format/e-mail-part.h b/em-format/e-mail-part.h
index 3d59d46087..9131e7fbdb 100644
--- a/em-format/e-mail-part.h
+++ b/em-format/e-mail-part.h
@@ -16,8 +16,8 @@
*
*/
-#ifndef E_MAIL_PART_H_
-#define E_MAIL_PART_H_
+#ifndef E_MAIL_PART_H
+#define E_MAIL_PART_H
#include <camel/camel.h>
#include <webkit/webkitdom.h>
@@ -37,11 +37,11 @@ typedef void (*EMailPartDOMBindFunc) (EMailPart *part,
WebKitDOMElement *element);
typedef enum {
- E_MAIL_PART_VALIDITY_NONE = 0,
- E_MAIL_PART_VALIDITY_PGP = 1 << 0,
- E_MAIL_PART_VALIDITY_SMIME = 1 << 1,
- E_MAIL_PART_VALIDITY_SIGNED = 1 << 2,
- E_MAIL_PART_VALIDITY_ENCRYPTED = 1 << 3
+ E_MAIL_PART_VALIDITY_NONE = 0,
+ E_MAIL_PART_VALIDITY_PGP = 1 << 0,
+ E_MAIL_PART_VALIDITY_SMIME = 1 << 1,
+ E_MAIL_PART_VALIDITY_SIGNED = 1 << 2,
+ E_MAIL_PART_VALIDITY_ENCRYPTED = 1 << 3
} EMailPartValidityFlags;
typedef struct _EMailPartValidityPair EMailPartValidityPair;
@@ -104,4 +104,4 @@ CamelCipherValidity *
G_END_DECLS
-#endif /* E_MAIL_PART_H_ */
+#endif /* E_MAIL_PART_H */
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 775936341e..00c5d2df4f 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1200,7 +1200,7 @@ mail_parts_bind_dom (GObject *object,
head = g_queue_peek_head_link (&queue);
for (link = head; link != NULL; link = g_list_next (link)) {
- EMailPart *part = link->data;
+ EMailPart *part = E_MAIL_PART (link->data);
/* Iterate only the parts rendered in
* the frame and all it's subparts. */
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index f495c664a1..79945dc7a1 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -1329,7 +1329,8 @@ e_mail_reader_reply_to_message (EMailReader *reader,
gchar *mail_uri;
CamelObjectBag *registry;
EMsgComposer *composer;
- guint32 validity_pgp_sum = 0, validity_smime_sum = 0;
+ EMailPartValidityFlags validity_pgp_sum = 0;
+ EMailPartValidityFlags validity_smime_sum = 0;
/* This handles quoting only selected text in the reply. If
* nothing is selected or only whitespace is selected, fall
diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c
index a4e229f94f..69b9a13533 100644
--- a/mail/e-mail-request.c
+++ b/mail/e-mail-request.c
@@ -156,9 +156,13 @@ handle_mail_request (GSimpleAsyncResult *res,
g_object_unref (raw_content);
} else {
+ if (mime_type == NULL)
+ mime_type = part->mime_type;
+
e_mail_formatter_format_as (
- formatter, &context, part, request->priv->output_stream,
- mime_type ? mime_type : part->mime_type, cancellable);
+ formatter, &context, part,
+ request->priv->output_stream,
+ mime_type, cancellable);
}
e_mail_part_unref (part);
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 470020415c..8e7d48bd19 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1211,10 +1211,21 @@ is_only_text_part_in_this_level (GList *parts,
level_len = dot - text_html_part->id;
for (iter = parts; iter; iter = iter->next) {
- EMailPart *part = iter->data;
+ EMailPart *part = E_MAIL_PART (iter->data);
- if (!part || !part->mime_type || part == text_html_part ||
- part->is_hidden || part->is_attachment)
+ if (part == NULL)
+ continue;
+
+ if (part == text_html_part)
+ continue;
+
+ if (part->is_hidden)
+ continue;
+
+ if (part->is_attachment)
+ continue;
+
+ if (part->mime_type == NULL)
continue;
dot = strrchr (part->id, '.');
@@ -1253,7 +1264,7 @@ em_utils_message_to_html (CamelSession *session,
guint32 flags,
EMailPartList *parts_list,
const gchar *append,
- guint32 *validity_found)
+ EMailPartValidityFlags *validity_found)
{
EMailFormatter *formatter;
EMailParser *parser = NULL;
@@ -1262,7 +1273,7 @@ em_utils_message_to_html (CamelSession *session,
EShell *shell;
GtkWindow *window;
EMailPart *hidden_text_html_part = NULL;
- guint32 is_validity_found = 0;
+ EMailPartValidityFlags is_validity_found = 0;
GQueue queue = G_QUEUE_INIT;
GList *head, *link;
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 1fe83077a1..c7ce5c90b4 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -72,7 +72,7 @@ gchar * em_utils_message_to_html (CamelSession *session,
guint32 flags,
struct _EMailPartList *parts_list,
const gchar *append,
- guint32 *validity_found);
+ EMailPartValidityFlags *validity_found);
void em_utils_empty_trash (GtkWidget *parent,
EMailSession *session);
diff --git a/modules/audio-inline/evolution-module-audio-inline.c b/modules/audio-inline/evolution-module-audio-inline.c
index b5dffb183e..297c5b6ffe 100644
--- a/modules/audio-inline/evolution-module-audio-inline.c
+++ b/modules/audio-inline/evolution-module-audio-inline.c
@@ -28,8 +28,6 @@ const gchar * g_module_check_init (GModule *module);
G_MODULE_EXPORT void
e_module_load (GTypeModule *type_module)
{
- /* Register dynamically loaded types. */
-
e_mail_parser_audio_inline_type_register (type_module);
e_mail_formatter_audio_inline_type_register (type_module);
}
diff --git a/modules/itip-formatter/e-mail-formatter-itip.c b/modules/itip-formatter/e-mail-formatter-itip.c
index a97e70d0bd..02ae152718 100644
--- a/modules/itip-formatter/e-mail-formatter-itip.c
+++ b/modules/itip-formatter/e-mail-formatter-itip.c
@@ -62,7 +62,8 @@ emfe_itip_format (EMailFormatterExtension *extension,
GString *buffer;
EMailPartItip *itip_part;
- g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartItip), FALSE);
+ g_return_val_if_fail (E_IS_MAIL_PART_ITIP (part), FALSE);
+
itip_part = (EMailPartItip *) part;
if (context->mode == E_MAIL_FORMATTER_MODE_PRINTING) {
diff --git a/modules/itip-formatter/e-mail-part-itip.h b/modules/itip-formatter/e-mail-part-itip.h
index ac56234f23..78004bca96 100644
--- a/modules/itip-formatter/e-mail-part-itip.h
+++ b/modules/itip-formatter/e-mail-part-itip.h
@@ -1,4 +1,6 @@
/*
+ * e-mail-part-itip.h
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -17,10 +19,6 @@
#ifndef E_MAIL_PART_ITIP_H
#define E_MAIL_PART_ITIP_H
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
#include <libecal/libecal.h>
#include <libebackend/libebackend.h>
@@ -28,7 +26,10 @@
#include "itip-view.h"
-#define E_MAIL_PART_ITIP(p) ((EMailPartItip *) p)
+#define E_MAIL_PART_ITIP(part) \
+ ((EMailPartItip *) part)
+#define E_IS_MAIL_PART_ITIP(part) \
+ (E_MAIL_PART_IS (part, EMailPartItip))
G_BEGIN_DECLS
diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c
index d4ef3693f1..286e356c51 100644
--- a/modules/text-highlight/e-mail-formatter-text-highlight.c
+++ b/modules/text-highlight/e-mail-formatter-text-highlight.c
@@ -85,10 +85,12 @@ get_syntax (EMailPart *part,
(ct != NULL &&
(camel_content_type_is (ct, "application", "octet-stream") ||
(camel_content_type_is (ct, "text", "plain"))))) {
- const gchar *filename = camel_mime_part_get_filename (part->part);
- if (filename) {
+ const gchar *filename;
+
+ filename = camel_mime_part_get_filename (part->part);
+ if (filename != NULL) {
gchar *ext = g_strrstr (filename, ".");
- if (ext) {
+ if (ext != NULL) {
syntax = (gchar *) get_syntax_for_ext (ext + 1);
syntax = syntax ? g_strdup (syntax) : NULL;
}
@@ -111,26 +113,32 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
CamelStream *stream,
GCancellable *cancellable)
{
+ CamelContentType *ct;
+ gboolean success = FALSE;
+
+ ct = camel_mime_part_get_content_type (part->part);
+
/* Don't format text/html unless it's an attachment */
- CamelContentType *ct = camel_mime_part_get_content_type (part->part);
if (ct && camel_content_type_is (ct, "text", "html")) {
const CamelContentDisposition *disp;
+
disp = camel_mime_part_get_content_disposition (part->part);
- if (!disp || g_strcmp0 (disp->disposition, "attachment") != 0)
- return FALSE;
+ if (disp == NULL)
+ goto exit;
+
+ if (g_strcmp0 (disp->disposition, "attachment") != 0)
+ goto exit;
}
if (context->mode == E_MAIL_FORMATTER_MODE_PRINTING) {
-
CamelDataWrapper *dw;
CamelStream *filter_stream;
CamelMimeFilter *mime_filter;
dw = camel_medium_get_content (CAMEL_MEDIUM (part->part));
- if (!dw) {
- return FALSE;
- }
+ if (dw == NULL)
+ goto exit;
camel_stream_write_string (
stream, "<pre><div class=\"pre\">", cancellable, NULL);
@@ -152,8 +160,6 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
camel_stream_write_string (
stream, "</div></pre>", cancellable, NULL);
- return TRUE;
-
} else if (context->mode == E_MAIL_FORMATTER_MODE_RAW) {
gint pipe_stdin, pipe_stdout;
GPid pid;
@@ -162,30 +168,29 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
PangoFontDescription *fd;
GSettings *settings;
gchar *font = NULL;
- gboolean success;
-
- const gchar *argv[] = { HIGHLIGHT_COMMAND,
- NULL, /* --font= */
- NULL, /* --font-size= */
- NULL, /* --syntax= */
- "--out-format=html",
- "--include-style",
- "--inline-css",
- "--style=bclear",
- "--failsafe",
- NULL };
+
+ const gchar *argv[] = {
+ HIGHLIGHT_COMMAND,
+ NULL, /* --font= */
+ NULL, /* --font-size= */
+ NULL, /* --syntax= */
+ "--out-format=html",
+ "--include-style",
+ "--inline-css",
+ "--style=bclear",
+ "--failsafe",
+ NULL };
dw = camel_medium_get_content (CAMEL_MEDIUM (part->part));
- if (!dw) {
- return FALSE;
- }
+ if (dw == NULL)
+ goto exit;
syntax = get_syntax (part, context->uri);
/* Use the traditional text/plain formatter for plain-text */
if (g_strcmp0 (syntax, "txt") == 0) {
g_free (syntax);
- return FALSE;
+ goto exit;
}
settings = g_settings_new ("org.gnome.evolution.mail");
@@ -267,8 +272,8 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
g_free (font_size);
g_free ((gchar *) argv[3]);
pango_font_description_free (fd);
+ goto exit;
- return FALSE;
} else {
/* In case of any other content, force use of
* text/plain formatter, because returning FALSE
@@ -286,6 +291,7 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
g_free (font_size);
g_free ((gchar *) argv[3]);
pango_font_description_free (fd);
+
} else {
CamelFolder *folder;
const gchar *message_uid;
@@ -336,10 +342,12 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
g_free (str);
g_free (uri);
-
}
- return TRUE;
+ success = TRUE;
+
+exit:
+ return success;
}
static void
diff --git a/modules/vcard-inline/e-mail-formatter-vcard-inline.c b/modules/vcard-inline/e-mail-formatter-vcard-inline.c
index bcced23351..f2ab3cc179 100644
--- a/modules/vcard-inline/e-mail-formatter-vcard-inline.c
+++ b/modules/vcard-inline/e-mail-formatter-vcard-inline.c
@@ -66,7 +66,8 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension,
{
EMailPartVCardInline *vcard_part;
- g_return_val_if_fail (E_MAIL_PART_IS (part, EMailPartVCardInline), FALSE);
+ g_return_val_if_fail (E_IS_MAIL_PART_VCARD (part), FALSE);
+
vcard_part = (EMailPartVCardInline *) part;
if (context->mode == E_MAIL_FORMATTER_MODE_RAW) {
diff --git a/modules/vcard-inline/e-mail-part-vcard-inline.h b/modules/vcard-inline/e-mail-part-vcard-inline.h
index 8272d2f672..b74dd76d1d 100644
--- a/modules/vcard-inline/e-mail-part-vcard-inline.h
+++ b/modules/vcard-inline/e-mail-part-vcard-inline.h
@@ -24,6 +24,9 @@
#include <addressbook/gui/widgets/eab-contact-formatter.h>
#include <webkit/webkitdom.h>
+#define E_IS_MAIL_PART_VCARD(part) \
+ (E_MAIL_PART_IS (part, EMailPartVCardInline))
+
G_BEGIN_DECLS
typedef struct _EMailPartVCardInline EMailPartVCardInline;
diff --git a/modules/vcard-inline/evolution-module-vcard-inline.c b/modules/vcard-inline/evolution-module-vcard-inline.c
index 4e95aba312..bb1196e865 100644
--- a/modules/vcard-inline/evolution-module-vcard-inline.c
+++ b/modules/vcard-inline/evolution-module-vcard-inline.c
@@ -28,8 +28,6 @@ const gchar * g_module_check_init (GModule *module);
G_MODULE_EXPORT void
e_module_load (GTypeModule *type_module)
{
- /* Register dynamically loaded types. */
-
e_mail_formatter_vcard_inline_type_register (type_module);
e_mail_parser_vcard_inline_type_register (type_module);
}