aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-mem.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-26 23:29:40 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-26 23:29:40 +0800
commite826255bf13255f2b5c626192de4fd10a3885b6f (patch)
tree7280cb551648d126c30162f28779503a9b1b6eeb /camel/camel-stream-mem.c
parent2a912b33018b0389672d9a4f09496b6a57071388 (diff)
downloadgsoc2013-evolution-e826255bf13255f2b5c626192de4fd10a3885b6f.tar
gsoc2013-evolution-e826255bf13255f2b5c626192de4fd10a3885b6f.tar.gz
gsoc2013-evolution-e826255bf13255f2b5c626192de4fd10a3885b6f.tar.bz2
gsoc2013-evolution-e826255bf13255f2b5c626192de4fd10a3885b6f.tar.lz
gsoc2013-evolution-e826255bf13255f2b5c626192de4fd10a3885b6f.tar.xz
gsoc2013-evolution-e826255bf13255f2b5c626192de4fd10a3885b6f.tar.zst
gsoc2013-evolution-e826255bf13255f2b5c626192de4fd10a3885b6f.zip
contruct the content from the buffer before calling CamelMedium
1999-08-26 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-mime-part.c (_get_content_object): contruct the content from the buffer before calling CamelMedium implementation. (_construct_from_stream): Do not construct the content by default, just store the content bytes in a temporary buffer. Content will be constructed only at caller request (when calling CamelMedium::get_content_object) Providers with better access to the messages (mbox/MH ...) will have to provider lighter implementation, that is shall not read content at all unless the caller asks for it (again with get_content). * camel/camel-mime-part-utils.c: new file, groups mime-part related utils. Meant to be used by providers subclassing MimeMessage. (camel_mime_part_construct_headers_from_stream): (camel_mime_part_construct_content_from_stream): no more useless temporary hash table. * camel/camel-mime-part.c (_construct_from_stream): calls mime-part-utils functions now. * camel/gmime-utils.c (_store_header_pair_from_string): do not use hash table to store header, use an array instead. svn path=/trunk/; revision=1145
Diffstat (limited to 'camel/camel-stream-mem.c')
-rw-r--r--camel/camel-stream-mem.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/camel/camel-stream-mem.c b/camel/camel-stream-mem.c
index 592caa5063..b659e4f30a 100644
--- a/camel/camel-stream-mem.c
+++ b/camel/camel-stream-mem.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-ofmemet: 8 -*- */
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* camel-stream-mem.c : memory buffer based stream */
/* inspired by gnome-stream-mem.c in bonobo by Miguel de Icaza */
@@ -50,11 +50,11 @@ camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class)
{
CamelStreamClass *camel_stream_class = CAMEL_STREAM_CLASS (camel_stream_mem_class);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (camel_stream_mem_class);
-
+
parent_class = gtk_type_class (gtk_object_get_type ());
/* virtual method definition */
-
+
/* virtual method overload */
camel_stream_class->read = _read;
camel_stream_class->write = _write;
@@ -63,16 +63,15 @@ camel_stream_mem_class_init (CamelStreamMemClass *camel_stream_mem_class)
camel_stream_class->eos = _eos;
camel_stream_class->close = _close;
camel_stream_class->seek = _seek;
-
+
gtk_object_class->finalize = _finalize;
-
+
}
static void
camel_stream_mem_init (gpointer object, gpointer klass)
{
CamelStreamMem *camel_stream_mem = CAMEL_STREAM_MEM (object);
- camel_stream_mem->buffer = g_byte_array_new ();
camel_stream_mem->position = 0;
}
@@ -104,13 +103,29 @@ camel_stream_mem_get_type (void)
CamelStream *
camel_stream_mem_new (CamelStreamMemMode mode)
{
- CamelStreamMem *stream_mem;
+ CamelStreamMem *stream_mem;
+ GByteArray *buffer;
- stream_mem = gtk_type_new (camel_stream_mem_get_type ());
- stream_mem->mode = mode;
- return CAMEL_STREAM (stream_mem);
+ buffer = g_byte_array_new ();
+ stream_mem = (CamelStreamMem *)camel_stream_mem_new_with_buffer (buffer, mode);
+ return CAMEL_STREAM (stream_mem);
}
+
+CamelStream *
+camel_stream_mem_new_with_buffer (GByteArray *buffer, CamelStreamMemMode mode)
+{
+ CamelStreamMem *stream_mem;
+
+ stream_mem = gtk_type_new (camel_stream_mem_get_type ());
+ stream_mem->mode = mode;
+ stream_mem->buffer = buffer;
+
+ return CAMEL_STREAM (stream_mem);
+}
+
+
+
static void
_finalize (GtkObject *object)
{