evolution-data-server r8354 - trunk/camel



Author: fejj
Date: Fri Jan 11 20:52:37 2008
New Revision: 8354
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8354&view=rev

Log:
2008-01-11  Jeffrey Stedfast  <fejj novell com>

	Slightly modified version of a patch submitted by Jean-Christophe
	BEGUE for bug #329692.

	* camel-mime-part.c (camel_mime_part_get_content_size): Get the
	decoded content size of a MIME part.



Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-mime-part.c
   trunk/camel/camel-mime-part.h

Modified: trunk/camel/camel-mime-part.c
==============================================================================
--- trunk/camel/camel-mime-part.c	(original)
+++ trunk/camel/camel-mime-part.c	Fri Jan 11 20:52:37 2008
@@ -1060,3 +1060,31 @@
 		medium->content = NULL;
 	}
 }
+
+/**
+ * camel_mime_part_get_content_size:
+ * @mime_part: a #CamelMimePart object
+ *
+ * Get the decoded size of the MIME part's content.
+ *
+ * Returns the size of the MIME part's content in bytes.
+ **/
+size_t
+camel_mime_part_get_content_size (CamelMimePart *mime_part)
+{
+	CamelStreamNull *null;
+	CamelDataWrapper *dw;
+	size_t size;
+	
+	g_return_val_if_fail (CAMEL_IS_MIME_PART (mime_part), 0);
+	
+	dw = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
+	
+	null = camel_stream_null_new ();
+	camel_data_wrapper_decode_to_stream (dw, null);
+	size = null->written;
+	
+	camel_object_unref (null);
+	
+	return size;
+}

Modified: trunk/camel/camel-mime-part.h
==============================================================================
--- trunk/camel/camel-mime-part.h	(original)
+++ trunk/camel/camel-mime-part.h	Fri Jan 11 20:52:37 2008
@@ -103,6 +103,8 @@
 void      	camel_mime_part_set_content 	       (CamelMimePart *mime_part,
 							const char *content, int length, const char *type);
 
+size_t          camel_mime_part_get_content_size       (CamelMimePart *mime_part);
+
 G_END_DECLS
 
 #endif /* CAMEL_MIME_PART_H */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]