fn conf_enable_mdir { mdir=`{pwd} listbase=$conf_wd listname=`{basename `{ basename -d $listbase}} conf_enable_app mdir dirfilter=$dirfilter' /mbox\/?$/d;' } fn mdir_init { showmonth=`{echo $req_path | sed 's/.*[0-9][0-9][0-9][0-9]\/([A-Z][a-z][^\/]+).*/\1/'} showyear=`{echo $req_path | sed 's/.*\/([0-9][0-9][0-9][0-9])\/.*/\1/'} handler_body_main='mdir_index' if (~ $req_path $listbase[0-9][0-9][0-9][0-9]/[A-Z][a-z]*/[0-9]*) { handler_body_main='message_display' } if not if (~ $req_path $listbase[0-9][0-9][0-9][0-9]/[A-Z][a-z]*) { handler_body_main='month_display' } if not if(~ $req_path $listbase[0-9][0-9][0-9][0-9]*) { handler_body_main='year_display' } } fn message_display { message=`{basename $req_path} echo '

'$listname' - '$showyear' - ' echo ''$showmonth' -' echo 'this message ' approx=`{echo $"message | sed 's/(....).*/\1/' } neighbors=`{ls -p $mdir/mbox/$approx^*} prevmsg=`{echo $neighbors | tr '\012' ' ' | sed -n 's/.* ([^ ]+) '$message'.*/\1/p'} nextmsg=`{echo $neighbors | tr '\012' ' ' | sed -n 's/.*'$message' ([^ ]+).*/\1/p'} if (~ $#prevmsg 1 || ~ $#nextmsg 1) { echo '[ ' } if (~ $#prevmsg 1) { echo 'previous' } if (~ $#prevmsg 1 && ~ $#nextmsg 1) { echo ' , ' } if (~ $#nextmsg 1) { echo 'next' } if (~ $#prevmsg 1 || ~ $#nextmsg 1) { echo ' ]' } echo '

' awk ' /^Subject:/ && (headersdone == 0) { subject=$0 } /^From:/ && (headersdone == 0) { from=$0; gsub(//, "\\>", from); } /^Date:/ && (headersdone == 0) { date=$0 } /^$/ && (headersdone==0) { print "

" subject "

"; print from; print date; headersdone=1 }
  (headersdone == 1) { print $0 }
  ' $mdir/mbox/$message | sed 's/([^ @.]+)\@[^ @]+\.[^@ $][a-zA-Z]+/\1@[REDACTED]/g;' 

  echo '
' } fn mdir_index { echo '

' $listname '

' echo '' } fn year_display { echo '

'$listname' - '$showyear'

' echo '' } fn month_display { echo '

'$listname' - '$showyear' - '$showmonth'

' echo '' }