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
This commit is contained in:
Jeffrey Stedfast
2001-09-26 20:50:58 +00:00
committed by Jeffrey Stedfast
parent 87def266b0
commit ce3e488074
4 changed files with 64 additions and 4 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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 */

View File

@ -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));