On 6/26/06, Johannes Berg johannes@sipsolutions.net wrote:
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.
The original code had those 2 lines. exit(127); /* fall through if dspam can't be found */ return -1; /* never executed */ Now I look at it, I can do without both of them.
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.
Done.
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.
Hmmm, show's that I'm a bad programmer. I can't believe I left connections open, I don't normally do that! This lib-dict stuff sounds good. Timo, do you have an example of how to use it? Otherwise, for now I'll just close the connections.
Tim
Linux Counter user #273956