From 5bea269ce8a7b2603f30f82f8ef3636795fb0cd0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 19 May 2013 10:23:24 -0400 Subject: Add e_mail_part_get_cid(). --- em-format/e-mail-formatter-print-headers.c | 2 +- em-format/e-mail-formatter-print.c | 2 +- em-format/e-mail-parser-multipart-mixed.c | 2 +- em-format/e-mail-parser-multipart-related.c | 5 ++++- em-format/e-mail-parser.c | 4 ++-- em-format/e-mail-part-list.c | 2 +- em-format/e-mail-part.c | 8 ++++++++ em-format/e-mail-part.h | 1 + 8 files changed, 19 insertions(+), 7 deletions(-) diff --git a/em-format/e-mail-formatter-print-headers.c b/em-format/e-mail-formatter-print-headers.c index 30d7a2827d..2345b78b05 100644 --- a/em-format/e-mail-formatter-print-headers.c +++ b/em-format/e-mail-formatter-print-headers.c @@ -190,7 +190,7 @@ emfpe_headers_format (EMailFormatterExtension *extension, if (mail_part->is_hidden) continue; - if (mail_part->cid != NULL) + if (e_mail_part_get_cid (mail_part) != NULL) continue; attachments_count++; diff --git a/em-format/e-mail-formatter-print.c b/em-format/e-mail-formatter-print.c index f73fc493cf..7ad03be956 100644 --- a/em-format/e-mail-formatter-print.c +++ b/em-format/e-mail-formatter-print.c @@ -149,7 +149,7 @@ mail_formatter_print_run (EMailFormatter *formatter, continue; if (part->is_attachment) { - if (part->cid != NULL) + if (e_mail_part_get_cid (part) != NULL) continue; g_queue_push_tail (&attachments, part); diff --git a/em-format/e-mail-parser-multipart-mixed.c b/em-format/e-mail-parser-multipart-mixed.c index 5b8f9c1d7f..410d78bdeb 100644 --- a/em-format/e-mail-parser-multipart-mixed.c +++ b/em-format/e-mail-parser-multipart-mixed.c @@ -88,7 +88,7 @@ empe_mp_mixed_parse (EMailParserExtension *extension, * because this is multipart/mixed, * not multipart/related. */ if (mail_part != NULL && - mail_part->cid != NULL && + e_mail_part_get_cid (mail_part) != NULL && (!mail_part->is_attachment || mail_part->is_hidden)) { diff --git a/em-format/e-mail-parser-multipart-related.c b/em-format/e-mail-parser-multipart-related.c index c90e5bf31d..45a5d440f5 100644 --- a/em-format/e-mail-parser-multipart-related.c +++ b/em-format/e-mail-parser-multipart-related.c @@ -124,9 +124,12 @@ empe_mp_related_parse (EMailParserExtension *extension, for (link = head; link != NULL; link = g_list_next (link)) { EMailPart *mail_part = link->data; + const gchar *cid; + + cid = e_mail_part_get_cid (mail_part); /* Don't render the part on its own! */ - if (e_mail_part_utils_body_refers (html_body, mail_part->cid)) + if (e_mail_part_utils_body_refers (html_body, cid)) mail_part->is_hidden = TRUE; } diff --git a/em-format/e-mail-parser.c b/em-format/e-mail-parser.c index 39ffba8085..dbff9e5f77 100644 --- a/em-format/e-mail-parser.c +++ b/em-format/e-mail-parser.c @@ -364,7 +364,7 @@ e_mail_parser_parse_sync (EMailParser *parser, " id: %s | cid: %s | mime_type: %s | " "is_hidden: %d | is_attachment: %d\n", e_mail_part_get_id (part), - part->cid, + e_mail_part_get_cid (part), part->mime_type, part->is_hidden ? 1 : 0, part->is_attachment ? 1 : 0); @@ -468,7 +468,7 @@ e_mail_parser_parse_finish (EMailParser *parser, " id: %s | cid: %s | mime_type: %s | " "is_hidden: %d | is_attachment: %d\n", e_mail_part_get_id (part), - part->cid, + e_mail_part_get_cid (part), part->mime_type, part->is_hidden ? 1 : 0, part->is_attachment ? 1 : 0); diff --git a/em-format/e-mail-part-list.c b/em-format/e-mail-part-list.c index c3ace21fa7..f7adcf9895 100644 --- a/em-format/e-mail-part-list.c +++ b/em-format/e-mail-part-list.c @@ -322,7 +322,7 @@ e_mail_part_list_ref_part (EMailPartList *part_list, const gchar *candidate_id; if (by_cid) - candidate_id = candidate->cid; + candidate_id = e_mail_part_get_cid (candidate); else candidate_id = e_mail_part_get_id (candidate); diff --git a/em-format/e-mail-part.c b/em-format/e-mail-part.c index e6b0576d2e..0f4550cae5 100644 --- a/em-format/e-mail-part.c +++ b/em-format/e-mail-part.c @@ -183,6 +183,14 @@ e_mail_part_get_id (EMailPart *part) return part->id; } +const gchar * +e_mail_part_get_cid (EMailPart *part) +{ + g_return_val_if_fail (part != NULL, NULL); + + return part->cid; +} + 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 f1e48051f8..5c071613a0 100644 --- a/em-format/e-mail-part.h +++ b/em-format/e-mail-part.h @@ -96,6 +96,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); +const gchar * e_mail_part_get_cid (EMailPart *part); void e_mail_part_update_validity (EMailPart *part, CamelCipherValidity *validity, guint32 validity_type); -- cgit v1.2.3