# # quesedilla, by robey # v1 -- 20aug95 # v2 -- 2oct95 [improved it] # v3 -- 17mar96 [fixed it up for 1.0 multi-channel] # v3.1 -- 27aug97 [little changes for more nice page by fantomas] # # this will create an html file every so often (the default is once every # 5 minutes). the html file will have a table showing the people currently # on the channel, their user@hosts, who's an op, and who's idle. it # uses a table which some browsers (and pseudo-browsers like lynx) can't # see, but it can optionally make a second page which will support these # archaic browsers. browsers supporting push-pull will receive the updated # page automatically periodically. # # if you have a "url" field defined for a user, their nickname in the # table will be a link pointing there. otherwise it checks the info # line and comment field to see if they start with "http://" -- if so, # that link will be used. as a last resort, it will make a "mailto:" # link if an email address is recorded for the user. # # feel free to modify and play with this. the original was written in # 15 minutes, then at various times i fixed bugs and added features. # softlord helped me make the design look a little nicer. :) if you make # any nifty improvements, please let me know. # robey@netcom.com ## this line makes sure other scripts won't interfere catch {unset webfile} ## for each channel you want a webfile for, do this: set webfile(#cs) "/home/bot/html/cs.html" ## define these for channels you want alternate (lynx-friendly) web pages ## for: (the 'lynxfilerf' needs to be relative to your html directory) set lynxfile(#cs) "/home/bot/html/cs-lynx.html" set lynxfilerf(#cs) "cs-lynx.html" ## how often should these html files get updated? ## (1 means once every minute, 5 means once every 5 minutes, etc) set web_update 5 ## define email address where should ppl send comments to this page set email "bot@ccnews.ke.sanet.sk" ## this will help people figure out what timezone you're in :) set webtz [clock format 0 -format %Z] ## if that line breaks, you're using an older Tcl library and will have to ## set it manually like so: #set webtz "PST" proc do_ques {} { global webfile lynxfile web_update botnick webtz lynxfilerf email foreach chan [array names webfile] { if {[lsearch -exact [string tolower [channels]] [string tolower $chan]] == -1} {continue} set fd [open $webfile($chan) w] if {[info exists lynxfile($chan)]} { set fdl [open $lynxfile($chan) w] } else { set fdl [open "/dev/null" w] } puts $fd "" puts $fdl "" puts $fd "" puts $fdl "" puts $fd "People on $chan right now" puts $fdl "People on $chan right now" puts $fd "" puts $fdl "" puts $fd "" puts $fdl "" if {![onchan $botnick $chan]} { puts $fd "

Oops!

" puts $fdl "

Oops!

" puts $fd "I'm not on $chan right now for some reason.
" puts $fdl "I'm not on $chan right now for some reason.
" puts $fd "IRC isn't a very stable place these days... Please try again" puts $fdl "IRC isn't a very stable place these days... Please try again" puts $fd "later!

" puts $fdl "later!

" } { puts $fd "

$chan

" puts $fdl "

$chan

" if {[info exists lynxfile($chan)]} { puts $fd "

If this page looks screwy on your browser, try" puts $fd "this page.

" } puts $fd "" puts $fd "" puts $fd "" if {[isop $i $chan]} { set chop "op"} { set chop "" } if {[getchanidle $i $chan] > 10} { if {$chop == ""} { set chop "idle" } { set chop "${chop}, idle" } } set handle [finduser $i![getchanhost $i $chan]] if {[onchansplit $i $chan]} { if {$chop == ""} { set chop "(split)" } { set chop "${chop} (split)" } } set url [user-get $handle url] set info [getinfo $handle] set comment [getcomment $handle] if {"" == $chop} { set chop "-" } set link "" if {"" != $url} { set link "" } if {("" == $link) && ([string compare [string range $comment 0 6] "http://"] == 0)} { set link "" } if {("" == $link) && ([string compare [string range $info 0 6] "http://"] == 0)} { set link "" } if {"" == $link} { set email [getemail $handle] if {("" != $email) && ([string first @ $email] > 0)} { set link "" } } if {"" != $link} { set elink "" } { set elink "" } puts $fd "" puts $fd "" set chost [getchanhost $i $chan] if {[string compare [string tolower $i] [string tolower $botnick]] == 0} { set chost "This is me, the channel bot." set info "" } { if {[matchattr $handle b]} { set chost "This is another channel bot." set info "" } } puts $fd "" puts $fdl "${link}[format %-9s $i]${elink} [format %-16s $chop] $chost" if {"" != $info} { puts $fd "" puts $fdl " Info: $info" } } puts $fd "
People on $chan as of [date] [time] $webtz
NicknameStatus" puts $fd "User@Host" puts $fdl "People on $chan as of [date] [time] $webtz
"
      puts $fdl "Nickname  Status           User@Host"
      foreach i [chanlist $chan] {
        puts $fd "
${link}${i}${elink}${chop}${chost}
Info: $info

" puts $fdl "" puts $fd "
This page is automatically refreshed.
" } puts $fd "" puts $fdl "" close $fd close $fdl } timer $web_update do_ques } if {![info exists ques_going]} { timer $web_update do_ques set ques_going 1 } set xxchans "" foreach i [array names webfile] { set xxchans "$xxchans $i" if {![info exists lynxfile($i)]} { set xxchans "$xxchans (no lynx)" } set xxchans "${xxchans}," } set xxchans [string trimright $xxchans ","] putlog "Quesedilla v3.1:$xxchans" unset xxchans