Connects to an IRC server you specify and idles. Basically this is a frame for an IRC bot.
Command line arguments:
tclsh client.tcl irc.kingskrown.com 6667
if {$argc <= 1} {
puts "Usage: client <dstaddr> <dstport>"
return
}
set dstaddr [lindex $argv 0]
set dstport [lindex $argv 1]
set nick "tcl"
set ident "svs"
set gecos "tcl"
set fd [socket $dstaddr $dstport]
puts $fd "NICK $nick"
flush $fd
puts $fd "USER $ident \"\" \"\" :$gecos"
flush $fd
while {[set in [gets $fd]] != -1} {
if {[regexp -nocase {^PING (:[^ ]+)$} $in regex match]} {
puts $fd "PONG $match"
flush $fd
}
puts stdout $in
}
close $fd