[evolution] Add e_mail_part_get_cid().



commit 5bea269ce8a7b2603f30f82f8ef3636795fb0cd0
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun May 19 10:23:24 2013 -0400

    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 30d7a28..2345b78 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 f73fc49..7ad03be 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 5b8f9c1..410d78b 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 c90e5bf..45a5d44 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 39ffba8..dbff9e5 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 c3ace21..f7adcf9 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 e6b0576..0f4550c 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 f1e4805..5c07161 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]