New constructor: tny_camel_mem_stream_new_with_buffer()
- From: Alberto Garcia <agarcia igalia com>
- To: tinymail-devel-list gnome org
- Subject: New constructor: tny_camel_mem_stream_new_with_buffer()
- Date: Thu, 6 Mar 2008 12:30:42 +0100
This patch adds a new constructor to TnyCamelMemStream, so you can
create one with initial data.
--
Alberto García González
http://people.igalia.com/berto/
Index: libtinymail-camel/tny-camel-mem-stream.c
===================================================================
--- libtinymail-camel/tny-camel-mem-stream.c (revision 3473)
+++ libtinymail-camel/tny-camel-mem-stream.c (working copy)
@@ -43,6 +43,26 @@
return TNY_STREAM (self);
}
+/**
+ * tny_camel_mem_stream_new_with_buffer:
+ * @buffer: a memory buffer to use as the stream data
+ * @len: length of @buffer
+ *
+ * Create a new in-memory stream
+ *
+ * Return value: a new #TnyStream instance
+ **/
+TnyStream*
+tny_camel_mem_stream_new_with_buffer (const char *buffer, size_t len)
+{
+ TnyCamelMemStream *self = g_object_new (TNY_TYPE_CAMEL_MEM_STREAM, NULL);
+ TnyCamelStreamPriv *priv = TNY_CAMEL_STREAM_GET_PRIVATE (self);
+
+ priv->stream = camel_stream_mem_new_with_buffer (buffer, len);
+
+ return TNY_STREAM (self);
+}
+
static void
tny_camel_mem_stream_instance_init (GTypeInstance *instance, gpointer g_class)
{
Index: libtinymail-camel/tny-camel-mem-stream.h
===================================================================
--- libtinymail-camel/tny-camel-mem-stream.h (revision 3473)
+++ libtinymail-camel/tny-camel-mem-stream.h (working copy)
@@ -49,6 +49,7 @@
GType tny_camel_mem_stream_get_type (void);
TnyStream* tny_camel_mem_stream_new (void);
+TnyStream* tny_camel_mem_stream_new_with_buffer (const char *buffer, size_t len);
G_END_DECLS
Index: ChangeLog
===================================================================
--- ChangeLog (revision 3474)
+++ ChangeLog (working copy)
@@ -1,5 +1,11 @@
2008-03-06 Alberto Garcia Gonzalez <agarcia igalia com>
+ * tinymail/libtinymail-camel/tny-camel-mem-stream.h
+ * tinymail/libtinymail-camel/tny-camel-mem-stream.c:
+ Added tny_camel_mem_stream_new_with_buffer()
+
+2008-03-06 Alberto Garcia Gonzalez <agarcia igalia com>
+
* debian/libtinymail-camel-1.0-0.install
* debian/libtinymail-camel-1.0-0-dev.install:
Install libcamel-lite
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]