aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-message.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-03-15 16:32:08 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-03-15 16:32:08 +0800
commit1043413b4066785b4ee0ba8c38a71c3567e89b8d (patch)
tree33dd9e68cbc55b4496e719c8665f022feaaa6844 /camel/camel-mime-message.c
parentf2a8b1d3388127f9040b17137273a27333361235 (diff)
downloadgsoc2013-evolution-1043413b4066785b4ee0ba8c38a71c3567e89b8d.tar
gsoc2013-evolution-1043413b4066785b4ee0ba8c38a71c3567e89b8d.tar.gz
gsoc2013-evolution-1043413b4066785b4ee0ba8c38a71c3567e89b8d.tar.bz2
gsoc2013-evolution-1043413b4066785b4ee0ba8c38a71c3567e89b8d.tar.lz
gsoc2013-evolution-1043413b4066785b4ee0ba8c38a71c3567e89b8d.tar.xz
gsoc2013-evolution-1043413b4066785b4ee0ba8c38a71c3567e89b8d.tar.zst
gsoc2013-evolution-1043413b4066785b4ee0ba8c38a71c3567e89b8d.zip
set the mime-type field on the content the same way as
2004-03-15 Not Zed <NotZed@Ximian.com> * providers/imap/camel-imap-folder.c (get_content, get_message): set the mime-type field on the content the same way as construct_from_stream does. Bug #55472. * camel-mime-message.c (camel_mime_message_dump): utility function to dump message content to stdout. (camel_mime_message_init): default mime type to message/rfc822. * camel.c (camel_init): change camel verbose debug to be an int, a bitmask of debug options. svn path=/trunk/; revision=25064
Diffstat (limited to 'camel/camel-mime-message.c')
-rw-r--r--camel/camel-mime-message.c61
1 files changed, 58 insertions, 3 deletions
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index bc2a418af5..16b58d991a 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -49,6 +49,8 @@
#define d(x)
+extern int camel_verbose_debug;
+
/* these 2 below should be kept in sync */
typedef enum {
HEADER_UNKNOWN,
@@ -112,11 +114,10 @@ camel_mime_message_class_init (CamelMimeMessageClass *camel_mime_message_class)
camel_medium_class->add_header = add_header;
camel_medium_class->set_header = set_header;
camel_medium_class->remove_header = remove_header;
-
+
camel_mime_part_class->construct_from_parser = construct_from_parser;
}
-
static void
camel_mime_message_init (gpointer object, gpointer klass)
{
@@ -128,6 +129,10 @@ camel_mime_message_init (gpointer object, gpointer klass)
g_hash_table_insert(mime_message->recipients, recipient_names[i], camel_internet_address_new());
}
+ if (((CamelDataWrapper *)mime_message)->mime_type)
+ camel_content_type_unref(((CamelDataWrapper *)mime_message)->mime_type);
+ ((CamelDataWrapper *)mime_message)->mime_type = camel_content_type_new("message", "rfc822");
+
mime_message->subject = NULL;
mime_message->reply_to = NULL;
mime_message->from = NULL;
@@ -157,7 +162,6 @@ camel_mime_message_finalize (CamelObject *object)
g_hash_table_destroy (message->recipients);
}
-
CamelType
camel_mime_message_get_type (void)
{
@@ -961,3 +965,54 @@ camel_mime_message_build_mbox_from (CamelMimeMessage *message)
return ret;
}
+
+static void
+cmm_dump_rec(CamelMimeMessage *msg, CamelMimePart *part, int body, int depth)
+{
+ CamelDataWrapper *containee;
+ int parts, i;
+ int go = TRUE;
+ char *s;
+
+ s = alloca(depth+1);
+ memset(s, ' ', depth);
+ s[depth] = 0;
+ /* yes this leaks, so what its only debug stuff */
+ printf("%sclass: %s\n", s, ((CamelObject *)part)->klass->name);
+ printf("%smime-type: %s\n", s, camel_content_type_format(((CamelDataWrapper *)part)->mime_type));
+
+ containee = camel_medium_get_content_object((CamelMedium *)part);
+
+ if (containee == NULL)
+ return;
+
+ printf("%scontent class: %s\n", s, ((CamelObject *)containee)->klass->name);
+ printf("%scontent mime-type: %s\n", s, camel_content_type_format(((CamelDataWrapper *)containee)->mime_type));
+
+ /* using the object types is more accurate than using the mime/types */
+ if (CAMEL_IS_MULTIPART(containee)) {
+ parts = camel_multipart_get_number((CamelMultipart *)containee);
+ for (i = 0; go && i < parts; i++) {
+ CamelMimePart *part = camel_multipart_get_part((CamelMultipart *)containee, i);
+
+ cmm_dump_rec(msg, part, body, depth+2);
+ }
+ } else if (CAMEL_IS_MIME_MESSAGE(containee)) {
+ cmm_dump_rec(msg, (CamelMimePart *)containee, body, depth+2);
+ }
+}
+
+/**
+ * camel_mime_message_dump:
+ * @msg:
+ * @body:
+ *
+ * Dump information about the mime message to stdout.
+ *
+ * If body is TRUE, then dump body content of the message as well (currently unimplemented).
+ **/
+void
+camel_mime_message_dump(CamelMimeMessage *msg, int body)
+{
+ cmm_dump_rec(msg, (CamelMimePart *)msg, body, 0);
+}