I`d like to know if there is a way to make a kind of "logviewer" for eggdrop so i can list files in the logs directory , and open them without the obligation to download it from the eggdrop ( i try to use eggpad.tcl but it`s not made for what i want to do ) i dont want to edit the files but juste open it so i can view it then close it again
bind dcc n readlog dcc:readlog
proc dcc:readlog { h i a } {
if {[llength [split $a]] != 1} {
putdcc $i "usage: .$::lastbind <logfile>"
putdcc $i [join [glob -nocomplain -directory logs *.log]]
return
}
if {![file exists [set f [lindex [split $a] 0]]] || ![file readable $f]} {
putdcc $i "Error..."
return
}
set d [split [read [set fp [open $f r]]] \n] ; close $fp
putdcc $i "LOG START"
foreach l $d { putdcc $i $l }
putdcc $i "LOG END (read [llength $d] lines)"
return
}
something like this should work. i dont know how big the logfile has to be before using [read] becomes a bad idea, but feel free to bitch about it if it breaks your bot
also note that you can read any file that is readable by the eggdrop's uid/gid