aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--camel/ChangeLog10
-rw-r--r--camel/camel-mime-message.c40
-rw-r--r--camel/camel-mime-message.h2
-rw-r--r--camel/camel-pgp-mime.c16
4 files changed, 64 insertions, 4 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 984bda49bb..95c8e363c4 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2001-09-26 <NotZed@Ximian.com>
* camel-vee-store.c: Emptied VeeStorePrivate, member wasn't used.
@@ -17,6 +26,7 @@
thanks to a pedantic.
2001-09-26 Jeffrey Stedfast <fejj@ximian.com>
+>>>>>>> 1.1175
* Makefile.am: Fix Ettore's fix.
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;
+}
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
index 4f154aee1f..7d65dd6af3 100644
--- a/camel/camel-mime-message.h
+++ b/camel/camel-mime-message.h
@@ -127,6 +127,8 @@ void camel_mime_message_set_best_encoding (CamelMimeMess
CamelBestencEncoding enctype);
void camel_mime_message_encode_8bit_parts (CamelMimeMessage *mime_message);
+CamelMimePart *camel_mime_part_get_part_by_content_id (CamelMimeMessage *message, const char *content_id);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/camel/camel-pgp-mime.c b/camel/camel-pgp-mime.c
index 4b38b829da..149e1baf3b 100644
--- a/camel/camel-pgp-mime.c
+++ b/camel/camel-pgp-mime.c
@@ -47,14 +47,17 @@ camel_pgp_mime_is_rfc2015_signed (CamelMimePart *mime_part)
CamelMultipart *mp;
CamelMimePart *part;
CamelContentType *type;
- const gchar *param, *micalg;
+#ifdef ENABLE_PEDANTIC_PGPMIME
+ const char *param, *micalg;
+#endif
int nparts;
/* check that we have a multipart/signed */
type = camel_mime_part_get_content_type (mime_part);
if (!header_content_type_is (type, "multipart", "signed"))
return FALSE;
-
+
+#ifdef ENABLE_PEDANTIC_PGPMIME
/* check that we have a protocol param with the value: "application/pgp-signature" */
param = header_content_type_param (type, "protocol");
if (!param || g_strcasecmp (param, "application/pgp-signature"))
@@ -64,6 +67,7 @@ camel_pgp_mime_is_rfc2015_signed (CamelMimePart *mime_part)
micalg = header_content_type_param (type, "micalg");
if (!micalg)
return FALSE;
+#endif /* ENABLE_PEDANTIC_PGPMIME */
/* check that we have exactly 2 subparts */
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
@@ -95,18 +99,22 @@ camel_pgp_mime_is_rfc2015_encrypted (CamelMimePart *mime_part)
CamelMultipart *mp;
CamelMimePart *part;
CamelContentType *type;
- const gchar *param;
+#ifdef ENABLE_PEDANTIC_PGPMIME
+ const char *param;
+#endif
int nparts;
/* check that we have a multipart/encrypted */
type = camel_mime_part_get_content_type (mime_part);
if (!header_content_type_is (type, "multipart", "encrypted"))
return FALSE;
-
+
+#ifdef ENABLE_PEDANTIC_PGPMIME
/* check that we have a protocol param with the value: "application/pgp-encrypted" */
param = header_content_type_param (type, "protocol");
if (!param || g_strcasecmp (param, "application/pgp-encrypted"))
return FALSE;
+#endif /* ENABLE_PEDANTIC_PGPMIME */
/* check that we have at least 2 subparts */
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));