Re: [Dovecot] zlib Plugin Dovecot 2.0 - ostream

2010-05-03 Thread Alex Baule
Hi Timo...

I made the plugin like you say.

The header part is saved by dovecot, with o_stream_send , and the body with
my function.

This implementation, works fine.

But i need to get / change some values to create the link from header to
body.

When a email is saved, have the S an W flags, that is the size of email.
There is a way to increase this Flags ?  I need to put one more line in the
header, to have some link to body.

The second is, the name of file.

I use the o_stream_get_name, passing the output ostream, but the return is
empty. The name is avaliable when ?

Tks Timo.


2010/4/20 Timo Sirainen t...@iki.fi

 You should write the message header to the ostream that you get, and
 message body to some other file that you create. Use the o_stream_send()
 function to write the message header to the ostream (which does
 basically the same as write(fd)). I don't see how getting the stream's
 fd would help with anything.

 On Tue, 2010-04-20 at 11:54 -0300, Alex Baule wrote:
  Because my plugin will separate the body of the message header.
 
  With the FD I have control over the message to separate it.
 
  Do you have any suggestions for this separation?
 
  I do not quite understand how the struct ostream works.
 
  Tks Timo.
 
 
 
  2010/4/20 Timo Sirainen t...@iki.fi
 
   On Tue, 2010-04-20 at 11:40 -0300, Alex Baule wrote:
  
There is a way to get the file descriptor from output used in ostream
   zlib
plugin ?
  
   No. Why do you need it? You should be writing to ostream, not to its
 fd.
  
  




Re: [Dovecot] zlib Plugin Dovecot 2.0 - ostream

2010-04-22 Thread Alex Baule
Hi Timo


I'm doing the plugin based on what you said.

But I'll add a line in the message header,  so the S and W (size of email)
flags, on the file name has to be changed ... There is a way  to do that in
the plugin?


2010/4/20 Alex Baule alexwba...@gmail.com

 If I had the file descriptor, I will reuse my functions to do this,  made
 in a separate library, that i use in the MTA.

 So no need to rewrite again the part of split the message.



 2010/4/20 Timo Sirainen t...@iki.fi

 You should write the message header to the ostream that you get, and
 message body to some other file that you create. Use the o_stream_send()
 function to write the message header to the ostream (which does
 basically the same as write(fd)). I don't see how getting the stream's
 fd would help with anything.

 On Tue, 2010-04-20 at 11:54 -0300, Alex Baule wrote:
  Because my plugin will separate the body of the message header.
 
  With the FD I have control over the message to separate it.
 
  Do you have any suggestions for this separation?
 
  I do not quite understand how the struct ostream works.
 
  Tks Timo.
 
 
 
  2010/4/20 Timo Sirainen t...@iki.fi
 
   On Tue, 2010-04-20 at 11:40 -0300, Alex Baule wrote:
  
There is a way to get the file descriptor from output used in
 ostream
   zlib
plugin ?
  
   No. Why do you need it? You should be writing to ostream, not to its
 fd.
  
  





Re: [Dovecot] zlib Plugin Dovecot 2.0 - ostream

2010-04-20 Thread Alex Baule
Because my plugin will separate the body of the message header.

With the FD I have control over the message to separate it.

Do you have any suggestions for this separation?

I do not quite understand how the struct ostream works.

Tks Timo.



2010/4/20 Timo Sirainen t...@iki.fi

 On Tue, 2010-04-20 at 11:40 -0300, Alex Baule wrote:

  There is a way to get the file descriptor from output used in ostream
 zlib
  plugin ?

 No. Why do you need it? You should be writing to ostream, not to its fd.




Re: [Dovecot] zlib Plugin Dovecot 2.0 - ostream

2010-04-20 Thread Timo Sirainen
You should write the message header to the ostream that you get, and
message body to some other file that you create. Use the o_stream_send()
function to write the message header to the ostream (which does
basically the same as write(fd)). I don't see how getting the stream's
fd would help with anything.

