[Dovecot] Plugin development question
Hello,
From what I have read on the dovecot site, it's possible to create a plugin for a custom data store format. We have emails in a custom format in a database and would like to create a plugin for accessing these emails through dovecot.
Is there any supporting documentation from creating a plugin like this? Are there any samples?
TIA,
Gary
On Fri, 2007-08-24 at 12:57 -0700, Gary Smith wrote:
Hello,
From what I have read on the dovecot site, it's possible to create a plugin for a custom data store format. We have emails in a custom format in a database and would like to create a plugin for accessing these emails through dovecot.
Is there any supporting documentation from creating a plugin like this? Are there any samples?
I think you should begin with Dovecot v1.1 code which makes it a lot easier. It has Cydir format that is really simple and serves as a pretty good example of how to implement a new backend.
Cydir is a mail_storage backend, but you'll probably need to also implement mailbox_list backend. Shouldn't be too difficult by looking at FS and Maildir++ backends I think.
By database do you mean SQL or something else? I've beginnings of SQL backend plugin already, but I don't remember if it was for v1.0 code or some version of v1.1. http://dovecot.org/patches/mail-sql.tar.gz
I think you should begin with Dovecot v1.1 code which makes it a lot easier. It has Cydir format that is really simple and serves as a pretty good example of how to implement a new backend.
Cydir is a mail_storage backend, but you'll probably need to also implement mailbox_list backend. Shouldn't be too difficult by looking at FS and Maildir++ backends I think.
By database do you mean SQL or something else? I've beginnings of SQL backend plugin already, but I don't remember if it was for v1.0 code or some version of v1.1. http://dovecot.org/patches/mail-sql.tar.gz
Timo,
Thanks for the information. I can't go too much into the project but yes, SQL is one of the stores. This will definitely be helpful. I will download the 1.1 codebase and also take a look at your mail-sql patch as a foundation for what I'm doing.
Gary
I think you should begin with Dovecot v1.1 code which makes it a lot easier. It has Cydir format that is really simple and serves as a pretty good example of how to implement a new backend.
I've been digging though the cydir format. It looks fairly simple. Basically, the short gist of it is that I will be replacing some of the service calls (that retrieve data) with web service calls (to retrieve data). The data for the messages themselves (i.e. the envelope) is stored in a database.
So looking into the cydir, I see the retrieval and storage functions. Since this is read only, this part is pretty simple, I think.
But the Maildir list functions seem a little more complicated. I'm walking through them right now. From looking into it, it seems there are several functions that I will need to define in my own class to handle/override the existing core functions. Where can I get a list of all of the virtual functions that can be derived from, without digging through the code completely.
Also, keeping in mind that everything is basically read only from a client perspective, can I only implement the read functions and still end up with a working system?
Please bear in mind that my C skills are 10 years old, so a lot of this is a learning experience :).
BTW, you mentioned the FS backend. I didn't see that under lib-storage/*.
Gary
Cydir is a mail_storage backend, but you'll probably need to also implement mailbox_list backend. Shouldn't be too difficult by looking at FS and Maildir++ backends I think.
But the Maildir list functions seem a little more complicated. I'm walking through them right now. From looking into it, it seems there are several functions that I will need to define in my own class to handle/override the existing core functions. Where can I get a list of all of the virtual functions that can be derived from, without digging through the code completely.
Somehow I missed all of the lib-storage/list/* files. I've seem to have found most of what I'm looking for. I also discovered the *_vfuncs declarations that list everything that needs overriding. My intent now is to build out a shell wrapper for my plugins.
My only other question for the time being would be the minimal implementation for functions that do nothing. That is, all of the write functions. Do I need to pass down to a base class or just return a default success value (or whatever the return type would be)?
BTW, you mentioned the FS backend. I didn't see that under lib-storage/*.
Gary
participants (2)
-
Gary Smith
-
Timo Sirainen