[Dovecot] Question about mbox_snarf and dovecot2.0

Timo Sirainen tss at iki.fi
Thu Apr 29 21:42:36 EEST 2010


On Thu, 2010-04-29 at 14:00 -0400, Jonathan Siegle wrote:

> > - open INBOX from that namespace and keep it open
> 
> Ok sync init would open /var/mail/%u

Well, you would simply call mailbox_open(ns->list, "INBOX"). Dovecot
internally then figures out that INBOX is /var/mail/%u based on the
namespace's configuration.
 
> > 3) every time mbox_snarf_sync_init() is called:
> > - call mbox_snarf()
> > 
> Oh Ok. So mbox_snarf would open the SNARF FILE and do the move and then return it like it does now.

I'm not sure what you mean. I was thinking it would do exactly what it
does now. You give it source and dest mailboxes and it moves messages
from one to the other. (Although one minor optimization could be done:
If no messages are moved, don't call the final mailbox_sync()).

Also note that nothing here now assumes anything about what mailbox
format is being used. The whole plugin should perhaps be renamed to
"snarf", since it would work with any mailbox formats
(source/destination could even be different formats).

> Yeah your thoughts help here. Thanks. Do you have a working example of
> mailbox_opened ? 

You probably want to hook into mailbox_allocated and do the method
overrides there. For that there are many examples in most existing
plugins, like lazy_expunge.

> Would that solve my IDLE problem(doesn't stat /var/spool at all so no
> new messages)?

You can implement that by overriding mailbox.notify_changes method and
calling mailbox_notify_changes(snarf_mailbox) and implementing a
callback handler that does the snarfing whenever it's called. (And also
implement the notify_changes removal code.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20100429/35b4c510/attachment.bin 


More information about the dovecot mailing list