#
# weber   (by robey, 19aug95)
#   you may want to edit the format cos i just threw this together in
#   15 minutes (literally).  but try it first so you can see what it's
#   doing.
#
#   if a user's info line starts with "http://" then their nickname will
#   be a link to their chosen site.
#

proc do_weber {} {
  global channel
  set fd [open "test.html" w]
  puts $fd "<html><head><title>People on $channel right now</title></head>"
  puts $fd "<body background=#00ff00><h1>People on $channel</h1>"
  puts $fd "<b>[date] [time]</b><p><pre>"
  foreach i [chanlist] {
    if {[isop $i]} { set chop "@" } { set chop " " }
    if {[getchanidle $i] > 10} { set idle "(idle)" } { set idle "      " }
    set info [getinfo [finduser $i![getchanhost $i]]]
    if {[string compare [string range $info 0 6] "http://"] == 0} {
      set link [lindex [split $info] 0]
      puts $fd "<a href=\"$link\">${chop}[format %-9s $i]</a> $idle [getchanhost $i]"
    } {
      puts $fd "${chop}[format %-9s $i] $idle [getchanhost $i]"
    }
  }
  puts $fd "</pre><p><hr>"
  puts $fd "<address>Created by irc weber via eggdrop!</address></body></html>"
  close $fd
  timer 1 do_weber
}

if {![info exists weber_going]} {
  timer 1 do_weber
  set weber_going 1
}
