# topiclogger.tcl v1.00 [1 August 2000] # Copyright (C) 2000 Teemu Hjelt # # Latest version can be found from http://www.iki.fi/temex/eggdrop/ # # If you have any suggestions, questions or you want to report # bugs, please feel free to send me email to temex@iki.fi # # This script logs topics to a HTML-file. # # Tested on eggdrop1.4.4 with TCL 7.6 # # Version history: # v1.00 - The very first version! ### Settings ### ## HTML-file. set lt_htmlfile "/home/user/public_html/topics.html" ## What kind of body-tag do you want to use in the html-file? set lt_bodytag {} ## What kind of tag do you want to use for stylesheets. # Note: Leave this empty if you don't want to use stylesheets. set lt_styletag {} ## [0/1] Log when this script does something? set lt_log 1 ## [0/1] Log topics of all channels? set lt_allchans 1 ## If $lt_allchans ISN'T enabled this is a list of channels, where topics SHOULD be stored. ## Otherwise this is a list of channels, where topics SHOULDN'T be stored. set lt_chans "#lamest #botcentral" ## If the size of the HTML-file is bigger than this ## (in bytes) then clear the file and start over. # Note: Set this to 0 to disable. set lt_maxsize 500000 ## [0/1] Enable this if you want to use [strftime] instead of [ctime [unixtime]] to show the time and date. set lt_enablestrftime 1 ## If you have enabled $ct_enablestrftime, then set this to the formatstring for strftime. # Note: If you don't have a clue what this is, then leave it like it is. set lt_formatstring "%c" ###### You don't need to edit below this ###### ### Misc Things ### set lt_ver "1.00" ### Bindings ### bind topc - * topc:lt_topic ### Procs ### proc topc:lt_topic {nick uhost hand chan topic} { global botnick lt_ver lt_htmlfile lt_bodytag lt_styletag lt_log lt_allchans lt_chans lt_maxsize lt_enablestrftime lt_formatstring set found 0 set stop 0 set buffer "" if {($topic != "") && ($nick != "*") && ($uhost != "*") && ((($lt_allchans) && ([lsearch -exact [string tolower $lt_chans] [string tolower $chan]] == -1)) || ((!$lt_allchans) && ([lsearch -exact [string tolower $lt_chans] [string tolower $chan]] != -1)))} { if {(![file exists $lt_htmlfile]) || (($lt_maxsize != 0) && ([file size $lt_htmlfile] >= $lt_maxsize))} { lt_writeheader if {$lt_log} { putlog "topiclogger: Writing document header." } } if {(!$lt_enablestrftime) || (($lt_enablestrftime) && ([catch {strftime $lt_formatstring} time]))} { set time [ctime [unixtime]] } regsub -all -- "<" $topic "\\<" topic regsub -all -- ">" $topic "\\>" topic set fd [open $lt_htmlfile r] while {![eof $fd]} { gets $fd str if {[string match "* $topic *" $str]} { if {$lt_log} { putlog "topiclogger: Already logged topic of $chan" } close $fd return 0 } elseif {$str == ""} { if {$hand != "*"} { append buffer " $topic  $nick ($uhost) !$hand!  $time \n" } else { append buffer " $topic  $nick ($uhost)  $time \n" } append buffer "$str\n" set found 1 } elseif {(!$found) && ($str == "")} { append buffer "\n" append buffer "$chan\n" append buffer "\n" append buffer "\n" if {$hand != "*"} { append buffer "\n" } else { append buffer "\n" } append buffer "
 Topic  Set by  Time 
 $topic  $nick ($uhost) !$hand!  $time 
 $topic  $nick ($uhost)  $time 
\n" append buffer "\n" append buffer "

\n" append buffer "\n" append buffer "$str\n" } elseif {$str == ""} { append buffer "$str" set stop 1 } elseif {!$stop} { append buffer "$str\n" } } close $fd set fd [open $lt_htmlfile w] puts $fd $buffer close $fd if {$lt_log} { putlog "topiclogger: Logged topic of $chan" } } } proc lt_writeheader { } { global botnick lt_ver lt_htmlfile lt_bodytag lt_styletag lt_log lt_allchans lt_chans lt_maxsize lt_enablestrftime lt_formatstring set buffer "\n" append buffer "\n" append buffer "\n" append buffer " Topics\n" append buffer "\n" append buffer "\n" append buffer "\n" if {$lt_styletag != ""} { append buffer "$lt_styletag\n" append buffer "\n" } append buffer "\n" append buffer "\n" append buffer "$lt_bodytag\n" append buffer "\n" append buffer "
\n" append buffer "\n" append buffer "
\n" append buffer "\n" append buffer "Topics
\n" append buffer "logged by $botnick\n" append buffer "\n" append buffer "


\n" append buffer "\n" append buffer "\n" append buffer "\n" append buffer "\n" append buffer "\n" append buffer "This file was automatically generated by topiclogger.tcl v$lt_ver by Sup\n" append buffer "\n" append buffer "
\n" append buffer "\n" append buffer "

\n" append buffer "\n" append buffer "\n" append buffer "" set fd [open $lt_htmlfile w] puts $fd $buffer close $fd } ### End ### putlog "TCL loaded: topiclogger.tcl v$lt_ver by Sup "