From: Michael R. <re...@eu...> - 2004-04-08 12:11:31
|
Hi Javi, > While the official e-mail plugin is been ported to N.G, I've wrote my own simple mail plugin, based on the "pop3check" code from http://sourceforge.net/projects/pop3check. > It only supports POP3, but I've spent more time writing it than I spent writing MySQL's one :0 Look great! But I'd suggest some changes: - move the plugin_init and _exit functions to the bottom of the plugin (so they are easier to find) - move the call to getConfig() out of the init() function, into the data fetch function, but call it only once on the first turn, so the init() function does nothing but register the function (same as for the i2c_sensors plugin) - rename the function from POP3check to Mailbox (??) - use a slightly differen config layout: Mailbox 'Private' { server 'localhost' port 110 user 'me' pass 'dontknow' } Mailbox 'Business' { server 'mail.company.com' user 'me_again' pass 'forgotten' } Widget Email { class 'Text' expression Mailbox('Private') } This way the #define MAX_NUM_ACCOUNTS 3 could go away... - most important thing: make it asynchronous! Take a look at the plugin_exec. But beware: The code isn't that clean by now... bye, Michael -- Michael Reinelt Tel: +43 676 3079941 Geisslergasse 4 Fax: +43 316 692343 A-8045 Graz, Austria e-mail: re...@eu... |