From e1fa571225dcf92a75e3ff4a84c7153e32b3664f Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 28 Feb 2002 02:28:12 +0000 Subject: Don't #include camel-mime-filter-save.h, we don't use it. 2002-02-27 Jeffrey Stedfast * camel-folder-summary.h: Don't #include camel-mime-filter-save.h, we don't use it. * camel-file-utils.c: Fixed a few 'might be used uninitialized' warnings which were real problems. * camel-mime-part-utils.c (camel_mime_part_construct_content_from_parser): Save the raw mime stream for any/all signed parts. * camel-mime-part.c (camel_mime_part_init): Initialize our raw stream to NULL. (camel_mime_part_finalize): Unref our raw stream, if we have one. (write_to_stream): If we have a raw stream, write that out instead of re-encoding. * camel-mime-filter-save.[c,h]: Rewritten to save to a stream rather than a file. svn path=/trunk/; revision=15867 --- camel/camel-mime-part-utils.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'camel/camel-mime-part-utils.c') diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index 8367cecf37..ddd71da90c 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -44,6 +44,7 @@ #include "camel-mime-filter-basic.h" #include "camel-mime-filter-charset.h" #include "camel-mime-filter-crlf.h" +#include "camel-mime-filter-save.h" #include "camel-html-parser.h" #include "camel-charset-map.h" @@ -328,8 +329,11 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse break; case HSCAN_MULTIPART: { struct _header_content_type *content_type; + CamelMimeFilter *save_filter = NULL; CamelDataWrapper *bodypart; - + CamelStream *raw = NULL; + int saveid = -1; + /* FIXME: we should use a came-mime-mutlipart, not jsut a camel-multipart, but who cares */ d(printf("Creating multi-part\n")); content = (CamelDataWrapper *)camel_multipart_new (); @@ -338,10 +342,32 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse camel_multipart_set_boundary ((CamelMultipart *)content, header_content_type_param (content_type, "boundary")); +#define SAVE_RAW_MIME_STREAM_FOR_SECURE_MIME_SIGNATURES +#ifdef SAVE_RAW_MIME_STREAM_FOR_SECURE_MIME_SIGNATURES + if (header_content_type_is (content_type, "multipart", "signed")) { + /* save the raw mime stream for the first mime part in the multipart/signed */ + raw = camel_stream_mem_new (); + save_filter = camel_mime_filter_save_new_with_stream (raw); + saveid = camel_mime_parser_filter_add (mp, save_filter); + camel_object_unref (CAMEL_OBJECT (save_filter)); + } +#endif /* SAVE_RAW_MIME_STREAM_FOR_SECURE_MIME_SIGNATURES */ + while (camel_mime_parser_step (mp, &buf, &len) != HSCAN_MULTIPART_END) { camel_mime_parser_unstep (mp); bodypart = (CamelDataWrapper *)camel_mime_part_new (); camel_mime_part_construct_from_parser ((CamelMimePart *)bodypart, mp); +#ifdef SAVE_RAW_MIME_STREAM_FOR_SECURE_MIME_SIGNATURES + if (raw) { + /* set the raw mime stream on the first part within the multipart/signed */ + camel_stream_reset (raw); + CAMEL_MIME_PART (bodypart)->stream = raw; + camel_mime_parser_filter_remove (mp, saveid); + saveid = -1; + raw = NULL; + } +#endif /* SAVE_RAW_MIME_STREAM_FOR_SECURE_MIME_SIGNATURES */ + camel_multipart_add_part ((CamelMultipart *)content, (CamelMimePart *)bodypart); camel_object_unref ((CamelObject *)bodypart); } -- cgit v1.2.3