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