On Wed, 2012-02-22 at 22:54 +0000, Ed W wrote:
Quick followup question - the logout log file currently logs a bunch of statistics such as mails read/deleted, bytes sent/received. How might I access these from the _deinit context as above? Apologies if this is a RTFM question? You'd have to build separate plugins for POP3 and IMAP, and even then it becomes tricky since there's no simple hook for catching when client gets destroyed.
Do you think you could keep something similar on your low priority backlog? Clearly parsing log files or hacking the code is possible, but I think the interest in the login scripting shows there is general interest, and having a full log of logon/logoff/bytes is clearly interesting to more minority users?
What do you need the statistics for? I could make imap_client and pop3_client support some virtual methods, like user.destroy() initially, which would be enough for your use. I guess I could add that for v2.2.
Finally, do you see it feasible to offer a "scriptable" plugin interface, eg perhaps using some high performance scripting language such as lua? Such a plugin might itself be simply a standard plugin..? The motivation being to offer the ability to create plugins to those who are nervous of using a compiler, and of course to reduce the ability of a badly written plugin to kill dovecot? I've been thinking about adding a scripting language plugin to Dovecot. Perhaps even using one of the existing generators that are supposed to make this easy for multiple languages, such as SWIG. But this is pretty low priority currently..
I think SWIG is for wrapping dovecot's api into the scripting language?
(ie you could call dovecot methods from say perl/python/etc). What I had in mind was the reverse, ie embed LUA inside dovecot. Whenever dovecot normally calls a plugin method it will also run any [lua] scripts.
Yes, but I think SWIG can do that too. You'll need Dovecot's API implemented for scripting language if you want to do anything useful in the embedded script. That's the biggest job actually. Actually embeddeding some scripting language to Dovecot processes would be simple, they just couldn't really do anything useful.
Also the nice thing about generically implementing Dovecot's APIs means that they could be used to build independent Dovecot applications, not just plugins.
I'm sure you know how to use google, but just so we are on the same page, top hit (below) from google shows how straight forward this is (lua has been built to be extremely fast and easy to embed, ie it's not an arbitrary choice) http://heavycoder.com/tutorials/lua_embed.php
I've heard LUA being a commonly used embedded language, but I'd prefer to instead support several very widely used languages, such as Perl/Python.