This email /was/ going to be a bit of a bitch about trying to get mysql compiled in to a dovecot plugin, but I got it all working before I finished the email! :-D Ok, basically what I am doing (Johannes permission) is modifying the dspam plugin, so that it instead talks to a database (MySQL in this case), and updates a table, so that you can do the actual training at a time of lower load. It /does/ require MySQL >= 5 cause I am using stored PROCEDURE's, which gives you the advantage, that you can use the same plugin, without changing anything, regardless of what your database looks like, or how you want the database to work! :-D I have successfully modified Johannes plugin to call SPAM and HAM in the database, with the signatures, and also upgraded it to work with beta9. I also made the small change of a define for the Spam folder, so that if your Spam folder is named differently, you don't have to change the code in 2-3 places as well ;-) I am yet to write any 'batch' code for processing the database tables, but that is fairly trivial, and I could even write it in php if I wanted ;-) (If you want something to do, go ahead and write me a C client to do this! I'll get to it eventually, and you can reuse most of the code from the plugin!) See http://members.plug.org.au/~linuxalien/dokuwiki/projects:dovecot-mysql-dspam-plugin for more details, and the code! Feed back, comments, and criticism are all welcome! Tim -- Linux Counter user #273956
On Fri, 2006-06-23 at 20:27 +0800, Timothy White wrote:> I have successfully modified Johannes plugin to call SPAM and HAM in > the database, with the signatures, and also upgraded it to work with > beta9. I also made the small change of a define for the Spam folder, > so that if your Spam folder is named differently, you don't have to > change the code in 2-3 places as well ;-) >> Feed back, comments, and criticism are all welcome!Cool. I'll look at it in a week, preparing for an exam right now. johannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 793 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20060623/2220cc9f/attachment.bin>
On Fri, 2006-06-23 at 20:27 +0800, Timothy White wrote:> I have successfully modified Johannes plugin to call SPAM and HAM in > the database, with the signatures,Your call_dspam routine is a bit bogus, the neither exit(127) nor return -1 can ever execute ;) The original code must have had something like that because it was forking, but your code doesn't. Same goes for mysqlinit(), you shouldn't exit() from a plugin, just return an error to the imap connection. If you exit(), the imap connection dies. Also, you should lazily init the mysql connection and then either close it, or keep it open and re-use it, currently you don't close it but re-init the mysql context and reconnect, that's probably going to create a bunch of stale connections to the database. If you decide to go for the route that keeps the connection open for the next time, then you will need to check for disconnects before using the connection again, the database might have been restarted and you don't want the plugin to fall on its nose over that, it should just reconnect... johannes -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 793 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20060626/59e96e56/attachment.bin>