WikiSh /
WikiShRC
set -s ShoutPage = "Site.ShoutBox" function ProcShout { # If the user set the nickname on the form, use it if test -n ${shoutname} then set -s --session shoutname = ${shoutname} fi if test -z ${~shoutname} then set -s --session shoutname = fi set -s shoutname = ${~shoutname} set -s --form shoutname = ${shoutname} if test -n ${shoutname} then set -s shoutid = "${shoutname}: " else set -s shoutid = "" fi if test -n ${shoutsave} && test -n ${shouttext} then echo "${NOW}: ${shoutid}${shouttext}" >>${ShoutPage} fi } function ListShout { if test -n ${shoutlines} then set lines = ${shoutlines} set deadline = 0 else if test -n ${1} then set lines = ${1} else set lines = 100 fi if test -n "${2}" then set deadline = ${NOW} - ${2} else set deadline = ${NOW} - 7200 fi fi tail -n ${lines} ${ShoutPage} | while read -IFS:": " timestamp rest do if test ${timestamp} >= ${deadline} then echo "${rest}" fi done if test -n ${shoutname} then set -s ShoutShowHide = 'hide' set -s ShoutNameLabel = 'Name:' else set -s ShoutShowHide = 'show' set -s ShoutNameLabel = "Name:" fi } function CleanShout { if test -z ${shoutclean} then return fi set boundary = ${NOW} - 3600 if test -f Tmp.Shout then rm Tmp.Shout fi cat ${ShoutPage} | while read --IFS:": " time line do if test ${time} -ge ${boundary} then echo "${time}: ${line}" >>Tmp.Shout fi done cat Tmp.Shout >${ShoutPage} } |