I have an Eggdrop-Bot up and running. Now I want to script a script which is triggered by an event on the server. Like an e-Mail arrives, the mailer pipes the content of the mail to the bot and the bot parses the mail and displays its content in the chan.
Till now I have not a single clue how an external event can trigger an eggdrop script - is there any chance to do this?
i dont exactly know how email filenames are aranged, but using the tcl command file exists or mtime there should be possibilites to check the email dir on a time bind.
probably you would wana use imapd or pop3d, but if you wana use the mail file then file exists won't do you no good if you know that mail is stored in one file and every mail that is read has Status: RO or something like it..
mail is ceperated by mailheader (From: .. ) so if a new mail is arraived just open your mail file /var/mail probably and look for mail with no Status: RO in the header
to stress it out: I don't want a timed event (because it would be too easy .
My current approch looks like: e-Mail received by qmail. prcomail triggers a sighup to eggdrop which starts the mail script everytye sighup is received (bind evnt). The script looks in the maildir, parses all new mail an deletes every parsed mail. So I don't have to deal with the mbox stuff.
The best soloution would be in my opinion if the eggdrop opens an unix socket where i can "pipe" in the mail and a tcl script processes the data received on that socket - is this possible?
to stress it out: I don't want a timed event (because it would be too easy .
My current approch looks like: e-Mail received by qmail. prcomail triggers a sighup to eggdrop which starts the mail script everytye sighup is received (bind evnt). The script looks in the maildir, parses all new mail an deletes every parsed mail. So I don't have to deal with the mbox stuff.
The best soloution would be in my opinion if the eggdrop opens an unix socket where i can "pipe" in the mail and a tcl script processes the data received on that socket - is this possible?
bye
Darky
yeah i gues so but i don't see the use .. if you bind to every minute then it can be done like 1000000000 times more easy why do it the hard way? hell and a socket can kill the bot if you don't be carefull, well i wouldn't like .. to use a socket in this way
I don't think tcl has commands to deal with unix sockets, just tcp. You could load an extension (I'm sure there are some), or write a module instead. Also there's almost no difference between a tcp socket and a unix socket so you could just use that. The easiest thing would be to use a named pipe instead of a socket and use regular file commands.