aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-part-utils.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-02-28 10:28:12 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-02-28 10:28:12 +0800
commite1fa571225dcf92a75e3ff4a84c7153e32b3664f (patch)
tree39c9b03cde721b756f11925e5c411b557e883321 /camel/camel-mime-part-utils.c
parent7ac88d86319e2ef5b43ad7413f759bd1423ecd21 (diff)
downloadgsoc2013-evolution-e1fa571225dcf92a75e3ff4a84c7153e32b3664f.tar
gsoc2013-evolution-e1fa571225dcf92a75e3ff4a84c7153e32b3664f.tar.gz
gsoc2013-evolution-e1fa571225dcf92a75e3ff4a84c7153e32b3664f.tar.bz2
gsoc2013-evolution-e1fa571225dcf92a75e3ff4a84c7153e32b3664f.tar.lz
gsoc2013-evolution-e1fa571225dcf92a75e3ff4a84c7153e32b3664f.tar.xz
gsoc2013-evolution-e1fa571225dcf92a75e3ff4a84c7153e32b3664f.tar.zst
gsoc2013-evolution-e1fa571225dcf92a75e3ff4a84c7153e32b3664f.zip
Don't #include camel-mime-filter-save.h, we don't use it.
2002-02-27 Jeffrey Stedfast <fejj@ximian.com> * 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
Diffstat (limited to 'camel/camel-mime-part-utils.c')
-rw-r--r--camel/camel-mime-part-utils.c28
1 files changed, 27 insertions, 1 deletions
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);
}