I made a small script wich checks if a FTP Server is up or down and shows the result of the test in an irc channel. Works fine so far. Now to my question. Is it possible, that the result of the script is put into the channel topic? It should look something like this
"FTP 1 up | FTP 2 up | FTP 3 down | FTP 4 up".
Is that possible somehow?
Code: Select all
package require ftp
bind pub - .ftp ftp
proc ftp { nick uhost hand chan arg } {
ftp1 $nick $uhost $hand $chan $arg
ftp2 $nick $uhost $hand $chan $arg
ftp3 $nick $uhost $hand $chan $arg
ftp4 $nick $uhost $hand $chan $arg
}
proc ftp1 { nick uhost hand chan arg } {
set biglist1 {xxx.xxx.xxx.xxx log pas}
foreach {addr uid pwd} $biglist1 {
set statval [ftp::Open $addr $uid $pwd -port 444]
if {$statval<0} {
putserv "PRIVMSG $chan : \002FTP 1\002 \0034down\0034!"
} else {
putserv "PRIVMSG $chan : \002FTP 1\002 \0039up\0039!"
ftp::Close $statval;
}
}
}
proc ftp2 { nick uhost hand chan arg } {
set biglist2 {xxx.xxx.xxx.xxx log pas}
foreach {addr uid pwd} $biglist2 {
set statval [ftp::Open $addr $uid $pwd -port 444]
if {$statval<0} {
putserv "PRIVMSG $chan : \002FTP 2\002 \0034down\0034!"
} else {
putserv "PRIVMSG $chan : \002FTP 2\002 \0039up\0039!"
ftp::Close $statval;
}
}
}
proc ftp3 { nick uhost hand chan arg } {
set biglist3 {xxx.xxx.xxx.xxx log pas}
foreach {addr uid pwd} $biglist3 {
set statval [ftp::Open $addr $uid $pwd -port 444]
if {$statval<0} {
putserv "PRIVMSG $chan : \002FTP 3\002 \0034down\0034!"
} else {
putserv "PRIVMSG $chan : \002FTP 3\002 \0039up\0039!"
ftp::Close $statval;
}
}
}
proc ftp4 { nick uhost hand chan arg } {
set biglist4 {xxx.xxx.xxx.xxx log pas}
foreach {addr uid pwd} $biglist4 {
set statval [ftp::Open $addr $uid $pwd -port 444]
if {$statval<0} {
putserv "PRIVMSG $chan : \002FTP 4\002 \0034:(\0034"
} else {
putserv "PRIVMSG $chan : \002FTP 4\002 \0039:)\0039"
ftp::Close $statval;
}
}
}
putlog "Loaded ftp_test.tcl by DigitalXXL"