[Dovecot] Programming Help
Hi,
I was hoping you could provide me with some pointers on how to get started adding some features to dovecot.
What I am trying to do is add an optional publish mechanism, that would publish a list of events as they occur, so that an external program could read these events and do "something".
These events would be "Add", "Delete", "Move" - these would be posted every time a new message is added, deleted or moved.
"CreateDir", "DeleteDir" would be published when a user creates a subf-folder or removes one.
A simple example would be to configure the system to publish 'Add Message' events, and then an external program would read these, and send a notification event to web based users who are currently logged in.
The publish feature would be controlled by the config file, and would be disabled by default
The config setting would allow an administrator to specify what events to publish, the mechanism to use, and optional arguments for the mechanism
For mechanisms I plan on developing a file based system, one file per event, written into a directory, the subscriber/reader would delete the file
Other mechanisms could include TCP/IP based (connect to port XX, and send some data); or even connect to a commercial Message Queue product.
Ex.
Publish=ADD+DELETE+MOVE:file:/var/spool/imapevents
Or
Publish=ADD+DELETE+MOVE:tcpip:localhost:9999
It would help me a lot if you could just provide me with a few pointers as to the best place to add my features into the dovecot code, I took a quick look at the code and decided to contact you first before going ahead and putting things in the WRONG place. I did see the code for supporting inotify and similar mechanisms, but I don't see the big picture ? How does dovecot use inotify ?, what features are enabled that you don't get without inotify.
If you have a code-roadmap, or architectural diagrams (or doodles) that would be helpful too.
In terms of inotify, I don't think this will work for me, since I would like to have the user, Message-Id and Imap UIDL sent in the event message
I hope this makes sense, if not just send me an email asking for clarification.
All of the changes I make I will submit back to you, and hopefully they will be made part of the base product.
Thanks,
Neal Katz
p.s. I chose Dovecot because I was very impressed with the ease of installation and migration (from courier), my early tests have shown it to be twice as fast when traverse all messages in a large mailbox ( 100K message ).
Neal Katz wrote:
Hi,
I was hoping you could provide me with some pointers on how to get started adding some features to dovecot.
Have you looked at the code yet?
From my own experiences with writing code for Dovecot, I think you'll find Timo has done a brilliant job of keeping the code clean, clear, and well organised. It rarely takes much effort to work out which area of the code to investigate.
...meanwhile...
What you're proposing sounds interesting - I can certainly see the benefits of it. Though, have you looked at D-Bus? Perhaps worth considering.
-- Curtis Maloney cmaloney@cardgate.net
On 8.2.2006 10:38, "Neal Katz" <nak@iyago.com> wrote:
Hi, I was hoping you could provide me with some pointers on how to get started adding some features to dovecot.
What I am trying to do is add an optional publish mechanism, that would publish a list of events as they occur, so that an external program could read these events and do ³something². These events would be ³Add², ³Delete², ²Move² these would be posted every time a new message is added, deleted or moved. ²CreateDir², ²DeleteDir² would be published when a user creates a subf-folder or removes one.
Sounds like this should be done by a plugin. You can hook into mail-storage API to see the changes.
You could look as an example the plugins distributed with 1.0beta3. For example quota plugin hooks into several places.
It would help me a lot if you could just provide me with a few pointers as to the best place to add my features into the dovecot code, I took a quick look at the code and decided to contact you first before going ahead and putting things in the WRONG place. I did see the code for supporting inotify and similar mechanisms, but I don¹t see the big picture ? How does dovecot use inotify ?, what features are enabled that you don¹t get without inotify.
Inotify doesn't really matter. It would be just an optimization. You'd probably want to hook into mail_storage->sync_next() to see the mail additions/expunges.
If you have a code-roadmap, or architectural diagrams (or doodles) that would be helpful too.
Not currently, sorry. There is some out of date design docs in doc/design.txt though..
In terms of inotify, I don¹t think this will work for me, since I would like to have the user, Message-Id and Imap UIDL sent in the event message
In sync interface you can ask those from the mail.
participants (3)
-
Curtis Maloney
-
Neal Katz
-
Timo Sirainen