aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-part.c
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>1999-05-13 03:07:54 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-05-13 03:07:54 +0800
commitcee85091a8782ef3921c1e1e775d9dcf99e0ce9e (patch)
treec8098d13d2f8a6fe8e563542dbc8fd01538690bf /camel/camel-mime-part.c
parentbd3559cdf211fbc4ba3a87e3a8a3237bc0be5e1c (diff)
downloadgsoc2013-evolution-cee85091a8782ef3921c1e1e775d9dcf99e0ce9e.tar
gsoc2013-evolution-cee85091a8782ef3921c1e1e775d9dcf99e0ce9e.tar.gz
gsoc2013-evolution-cee85091a8782ef3921c1e1e775d9dcf99e0ce9e.tar.bz2
gsoc2013-evolution-cee85091a8782ef3921c1e1e775d9dcf99e0ce9e.tar.lz
gsoc2013-evolution-cee85091a8782ef3921c1e1e775d9dcf99e0ce9e.tar.xz
gsoc2013-evolution-cee85091a8782ef3921c1e1e775d9dcf99e0ce9e.tar.zst
gsoc2013-evolution-cee85091a8782ef3921c1e1e775d9dcf99e0ce9e.zip
disposition is now a full GMimeContentField object.
* camel/camel-mime-part.h (struct ): disposition is now a full GMimeContentField object. * camel/gmime-content-field.c: new file handle "type/subtype ;parameter=value ; parameter=value ..." BNF grammar elements (gmime_content_field_write_to_file): new func * camel/gmime-utils.c (gmime_write_header_pair_to_file): namespace change Some work on mime stuff. Mime part can save itself into a file. This stuff is boring. svn path=/trunk/; revision=921
Diffstat (limited to 'camel/camel-mime-part.c')
-rw-r--r--camel/camel-mime-part.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 3427dccf8f..35fd0279ed 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -26,6 +26,8 @@
#include "camel-mime-part.h"
#include <stdio.h>
+#include "gmime-content-field.h"
+
static CamelDataWrapperClass *parent_class=NULL;
@@ -233,8 +235,11 @@ camel_mime_part_get_description (CamelMimePart *mime_part)
static void
_set_disposition (CamelMimePart *mime_part, GString *disposition)
{
- if (mime_part->disposition) g_free(mime_part->disposition);
- mime_part->disposition = disposition;
+ //if (mime_part->disposition) g_free(mime_part->disposition);
+ if (!mime_part->disposition)
+ mime_part->disposition = g_new (GMimeContentField,1);
+ if ((mime_part->disposition)->type) g_free ((mime_part->disposition)->type);
+ (mime_part->disposition)->type = disposition;
}
@@ -249,7 +254,8 @@ camel_mime_part_set_disposition (CamelMimePart *mime_part, GString *disposition)
static GString *
_get_disposition (CamelMimePart *mime_part)
{
- return mime_part->disposition;
+ if (!mime_part->disposition) return NULL;
+ return (mime_part->disposition)->type;
}
@@ -444,14 +450,45 @@ camel_mime_part_get_content_object(CamelMimePart *mime_part)
#ifdef WHPTF
#warning : WHPTF is already defined !!!!!!
#endif
-#define WHPTF camel_mime_utils_write_header_pair_to_file
+#define WHPTF gmime_write_header_pair_to_file
+
+
+static void
+_write_content_to_file (CamelMimePart *mime_part, FILE *file)
+{
+ guint buffer_size;
+ gchar *buffer;
+ gchar *encoded_buffer;
+
+ CamelDataWrapper *content = mime_part->content;
+ // buffer_size = camel_data_wrapper_size (content);
+ buffer = g_malloc (buffer_size);
+ camel_data_wrapper_write_to_buffer (content, buffer);
+
+ if (mime_part->encoding) {
+ // encoded_buffer_size = gmime_encoded_size(buffer, buffer_size, encoding);
+ // encoded_buffer = g_malloc (encoded_buffer_size);
+ // gmime_encode_buffer (buffer, encoded_buffer, encoding);
+ // fwrite (encoded_buffer, encoded_buffer_size, 1, file);
+ // g_free (encoded_buffer);
+ } else
+ fwrite (buffer, buffer_size, 1, file);
+ g_free (buffer);
+}
+
static void
_write_to_file(CamelDataWrapper *data_wrapper, FILE *file)
{
CamelMimePart *mp = CAMEL_MIME_PART (data_wrapper);
- WHPTF (file, "Content-type", CAMEL_DATA_WRAPPER(mp)->mime_type);
+ gmime_content_field_write_to_file(data_wrapper->content_type, file);
+ gmime_content_field_write_to_file(mp->disposition, file);
+ WHPTF (file, "Content-Transfer-Encoding:", mp->encoding);
WHPTF (file, "Content-Description", mp->description);
+ WHPTF (file, "Content-MD5", mp->content_MD5);
+ WHPTF (file, "Content-id", mp->content_id);
+ fprintf(file,"\n");
+ camel_data_wrapper_write_to_file (mp->content, file);
}