Re: API docs are being updated
- From: Philip Van Hoof <spam pvanhoof be>
- To: Sergio Villar Senin <svillar igalia com>
- Cc: tinymail-devel-list gnome org
- Subject: Re: API docs are being updated
- Date: Tue, 26 Dec 2006 12:47:52 +0100
On Tue, 2006-12-26 at 11:24 +0100, Sergio Villar Senin wrote:
> Philip Van Hoof wrote:
> > I'm atm again fine tuning the API docs a little bit.
> >
> > I also changed the TnyPlatformFactory API a little bit (three new
> > methods). This is already reflected in the documentation on the trac and
> > in the API docs too.
>
> Merry X-mass everybody,
>
> really very useful methods for app developers, because this help us to
> decouple the application a little bit more from Camel. BTW any plans to
> add another method like tny_platform_factory_new_stream() to the API?
Like a memory stream then?
Because the streams are specific per purpose. For example, you can have
a file stream, a stream that reads and writes from a gtktextbuffer, a
stream that reads and writes from a gecko component, a stream that reads
from a tcp/ip service, one that reads and writes from a tcp/ip service
over SSL.
I recently created a TnyCamelMemStream that stores, reads and writes
from memory.
Doing this is not the recommended way, of course. That's because it
actually consumes memory, whereas that is exactly what you try to avoid
when using streams.
For example in stead of copying a large attachment into memory while
composing a E-mail that must be send, you make file streams and
construct the mime parts using those.
This way wont the attachments go into memory, yet when sending happens,
they will be streaming straight from the file to the tcp/ip connection
with the SMTP server.
Or, that is the idea at least.
I know all this might sound a little bit complicated. But if you think
about it, it makes sense ;-)
int filedes = open ("file.jpg", ...);
TnyStream *stream = tny_fs_stream_new (filedes);
TnyMsg *msg = tny_platform_factory_new_msg (platfact);
TnyMimePart *part = tny_platform_factory_new_mime_part (platfact);
tny_mime_part_construct_from_stream (part, stream, "text/plain");
g_object_unref (G_OBJECT (stream));
tny_msg_add_part (msg, part);
Note that a lot of these things might not yet work. That's primarily
because I haven't put a lot focus on this yet. I can use some testing
and debugging work, indeed.
--
Philip Van Hoof, software developer
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
http://www.pvanhoof.be/blog
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]