# Script: News 2 HTML # Author: Wingman # http://www.WINGDesign.de/ # Update: Fixed r/w mode By DoctorD90 # Path and name of news'files. set n2h(file) "news" # Name of news' html Title. set n2h(title) "NEWS" # What command should be used for adding news? set n2h(cmd) "AddNews" # How date should be used for adding news? (ex. Mon 01 99 at 09:00) set n2h(date) "%d %b %Y at %H:%M" # How news line should be? Use %date to insert date layout setted in previous setting; Use %user to write name; Use %news to write news' text that you add (ex. Wingman (Mon 01 99 at 01:01): this script roxx) set n2h(news) "%user (%date): %news" # What flags are authorized for using News 2 HTML? [global_flag|chan_flag] set n2h(cmd_flags) "o|o" set n2h(ver) "2.1" bind pub $n2h(cmd_flags) $n2h(cmd) pub:n2h proc n2h:addnews {hand news} { global n2h if {[file exists "${n2h(file)}.txt"]} { set fs [open "${n2h(file)}.txt"] set lines [split [read -nonewline $fs] "\n"] close $fs } set text [string map [list %user $hand %date [strftime $n2h(date)] %news $news] $n2h(news)] lappend lines $text set fs [open "${n2h(file)}.txt" w] puts $fs [join $lines "\n"] close $fs set fs [open "${n2h(file)}.html" w] puts $fs "" puts $fs " " puts $fs " " puts $fs " $n2h(title)" puts $fs " " puts $fs " " puts $fs [join $lines "
\n"] puts $fs " " puts $fs "" close $fs } proc pub:n2h { nick uhost hand chan text } { global n2h if {![llength [split $text]]} { putserv "PRIVMSG $nick :Usage: $n2h(cmd) " return } n2h:addnews $hand $text putserv "PRIVMSG $nick :Updated news: \"$text\"." } putlog "News2Html $n2h(ver) by Wingman loaded."