First of all,
drop all those random list operations, they won't do you any good like that.
Secondly,
Have you verified that the lftp.log file is actually created by the lftp client? As far as I can tell, lftp sends logging to ~/.lftp/log, and only if the process is run in background mode (which you are currently not doing).
I would assume that you should actually catch the stdout output, and print this instead:
Code: Select all
proc lftp {nick host handle channel text} {
set result [exec lftp -c open ip -u user,password -p port -e "site $text ; quit"]
#convert the result into a list - splitting on newlines
#then iterate through the list and print each item (line)
foreach line [split $result "\n"] {
puthelp "PRIVMSG $channel :$line"
}
}
Be adviced though, that there is a serious security-issue with the code. There is nothing to prevent a malicious user from adding a ; to the command string, and then using the ! command to run arbitrary code on the shell..
There's quite a few other ways this could be abused, so I would stronlgy advice against letting irc users gain access to code such as this...
You have been warned