I found a little code for tcl which I find very interesting. I state that I am a perfect ignorant on the subject of tcl, eggdrop, etc ..
I don't pretend to learn everything immediately, also because after the age of 30 you lose your mental elasticity: D
Since I've seen this little code and tried it, and it works, I'd like to understand how it works? I would like to understand that short code. I just want someone to explain to me in simple words what that tiny code does, what does it order to do at eggdrop? And after that, I would like to ask:
How was it possible to tell the eggdrop to create that html file that would report the number of users in the channels, it is also possible to publish logs in html? or txt files? chosen by me?
I realize that if this were the case, there would be no complex modules to do these jobs and everything would be solved with 5 lines of code, but I'm just curious to understand why?
As reported in html the number of users with those 5 lines, why can't I write in those 5 lines that file x has to publish, in folder x ???
which can be log, stats etc ...
I repeat, just to understand.
The last thing;
it is possible to enhance these 5 lines of code to make him do something more interesting, such as: publish not only the number but also the nicknames ??? or any other upgrade?
I find this little tcl very interesting indeed. I find it a great starting point for learning tcl logic. Thank you all.
This is the little TCL
Code: Select all
bind time - "* * * * *" web_users
# Path to save html page.
set webusers_file "/var/www/html/index.html"
proc web_users {min hour day month year} {
global webusers_file
if {[file exists "$webusers_file"]} {
set fh [open "$webusers_file" "a+"]
}
set fh [open "$webusers_file" "w+"]
puts $fh "<HTML><HEAD><TITLE>Total users</TITLE></HEAD>"
puts $fh "<BODY>"
foreach chan [channels] {
set users [chanlist $chan]
puts $fh "$chan: [llength $users] users<BR />"
}
puts $fh "</BODY></HTML>"
close $fh
}