On Tue, 2010-04-20 at 11:54 -0300, Alex Baule wrote:
 Because my plugin will separate the body of the message header.
 
 With the FD I have control over the message to separate it.
 
 Do you have any suggestions for this separation?
 
 I do not quite understand how the struct ostream works.
 
 Tks Timo.
 
 
 
 2010/4/20 Timo Sirainen t...@iki.fi
 
  On Tue, 2010-04-20 at 11:40 -0300, Alex Baule wrote:
 
   There is a way to get the file descriptor from output used in ostream
  zlib
   plugin ?
 
  No. Why do you need it? You should be writing to ostream, not to its fd.
 
 



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] zlib Plugin Dovecot 2.0 - ostream

2010-04-20 Thread Alex Baule
If I had the file descriptor, I will reuse my functions to do this,  made in
a separate library, that i use in the MTA.

So no need to rewrite again the part of split the message.


2010/4/20 Timo Sirainen t...@iki.fi

 You should write the message header to the ostream that you get, and
 message body to some other file that you create. Use the o_stream_send()
 function to write the message header to the ostream (which does
 basically the same as write(fd)). I don't see how getting the stream's
 fd would help with anything.

 On Tue, 2010-04-20 at 11:54 -0300, Alex Baule wrote:
  Because my plugin will separate the body of the message header.
 
  With the FD I have control over the message to separate it.
 
  Do you have any suggestions for this separation?
 
  I do not quite understand how the struct ostream works.
 
  Tks Timo.
 
 
 
  2010/4/20 Timo Sirainen t...@iki.fi
 
   On Tue, 2010-04-20 at 11:40 -0300, Alex Baule wrote:
  
There is a way to get the file descriptor from output used in ostream
   zlib
plugin ?
  
   No. Why do you need it? You should be writing to ostream, not to its
 fd.
  
  




Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-16 Thread Timo Sirainen
On Fri, 2010-04-09 at 11:42 -0300, Alex Baule wrote:

 I developed a plugin based on the zlib plugin, but want to port it to
 dovecot 2.0.
 
 There are some differences in the 2.0 plugin, which I did not quite
 understand how it works for me to readjust it in my plugin.

I don't think you need to do (almost?) any changes. v2.0's zlib plugin
is very different from v1.x, but that's because I'm using zlib library
in a different way. Not because of some istream changes.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-16 Thread Alex Baule
Thanks Timo,

I have another question about the plugin.

Part of reading I already migrated, only that the piece of writing (the new
part in the plugin) I need to understand some things about the operation in
order to migrate and redo the same functions with the separation of body /
header

Can you explain to me ?

Tks again !



2010/4/16 Timo Sirainen t...@iki.fi

 On Fri, 2010-04-09 at 11:42 -0300, Alex Baule wrote:

  I developed a plugin based on the zlib plugin, but want to port it to
  dovecot 2.0.
 
  There are some differences in the 2.0 plugin, which I did not quite
  understand how it works for me to readjust it in my plugin.

 I don't think you need to do (almost?) any changes. v2.0's zlib plugin
 is very different from v1.x, but that's because I'm using zlib library
 in a different way. Not because of some istream changes.




Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-16 Thread Timo Sirainen
On Fri, 2010-04-16 at 09:55 -0300, Alex Baule wrote:

 Part of reading I already migrated, only that the piece of writing (the new
 part in the plugin) I need to understand some things about the operation in
 order to migrate and redo the same functions with the separation of body /
 header

So you also want to add support for the split operating directly during
saving new mails?

I guess you can copypaste most of the code from zlib-plugin.c and just
implement a new ostream. ostream-bzlib.c should give a good example. You
just need to implement:

 - sendv(): this works similar to writev() syscall. Here you need to
keep read the input bytes and track when the message header ends and
write to different files before/after that.

 - flush(): If you do any buffering, flush it here.

That's about it. Much simpler than istreams!



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-16 Thread Timo Sirainen
On Fri, 2010-04-16 at 18:34 +0300, Timo Sirainen wrote:
 On Fri, 2010-04-16 at 09:55 -0300, Alex Baule wrote:
 
  Part of reading I already migrated, only that the piece of writing (the new
  part in the plugin) I need to understand some things about the operation in
  order to migrate and redo the same functions with the separation of body /
  header
 
 So you also want to add support for the split operating directly during
 saving new mails?
 
 I guess you can copypaste most of the code from zlib-plugin.c and just
 implement a new ostream. ostream-bzlib.c should give a good example. You
 just need to implement:

Oh, and the output ostream that you get from create() is the one that
ends up in the maildir. So I guess you should be writing headers there,
and write the body to another file some other way.



signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-16 Thread Alex Baule
Ok !

That's easy.

In the sendv rewrite, have this:

 for (i = 0; i  iov_count; i++) {
   if (o_stream_emexis_send_chunk(emexis_stream, iov[i].iov_base,
iov[i].iov_len)  0)
   return -1;
   bytes += iov[i].iov_len;
   }

This iov is every line from the new emaill to save ?

Or this is a email block with X bytes ?

In my function to write email, i split the email by \n, to save it splited,
and if the iov is splited by \n, is good for me.


2010/4/16 Timo Sirainen t...@iki.fi

 On Fri, 2010-04-16 at 18:34 +0300, Timo Sirainen wrote:
  On Fri, 2010-04-16 at 09:55 -0300, Alex Baule wrote:
 
   Part of reading I already migrated, only that the piece of writing (the
 new
   part in the plugin) I need to understand some things about the
 operation in
   order to migrate and redo the same functions with the separation of
 body /
   header
 
  So you also want to add support for the split operating directly during
  saving new mails?
 
  I guess you can copypaste most of the code from zlib-plugin.c and just
  implement a new ostream. ostream-bzlib.c should give a good example. You
  just need to implement:

 Oh, and the output ostream that you get from create() is the one that
 ends up in the maildir. So I guess you should be writing headers there,
 and write the body to another file some other way.




Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-16 Thread Timo Sirainen
On 16.4.2010, at 19.15, Alex Baule wrote:

 This iov is every line from the new emaill to save ?
 
 Or this is a email block with X bytes ?
 
 In my function to write email, i split the email by \n, to save it splited,
 and if the iov is splited by \n, is good for me.

You can't assume anything about iov. iov_count is typically 1, but can be much 
more. Each block's length can be from 1 byte to anything (typically less than 
8kB I guess).

Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-09 Thread Alex Baule
I Dont want the configuration.

I Want know how is implemented.

Explain, the functions, the hooks to get write a email

stuffs like this.

2010/4/8 Alex Baule alexwba...@gmail.com

 Hi Everyone

 Someone can explain to me the difference from zlib 1.2.X and 2.0 beta4 ??

 In zlib from 2.0 beta4, Which part of the plugin is responsible for write
 the compressed message ?





Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-09 Thread Pascal Volk
On 04/09/2010 02:45 PM Alex Baule wrote:
 I Dont want the configuration.
 
 I Want know how is implemented.
 
 Explain, the functions, the hooks to get write a email
 
 stuffs like this.

How it is implemented:
http://hg.dovecot.org/dovecot-2.0/file/tip/src/plugins/zlib


Regards,
Pascal
-- 
The trapper recommends today: defaced.1009...@localdomain.org


Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-09 Thread Alex Baule
Hi Paschal

You do not understand what I want.

I developed a plugin based on the zlib plugin, but want to port it to
dovecot 2.0.

There are some differences in the 2.0 plugin, which I did not quite
understand how it works for me to readjust it in my plugin.

As in the source code there are not many comments, I do not quite know what
each function does, if they are all necessary in my adaptation.

In developing the plugin in version 1.4, Timo helped me a lot.

What I need to know is how the hooks on write emails do this,  and what the
differences in the read function, since the code is different from version
1.4 to 2.0.


Re: [Dovecot] zlib Plugin Dovecot 2.0

2010-04-09 Thread Alex Baule
Hi Paschal

You do not understand what I want.

I developed a plugin based on the zlib plugin, but want to port it to
dovecot 2.0.

There are some differences in the 2.0 plugin, which I did not quite
understand how it works for me to readjust it in my plugin.

As in the source code there are not many comments, I do not quite know what
each function does, if they are all necessary in my adaptation.

In developing the plugin in version 1.4, Timo helped me a lot.

What I need to know is how the hooks on write emails do this,  and what the
differences in the read function, since the code is different from version
1.4 to 2.0.


2010/4/9 Alex Baule alexwba...@gmail.com

 I Dont want the configuration.

 I Want know how is implemented.

 Explain, the functions, the hooks to get write a email

 stuffs like this.

 2010/4/8 Alex Baule alexwba...@gmail.com

 Hi Everyone

 Someone can explain to me the difference from zlib 1.2.X and 2.0 beta4 ??

 In zlib from 2.0 beta4, Which part of the plugin is responsible for write
 the compressed message ?