aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--em-format/e-mail-formatter-attachment-bar.c3
-rw-r--r--em-format/e-mail-formatter-attachment.c20
-rw-r--r--em-format/e-mail-formatter-headers.c2
-rw-r--r--em-format/e-mail-formatter-message-rfc822.c36
-rw-r--r--em-format/e-mail-formatter-print-headers.c4
-rw-r--r--em-format/e-mail-formatter-quote-message-rfc822.c16
-rw-r--r--em-format/e-mail-formatter-secure-button.c3
-rw-r--r--em-format/e-mail-formatter-text-html.c6
-rw-r--r--em-format/e-mail-formatter-text-plain.c6
-rw-r--r--em-format/e-mail-formatter-utils.c13
-rw-r--r--em-format/e-mail-formatter.c5
-rw-r--r--em-format/e-mail-parser.c4
-rw-r--r--em-format/e-mail-part-list.c4
-rw-r--r--em-format/e-mail-part.c8
-rw-r--r--em-format/e-mail-part.h1
-rw-r--r--mail/e-mail-display.c14
-rw-r--r--mail/em-utils.c15
-rw-r--r--modules/audio-inline/e-mail-formatter-audio-inline.c3
-rw-r--r--modules/itip-formatter/e-mail-formatter-itip.c6
-rw-r--r--modules/prefer-plain/e-mail-display-popup-prefer-plain.c9
-rw-r--r--modules/text-highlight/e-mail-formatter-text-highlight.c6
-rw-r--r--modules/vcard-inline/e-mail-formatter-vcard-inline.c10
22 files changed, 127 insertions, 67 deletions
diff --git a/em-format/e-mail-formatter-attachment-bar.c b/em-format/e-mail-formatter-attachment-bar.c
index 61c1509cd1..b18ce067e5 100644
--- a/em-format/e-mail-formatter-attachment-bar.c
+++ b/em-format/e-mail-formatter-attachment-bar.c
@@ -59,7 +59,8 @@ emfe_attachment_bar_format (EMailFormatterExtension *extension,
str = g_strdup_printf (
"<object type=\"application/vnd.evolution.widget.attachment-bar\" "
"height=\"0\" width=\"100%%\" data=\"%s\" id=\"%s\"></object>",
- part->id, part->id);
+ e_mail_part_get_id (part),
+ e_mail_part_get_id (part));
camel_stream_write_string (stream, str, cancellable, NULL);
diff --git a/em-format/e-mail-formatter-attachment.c b/em-format/e-mail-formatter-attachment.c
index 08b0da2042..40eb68c1b3 100644
--- a/em-format/e-mail-formatter-attachment.c
+++ b/em-format/e-mail-formatter-attachment.c
@@ -61,7 +61,7 @@ find_attachment_store (EMailPartList *part_list,
EMailPart *part;
gchar *id;
- start_id = start->id;
+ start_id = e_mail_part_get_id (start);
e_mail_part_list_queue_parts (part_list, NULL, &queue);
@@ -75,8 +75,11 @@ find_attachment_store (EMailPartList *part_list,
for (link = head; link != NULL; link = g_list_next (link)) {
EMailPart *p = link->data;
+ const gchar *p_id;
- if (g_strcmp0 (p->id, id) == 0) {
+ p_id = e_mail_part_get_id (p);
+
+ if (g_strcmp0 (p_id, id) == 0) {
part = p;
break;
}
@@ -121,10 +124,12 @@ emfe_attachment_format (EMailFormatterExtension *extension,
EMailPartAttachment *empa;
CamelMimeFilterToHTMLFlags flags;
const gchar *attachment_part_id;
+ const gchar *part_id;
g_return_val_if_fail (E_IS_MAIL_PART_ATTACHMENT (part), FALSE);
empa = (EMailPartAttachment *) part;
+ part_id = e_mail_part_get_id (part);
if ((context->mode == E_MAIL_FORMATTER_MODE_NORMAL) ||
(context->mode == E_MAIL_FORMATTER_MODE_PRINTING) ||
@@ -163,7 +168,7 @@ emfe_attachment_format (EMailFormatterExtension *extension,
}
g_list_free (attachments);
} else {
- g_warning ("Failed to locate attachment-bar for %s", part->id);
+ g_warning ("Failed to locate attachment-bar for %s", part_id);
}
g_object_unref (attachment);
@@ -254,7 +259,7 @@ emfe_attachment_format (EMailFormatterExtension *extension,
if (empa->attachment_view_part_id)
attachment_part_id = empa->attachment_view_part_id;
else
- attachment_part_id = part->id;
+ attachment_part_id = part_id;
button_id = g_strconcat (attachment_part_id, ".attachment_button", NULL);
@@ -267,7 +272,7 @@ emfe_attachment_format (EMailFormatterExtension *extension,
"height=\"20\" width=\"100\" data=\"%s\" id=\"%s\"></object>"
"</td>"
"<td align=\"left\">%s</td>"
- "</tr>", part->id, button_id, html);
+ "</tr>", part_id, button_id, html);
camel_stream_write_string (stream, str, cancellable, NULL);
g_free (button_id);
@@ -362,17 +367,20 @@ emfe_attachment_get_widget (EMailFormatterExtension *extension,
EAttachmentStore *store;
EAttachmentView *view;
GtkWidget *widget;
+ const gchar *part_id;
g_return_val_if_fail (E_IS_MAIL_PART_ATTACHMENT (part), NULL);
attachment = g_object_ref (
E_MAIL_PART_ATTACHMENT (part)->attachment);
+ part_id = e_mail_part_get_id (part);
+
store = find_attachment_store (context, part);
widget = e_attachment_button_new ();
g_object_set_data_full (
G_OBJECT (widget),
- "uri", g_strdup (part->id),
+ "uri", g_strdup (part_id),
(GDestroyNotify) g_free);
e_attachment_button_set_attachment (
E_ATTACHMENT_BUTTON (widget), attachment);
diff --git a/em-format/e-mail-formatter-headers.c b/em-format/e-mail-formatter-headers.c
index a3d7b20680..afe780a4ee 100644
--- a/em-format/e-mail-formatter-headers.c
+++ b/em-format/e-mail-formatter-headers.c
@@ -580,7 +580,7 @@ emfe_headers_format (EMailFormatterExtension *extension,
"style=\"color: #%06x; direction: %s\">"
"<tr>",
e_rgba_to_value (body_rgba),
- part->id,
+ e_mail_part_get_id (part),
e_rgba_to_value (header_rgba),
direction);
diff --git a/em-format/e-mail-formatter-message-rfc822.c b/em-format/e-mail-formatter-message-rfc822.c
index 8059e55e76..8e7b1cee8b 100644
--- a/em-format/e-mail-formatter-message-rfc822.c
+++ b/em-format/e-mail-formatter-message-rfc822.c
@@ -53,6 +53,10 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
CamelStream *stream,
GCancellable *cancellable)
{
+ const gchar *part_id;
+
+ part_id = e_mail_part_get_id (part);
+
if (g_cancellable_is_cancelled (cancellable))
return FALSE;
@@ -69,7 +73,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
context->mode = E_MAIL_FORMATTER_MODE_NORMAL;
e_mail_part_list_queue_parts (
- context->part_list, part->id, &queue);
+ context->part_list, part_id, &queue);
/* Discard the first EMailPart. */
if (!g_queue_is_empty (&queue))
@@ -77,19 +81,22 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
head = g_queue_peek_head_link (&queue);
- end = g_strconcat (part->id, ".end", NULL);
+ end = g_strconcat (part_id, ".end", NULL);
for (link = head; link != NULL; link = g_list_next (link)) {
EMailPart *p = link->data;
+ const gchar *p_id;
+
+ p_id = e_mail_part_get_id (p);
/* Check for nested rfc822 messages */
if (g_str_has_suffix (p->id, ".rfc822")) {
- gchar *sub_end = g_strconcat (p->id, ".end", NULL);
+ gchar *sub_end = g_strconcat (p_id, ".end", NULL);
while (link != NULL) {
p = link->data;
- if (g_strcmp0 (p->id, sub_end) == 0)
+ if (g_strcmp0 (p_id, sub_end) == 0)
break;
link = g_list_next (link);
@@ -98,7 +105,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
continue;
}
- if ((g_strcmp0 (p->id, end) == 0))
+ if ((g_strcmp0 (p_id, end) == 0))
break;
if (p->is_hidden)
@@ -125,7 +132,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
/* Part is EMailPartAttachment */
e_mail_part_list_queue_parts (
- context->part_list, part->id, &queue);
+ context->part_list, part_id, &queue);
/* Discard the first EMailPart. */
if (!g_queue_is_empty (&queue))
@@ -135,26 +142,29 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
return FALSE;
part = g_queue_pop_head (&queue);
- end = g_strconcat (part->id, ".end", NULL);
+ end = g_strconcat (part_id, ".end", NULL);
e_mail_part_unref (part);
head = g_queue_peek_head_link (&queue);
for (link = head; link != NULL; link = g_list_next (link)) {
EMailPart *p = link->data;
+ const gchar *p_id;
/* Skip attachment bar */
if (g_str_has_suffix (part->id, ".attachment-bar"))
continue;
+ p_id = e_mail_part_get_id (p);
+
/* Check for nested rfc822 messages */
if (g_str_has_suffix (p->id, ".rfc822")) {
- gchar *sub_end = g_strconcat (p->id, ".end", NULL);
+ gchar *sub_end = g_strconcat (p_id, ".end", NULL);
while (link != NULL) {
p = link->data;
- if (g_strcmp0 (p->id, sub_end) == 0)
+ if (g_strcmp0 (p_id, sub_end) == 0)
break;
link = g_list_next (link);
@@ -163,7 +173,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
continue;
}
- if ((g_strcmp0 (p->id, end) == 0))
+ if ((g_strcmp0 (p_id, end) == 0))
break;
if (p->is_hidden)
@@ -187,7 +197,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
gchar *str;
gchar *uri;
- p = e_mail_part_list_ref_part (context->part_list, part->id);
+ p = e_mail_part_list_ref_part (context->part_list, part_id);
if (p == NULL)
return FALSE;
@@ -203,7 +213,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
uri = e_mail_part_build_uri (
folder, message_uid,
- "part_id", G_TYPE_STRING, p->id,
+ "part_id", G_TYPE_STRING, e_mail_part_get_id (p),
"mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW,
"headers_collapsable", G_TYPE_INT, 0,
"formatter_default_charset", G_TYPE_STRING, default_charset,
@@ -223,7 +233,7 @@ emfe_message_rfc822_format (EMailFormatterExtension *extension,
e_rgba_to_value (
e_mail_formatter_get_color (
formatter, E_MAIL_FORMATTER_COLOR_BODY)),
- part->id, uri, part->id);
+ part_id, uri, part_id);
camel_stream_write_string (stream, str, cancellable, NULL);
diff --git a/em-format/e-mail-formatter-print-headers.c b/em-format/e-mail-formatter-print-headers.c
index b739d6ce96..30d7a2827d 100644
--- a/em-format/e-mail-formatter-print-headers.c
+++ b/em-format/e-mail-formatter-print-headers.c
@@ -64,6 +64,7 @@ emfpe_headers_format (EMailFormatterExtension *extension,
GQueue *headers_queue;
GQueue queue = G_QUEUE_INIT;
GList *head, *link;
+ const gchar *part_id;
buf = camel_medium_get_header (CAMEL_MEDIUM (part->part), "subject");
subject = camel_header_decode_string (buf, "UTF-8");
@@ -118,7 +119,8 @@ emfpe_headers_format (EMailFormatterExtension *extension,
g_queue_free_full (headers_queue, (GDestroyNotify) e_mail_formatter_header_free);
/* Get prefix of this PURI */
- part_id_prefix = g_strndup (part->id, g_strrstr (part->id, ".") - part->id);
+ part_id = e_mail_part_get_id (part);
+ part_id_prefix = g_strndup (part_id, g_strrstr (part_id, ".") - part_id);
/* Add encryption/signature header */
raw_header.name = _("Security");
diff --git a/em-format/e-mail-formatter-quote-message-rfc822.c b/em-format/e-mail-formatter-quote-message-rfc822.c
index 710ee9f18c..ae09a0285b 100644
--- a/em-format/e-mail-formatter-quote-message-rfc822.c
+++ b/em-format/e-mail-formatter-quote-message-rfc822.c
@@ -59,6 +59,9 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension,
GList *head, *link;
gchar *header, *end;
EMailFormatterQuoteContext *qc = (EMailFormatterQuoteContext *) context;
+ const gchar *part_id;
+
+ part_id = e_mail_part_get_id (part);
if (g_cancellable_is_cancelled (cancellable))
return FALSE;
@@ -67,7 +70,7 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension,
camel_stream_write_string (stream, header, cancellable, NULL);
g_free (header);
- e_mail_part_list_queue_parts (context->part_list, part->id, &queue);
+ e_mail_part_list_queue_parts (context->part_list, part_id, &queue);
if (g_queue_is_empty (&queue))
return FALSE;
@@ -77,10 +80,13 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension,
head = g_queue_peek_head (&queue);
- end = g_strconcat (part->id, ".end", NULL);
+ end = g_strconcat (part_id, ".end", NULL);
for (link = head; link != NULL; link = g_list_next (link)) {
EMailPart *p = link->data;
+ const gchar *p_id;
+
+ p_id = e_mail_part_get_id (p);
/* Skip attachment bar */
if (g_str_has_suffix (p->id, ".attachment-bar"))
@@ -99,12 +105,12 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension,
/* Check for nested rfc822 messages */
if (g_str_has_suffix (p->id, ".rfc822")) {
- gchar *sub_end = g_strconcat (p->id, ".end", NULL);
+ gchar *sub_end = g_strconcat (p_id, ".end", NULL);
while (link != NULL) {
p = link->data;
- if (g_strcmp0 (p->id, sub_end) == 0)
+ if (g_strcmp0 (p_id, sub_end) == 0)
break;
link = g_list_next (link);
@@ -113,7 +119,7 @@ emfqe_message_rfc822_format (EMailFormatterExtension *extension,
continue;
}
- if ((g_strcmp0 (p->id, end) == 0))
+ if ((g_strcmp0 (p_id, end) == 0))
break;
if (p->is_hidden)
diff --git a/em-format/e-mail-formatter-secure-button.c b/em-format/e-mail-formatter-secure-button.c
index 83e88d5752..91a330348f 100644
--- a/em-format/e-mail-formatter-secure-button.c
+++ b/em-format/e-mail-formatter-secure-button.c
@@ -88,7 +88,8 @@ emfe_secure_button_format (EMailFormatterExtension *extension,
str = g_strdup_printf (
"<object type=\"application/vnd.evolution.widget.secure-button\" "
"height=\"20\" width=\"100%%\" data=\"%s\" id=\"%s\"></object>",
- part->id, part->id);
+ e_mail_part_get_id (part),
+ e_mail_part_get_id (part));
camel_stream_write_string (stream, str, cancellable, NULL);
diff --git a/em-format/e-mail-formatter-text-html.c b/em-format/e-mail-formatter-text-html.c
index f730f1217b..0a581117a6 100644
--- a/em-format/e-mail-formatter-text-html.c
+++ b/em-format/e-mail-formatter-text-html.c
@@ -312,7 +312,7 @@ emfe_text_html_format (EMailFormatterExtension *extension,
uri = e_mail_part_build_uri (
folder, message_uid,
- "part_id", G_TYPE_STRING, part->id,
+ "part_id", G_TYPE_STRING, e_mail_part_get_id (part),
"mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW,
"formatter_default_charset", G_TYPE_STRING, default_charset,
"formatter_charset", G_TYPE_STRING, charset,
@@ -332,8 +332,8 @@ emfe_text_html_format (EMailFormatterExtension *extension,
"</iframe>"
"</div>",
uri,
- part->id,
- part->id,
+ e_mail_part_get_id (part),
+ e_mail_part_get_id (part),
e_rgba_to_value (
e_mail_formatter_get_color (
formatter, E_MAIL_FORMATTER_COLOR_FRAME)));
diff --git a/em-format/e-mail-formatter-text-plain.c b/em-format/e-mail-formatter-text-plain.c
index 122c566cf0..33ede66957 100644
--- a/em-format/e-mail-formatter-text-plain.c
+++ b/em-format/e-mail-formatter-text-plain.c
@@ -149,7 +149,7 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
uri = e_mail_part_build_uri (
folder, message_uid,
- "part_id", G_TYPE_STRING, part->id,
+ "part_id", G_TYPE_STRING, e_mail_part_get_id (part),
"mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW,
"formatter_default_charset", G_TYPE_STRING, default_charset,
"formatter_charset", G_TYPE_STRING, charset,
@@ -163,7 +163,9 @@ emfe_text_plain_format (EMailFormatterExtension *extension,
" style=\"border: 1px solid #%06x; background-color: #%06x;\">"
"</iframe>"
"</div>",
- part->id, part->id, uri,
+ e_mail_part_get_id (part),
+ e_mail_part_get_id (part),
+ uri,
e_rgba_to_value (
e_mail_formatter_get_color (
formatter, E_MAIL_FORMATTER_COLOR_FRAME)),
diff --git a/em-format/e-mail-formatter-utils.c b/em-format/e-mail-formatter-utils.c
index 775ef1d6cc..fe4c887756 100644
--- a/em-format/e-mail-formatter-utils.c
+++ b/em-format/e-mail-formatter-utils.c
@@ -470,20 +470,25 @@ e_mail_formatter_find_rfc822_end_iter (GList *rfc822_start_iter)
{
GList *link = rfc822_start_iter;
EMailPart *part;
+ const gchar *part_id;
gchar *end;
g_return_val_if_fail (rfc822_start_iter != NULL, NULL);
part = E_MAIL_PART (link->data);
- g_return_val_if_fail (part != NULL, NULL);
- end = g_strconcat (part->id, ".end", NULL);
+ part_id = e_mail_part_get_id (part);
+ g_return_val_if_fail (part_id != NULL, NULL);
+
+ end = g_strconcat (part_id, ".end", NULL);
while (link != NULL) {
part = E_MAIL_PART (link->data);
- g_return_val_if_fail (part != NULL, NULL);
- if (g_strcmp0 (part->id, end) == 0)
+ part_id = e_mail_part_get_id (part);
+ g_return_val_if_fail (part_id != NULL, NULL);
+
+ if (g_strcmp0 (part_id, end) == 0)
break;
link = g_list_next (link);
diff --git a/em-format/e-mail-formatter.c b/em-format/e-mail-formatter.c
index ad203d83ad..fb1c069ffa 100644
--- a/em-format/e-mail-formatter.c
+++ b/em-format/e-mail-formatter.c
@@ -396,8 +396,11 @@ mail_formatter_run (EMailFormatter *formatter,
for (link = head; link != NULL; link = g_list_next (link)) {
EMailPart *part = link->data;
+ const gchar *part_id;
gboolean ok;
+ part_id = e_mail_part_get_id (part);
+
if (g_cancellable_is_cancelled (cancellable))
break;
@@ -451,7 +454,7 @@ mail_formatter_run (EMailFormatter *formatter,
/* .message is the entire message. There's nothing more
* to be written. */
- if (g_strcmp0 (part->id, ".message") == 0)
+ if (g_strcmp0 (part_id, ".message") == 0)
break;
/* If we just wrote source of a rfc822 message, then jump
diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c
index 174d88ca69..39ffba8085 100644
--- a/em-format/e-mail-parser.c
+++ b/em-format/e-mail-parser.c
@@ -363,7 +363,7 @@ e_mail_parser_parse_sync (EMailParser *parser,
printf (
" id: %s | cid: %s | mime_type: %s | "
"is_hidden: %d | is_attachment: %d\n",
- part->id,
+ e_mail_part_get_id (part),
part->cid,
part->mime_type,
part->is_hidden ? 1 : 0,
@@ -467,7 +467,7 @@ e_mail_parser_parse_finish (EMailParser *parser,
printf (
" id: %s | cid: %s | mime_type: %s | "
"is_hidden: %d | is_attachment: %d\n",
- part->id,
+ e_mail_part_get_id (part),
part->cid,
part->mime_type,
part->is_hidden ? 1 : 0,
diff --git a/em-format/e-mail-part-list.c b/em-format/e-mail-part-list.c
index e6ccc5733b..c3ace21fa7 100644
--- a/em-format/e-mail-part-list.c
+++ b/em-format/e-mail-part-list.c
@@ -324,7 +324,7 @@ e_mail_part_list_ref_part (EMailPartList *part_list,
if (by_cid)
candidate_id = candidate->cid;
else
- candidate_id = candidate->id;
+ candidate_id = e_mail_part_get_id (candidate);
if (g_strcmp0 (candidate_id, part_id) == 0) {
match = e_mail_part_ref (candidate);
@@ -372,7 +372,7 @@ e_mail_part_list_queue_parts (EMailPartList *part_list,
EMailPart *candidate = E_MAIL_PART (link->data);
const gchar *candidate_id;
- candidate_id = candidate->id;
+ candidate_id = e_mail_part_get_id (candidate);
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 5b39e0a8f5..e6b0576d2e 100644
--- a/em-format/e-mail-part.c
+++ b/em-format/e-mail-part.c
@@ -175,6 +175,14 @@ e_mail_part_get_instance_size (EMailPart *part)
return part->priv->instance_size;
}
+const gchar *
+e_mail_part_get_id (EMailPart *part)
+{
+ g_return_val_if_fail (part != NULL, NULL);
+
+ return part->id;
+}
+
static EMailPartValidityPair *
mail_part_find_validity_pair (EMailPart *part,
guint32 validity_type)
diff --git a/em-format/e-mail-part.h b/em-format/e-mail-part.h
index 9131e7fbdb..f1e48051f8 100644
--- a/em-format/e-mail-part.h
+++ b/em-format/e-mail-part.h
@@ -95,6 +95,7 @@ void e_mail_part_unref (EMailPart *part);
gsize e_mail_part_get_instance_size (EMailPart *part);
+const gchar * e_mail_part_get_id (EMailPart *part);
void e_mail_part_update_validity (EMailPart *part,
CamelCipherValidity *validity,
guint32 validity_type);
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 00c5d2df4f..b899ca46fd 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1201,21 +1201,19 @@ mail_parts_bind_dom (GObject *object,
for (link = head; link != NULL; link = g_list_next (link)) {
EMailPart *part = E_MAIL_PART (link->data);
+ WebKitDOMElement *element;
+ const gchar *part_id;
/* Iterate only the parts rendered in
* the frame and all it's subparts. */
if (!g_str_has_prefix (part->id, frame_name))
break;
- if (part->bind_func != NULL) {
- WebKitDOMElement *element;
+ part_id = e_mail_part_get_id (part);
+ element = find_element_by_id (document, part_id);
- element = find_element_by_id (document, part->id);
- if (element != NULL) {
- d (printf ("/*bind_func*/ for %s\n", part->id));
- part->bind_func (part, element);
- }
- }
+ if (element != NULL && part->bind_func != NULL)
+ part->bind_func (part, element);
}
while (!g_queue_is_empty (&queue))
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 8e7d48bd19..3e3f9f022b 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1198,6 +1198,7 @@ static gboolean
is_only_text_part_in_this_level (GList *parts,
EMailPart *text_html_part)
{
+ const gchar *text_html_part_id;
const gchar *dot;
gint level_len;
GList *iter;
@@ -1205,13 +1206,16 @@ is_only_text_part_in_this_level (GList *parts,
g_return_val_if_fail (parts != NULL, FALSE);
g_return_val_if_fail (text_html_part != NULL, FALSE);
- dot = strrchr (text_html_part->id, '.');
+ text_html_part_id = e_mail_part_get_id (text_html_part);
+
+ dot = strrchr (text_html_part_id, '.');
if (!dot)
return FALSE;
- level_len = dot - text_html_part->id;
+ level_len = dot - text_html_part_id;
for (iter = parts; iter; iter = iter->next) {
EMailPart *part = E_MAIL_PART (iter->data);
+ const gchar *part_id;
if (part == NULL)
continue;
@@ -1228,9 +1232,10 @@ is_only_text_part_in_this_level (GList *parts,
if (part->mime_type == NULL)
continue;
- dot = strrchr (part->id, '.');
- if (dot - part->id != level_len ||
- strncmp (text_html_part->id, part->id, level_len) != 0)
+ part_id = e_mail_part_get_id (part);
+ dot = strrchr (part_id, '.');
+ if (dot - part_id != level_len ||
+ strncmp (text_html_part_id, part_id, level_len) != 0)
continue;
if (g_ascii_strncasecmp (part->mime_type, "text/", 5) == 0)
diff --git a/modules/audio-inline/e-mail-formatter-audio-inline.c b/modules/audio-inline/e-mail-formatter-audio-inline.c
index 7abcf934fa..9c477bd2c8 100644
--- a/modules/audio-inline/e-mail-formatter-audio-inline.c
+++ b/modules/audio-inline/e-mail-formatter-audio-inline.c
@@ -265,7 +265,8 @@ emfe_audio_inline_format (EMailFormatterExtension *extension,
str = g_strdup_printf (
"<object type=\"application/vnd.evolution.widget.audio-inline\" "
"width=\"100%%\" height=\"auto\" data=\"%s\" id=\"%s\"></object>",
- part->id, part->id);
+ e_mail_part_get_id (part),
+ e_mail_part_get_id (part));
camel_stream_write_string (stream, str, cancellable, NULL);
diff --git a/modules/itip-formatter/e-mail-formatter-itip.c b/modules/itip-formatter/e-mail-formatter-itip.c
index 02ae152718..9f274ced20 100644
--- a/modules/itip-formatter/e-mail-formatter-itip.c
+++ b/modules/itip-formatter/e-mail-formatter-itip.c
@@ -115,7 +115,7 @@ emfe_itip_format (EMailFormatterExtension *extension,
uri = e_mail_part_build_uri (
folder, message_uid,
- "part_id", G_TYPE_STRING, part->id,
+ "part_id", G_TYPE_STRING, e_mail_part_get_id (part),
"mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW,
"formatter_default_charset", G_TYPE_STRING, default_charset,
"formatter_charset", G_TYPE_STRING, charset,
@@ -129,7 +129,9 @@ emfe_itip_format (EMailFormatterExtension *extension,
"<iframe width=\"100%%\" height=\"auto\""
" frameborder=\"0\" src=\"%s\" name=\"%s\" id=\"%s\"></iframe>"
"</div>",
- uri, part->id, part->id);
+ uri,
+ e_mail_part_get_id (part),
+ e_mail_part_get_id (part));
g_free (uri);
}
diff --git a/modules/prefer-plain/e-mail-display-popup-prefer-plain.c b/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
index 2be2532eda..9b7de92f53 100644
--- a/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
+++ b/modules/prefer-plain/e-mail-display-popup-prefer-plain.c
@@ -316,13 +316,16 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte
if (g_str_has_prefix (p->id, prefix) &&
(strstr (p->id, "text_html") || strstr (p->id, "plain_text"))) {
+ const gchar *p_id;
- pos = strstr (p->id, ".alternative-prefer-plain.");
+ p_id = e_mail_part_get_id (p);
+
+ pos = strstr (p_id, ".alternative-prefer-plain.");
if (is_text_plain) {
if (strstr (pos + ID_LEN, "text_html") != NULL) {
action_name = "show-text-html-part";
- set_text_html_id (pp_extension, p->id);
+ set_text_html_id (pp_extension, p_id);
set_text_plain_id (pp_extension, NULL);
break;
}
@@ -330,7 +333,7 @@ mail_display_popup_prefer_plain_update_actions (EMailDisplayPopupExtension *exte
if (strstr (pos + ID_LEN, "plain_text") != NULL) {
action_name = "show-plain-text-part";
set_text_html_id (pp_extension, NULL);
- set_text_plain_id (pp_extension, p->id);
+ set_text_plain_id (pp_extension, p_id);
break;
}
}
diff --git a/modules/text-highlight/e-mail-formatter-text-highlight.c b/modules/text-highlight/e-mail-formatter-text-highlight.c
index 286e356c51..11fc546d74 100644
--- a/modules/text-highlight/e-mail-formatter-text-highlight.c
+++ b/modules/text-highlight/e-mail-formatter-text-highlight.c
@@ -313,7 +313,7 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
uri = e_mail_part_build_uri (
folder, message_uid,
- "part_id", G_TYPE_STRING, part->id,
+ "part_id", G_TYPE_STRING, e_mail_part_get_id (part),
"mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW,
"__formatas", G_TYPE_STRING, syntax,
"formatter_default_charset", G_TYPE_STRING, default_charset,
@@ -330,7 +330,9 @@ emfe_text_highlight_format (EMailFormatterExtension *extension,
" style=\"border: 1px solid #%06x; background-color: #%06x;\">"
"</iframe>"
"</div>",
- part->id, part->id, uri,
+ e_mail_part_get_id (part),
+ e_mail_part_get_id (part),
+ uri,
e_rgba_to_value (
e_mail_formatter_get_color (
formatter, E_MAIL_FORMATTER_COLOR_FRAME)),
diff --git a/modules/vcard-inline/e-mail-formatter-vcard-inline.c b/modules/vcard-inline/e-mail-formatter-vcard-inline.c
index f2ab3cc179..6baa818138 100644
--- a/modules/vcard-inline/e-mail-formatter-vcard-inline.c
+++ b/modules/vcard-inline/e-mail-formatter-vcard-inline.c
@@ -115,7 +115,7 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension,
uri = e_mail_part_build_uri (
folder, message_uid,
- "part_id", G_TYPE_STRING, part->id,
+ "part_id", G_TYPE_STRING, e_mail_part_get_id (part),
"mode", G_TYPE_INT, E_MAIL_FORMATTER_MODE_RAW,
"formatter_default_charset", G_TYPE_STRING, default_charset,
"formatter_charset", G_TYPE_STRING, charset,
@@ -131,7 +131,8 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension,
}
str = g_strdup_printf (
- "<div id=\"%s\">", part->id);
+ "<div id=\"%s\">",
+ e_mail_part_get_id (part));
camel_stream_write_string (stream, str, cancellable, NULL);
g_free (str);
@@ -161,8 +162,9 @@ emfe_vcard_inline_format (EMailFormatterExtension *extension,
"<iframe width=\"100%%\" height=\"auto\" frameborder=\"0\""
"src=\"%s\" name=\"%s\"></iframe>"
"</div>",
- part->id, access_key, html_label,
- uri, part->id);
+ e_mail_part_get_id (part),
+ access_key, html_label, uri,
+ e_mail_part_get_id (part));
camel_stream_write_string (stream, str, cancellable, NULL);
g_free (str);
g_free (html_label);