I've got an eggdrop tcl script, which takes output from a php script, and then announces it to a channel.
The php output is in the form:
line 1
line 2
line 3
etc
here are the lines of php code that send the output:
Code: Select all
$fp = fsockopen ($botaddr, $botport, $errno, $errstr, 120);
fputs($fp,"{ \00314:::::::::::::::::::::::::::::::::: \0031[ \002\0037Test Title \002\0031] \00314:::::::::::::::::::::::::::::::::: } ");
fputs($fp,"{ [\00314".$title."\0031] \00314::\0031 [\00314HEADING\0031] \00314::\0034 ".$lastthread." \00314::\0031 [\00314BY\0031] \00314::\0034 ".$lastposter." \00314@\0037 ".$tname." } ");
fputs($fp,"{ \00314:::::::::::::::::::::::::::::::::: \0031[ \002\0037--------------------- \002\0031] \00314:::::::::::::::::::::::::::::::::: } \n\n");
here is the tcl script that processes the php output:
Code: Select all
listen 22625 script vbulletinaccept_admin1
proc vbulletinaccept_admin1 {idx} {
putlog "ADMIN1: incoming connection on idx: $idx"
control $idx vbincoming_admin1
}
proc vbincoming_admin1 {idx arg} {
if {[join $arg] != ""} {
for { set i 0 } { $i < [llength $arg] } { incr i } {
if {[lindex $arg $i] != ""} {
putserv "PRIVMSG #somechan :[lindex $arg $i]"
}
}
}
killdcc $idx
}
The tcl code is supposed to take each line from the php script, and output them on irc. But I get alot of tcl errors about "unmatched open brace in list", and only 1 line of text is shown on irc, also not sure if that is the correct fputs syntax for the php code..
Is there something I'm missing on the php side of things, or is there a way to prevent any errors from the tcl side? I have also tried using regsub to add backslashes to characters like {}[] in the tcl proc, but no luck their either