aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-message.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-09-27 04:50:58 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-09-27 04:50:58 +0800
commitce3e488074e540d16b972e1dc691d2a8ea3f825b (patch)
tree3943ceb5012f220245bed1f3afde39d1b3c4eff1 /camel/camel-mime-message.c
parent87def266b0efafd38ae3a4886e2af3ee1996bdc2 (diff)
downloadgsoc2013-evolution-ce3e488074e540d16b972e1dc691d2a8ea3f825b.tar.gz
gsoc2013-evolution-ce3e488074e540d16b972e1dc691d2a8ea3f825b.tar.zst
gsoc2013-evolution-ce3e488074e540d16b972e1dc691d2a8ea3f825b.zip
New function to convenience Larry ;-)
2001-09-26 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-message.c (camel_mime_message_get_part_by_content_id): New function to convenience Larry ;-) * camel-pgp-mime.c (camel_pgp_mime_is_rfc2015_signed): block out some code if ENABLE_PEDANTIC_PGPMIME is not defined. svn path=/trunk/; revision=13165
Diffstat (limited to 'camel/camel-mime-message.c')
-rw-r--r--camel/camel-mime-message.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 13182093b7..fb396a27d9 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -836,3 +836,43 @@ camel_mime_message_encode_8bit_parts (CamelMimeMessage *mime_message)
camel_mime_message_set_best_encoding (mime_message, CAMEL_BESTENC_GET_ENCODING, CAMEL_BESTENC_7BIT);
}
+
+struct _check_content_id {
+ CamelMimePart *part;
+ const char *content_id;
+};
+
+static gboolean
+check_content_id (CamelMimeMessage *message, CamelMimePart *part, struct _check_content_id *data)
+{
+ const char *content_id;
+ gboolean ret;
+
+ content_id = camel_mime_part_get_content_id (part);
+
+ ret = content_id && !strcmp (content_id, data->content_id) ? TRUE : FALSE;
+ if (ret) {
+ data->part = part;
+ camel_object_ref (CAMEL_OBJECT (part));
+ }
+
+ return ret;
+}
+
+CamelMimePart *
+camel_mime_message_get_part_by_content_id (CamelMimeMessage *message, const char *id)
+{
+ struct _check_content_id check;
+
+ g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
+
+ if (id == NULL)
+ return NULL;
+
+ check.content_id = id;
+ check.part = NULL;
+
+ camel_mime_message_foreach_part (message, check_content_id, &check);
+
+ return check.part;
+}