I would like a tcl to create a nick list in a file HTML
here what I have
Code: Select all
###################################
########### nick list ###########
###################################
set canal "#accueil"
set fsource "/home/loulou/liste.tpl"
set fichier "/home/loulou/public_html/liste.html"
bind join - "$canal *" list:join
bind part - "$canal *" list:part
bind sign - "$canal *" list:quit
proc list:join {nick uhost handle chan} { list:log; }
proc list:part {nick uhost handle chan text} {
if {$nick != $::botnick} { list:log; }
}
proc list:quit {nick uhost handle chan text} {
if {$nick != $::botnick} { list:log; }
}
proc list:log {} {
set ::u(op) {}
set ::u(hop) {}
set ::u(vop) {}
set ::u(nop) {}
set ::count 0
foreach cnick [chanlist $::canal] {
if { $cnick == $::botnick } { continue; }
incr ::count
if { [isop $cnick $::canal] == 1 } {
lappend ::u(op) $cnick
} elseif { [ishalfop $cnick $::canal] == 1 } {
lappend ::u(hop) $cnick
} elseif { [isvoice $cnick $::canal] == 1 } {
lappend ::u(vop) $cnick
} else {
lappend ::v(op) $cnick
}
}
save:log
}
proc save:log {} {
set fp [open $::fichier w]
set fi [open $::fsource r]
set tpl [read $fi -nonewline $fi]
close $fi
$ulist = ""
foreach nick $::u(op) {
append $ulist "<tr><td style='color:red;'>@$nick</td></tr>\n"
}
foreach nick $::u(hop) {
append $ulist "<tr><td style='color:blue;'>%$nick</td></tr>\n"
}
foreach nick $::u(vop) {
append $ulist "<tr><td style='color:yellow;'>+$nick</td></tr>\n"
}
foreach nick $::u(nop) {
append $ulist "<tr><td style='color:green;'>$nick</td></tr>\n"
}
regsub -all %count $tpl $::count tpl
regsub -all %channel $tpl $::canal tpl
regsub -all %list $tpl $ulist tpl
fputs $fp $tpl
close $fp
}
Code: Select all
<html>
<head>
<title>Les %count connectés sur %channel</title>
<style>body { background-color: black; }</style>
</head>
<body>
<table>
<tr><th>Il y a %count personnes sur %channel</th></tr>
%list
</table>
</body>
</html>
but I have this error in partyline
Code: Select all
Tcl error [list:join]: wrong # args: should be "read channelId ?numChars?" or "read ?-nonewline? channelId"