#!/bin/sh
# example script for automatic spam anal
# Brian Ward http://www.o--o.net/

# CONFIG: working directory
SPAMROOT=$HOME/Mail/spam

# CONFIG: target for output
SPAMTARGET=$HOME/html/spam

# CONFIG: fonts
# comment this out if you want to use the default
# FONT="-font LucidaSans-Bold:lsb.pfa"

# CONFIG: Any files to be rendered small
SMALLFILES="30day.ps"

# CONFIG: path
PATH=$PATH:/usr/local/bin:$HOME/shell

cd $SPAMROOT

# CONFIG:
# replace the "auto/* canned/* .." with your spam files

spanal $FONT auto/* canned/* auto.mbox/* canned.mbox/*

# move partial html files into target
for file in *.pht; do
    if [ -s $file ]; then
	mv $file $SPAMTARGET
    fi
done

# convery PostScript files into bitmaps
for file in *.ps; do
    f1=`basename $file .ps`
    spgbitmap $f1.ps > $f1.png 2>/dev/null
    if [ -s $f1.png ]; then
	mv $f1.png $SPAMTARGET
    fi
done

# make these into a small bitmaps (kind of wasteful, since
# it already made big ones)
for file in $SMALLFILES; do
    f1=`basename $file .ps`
    spgbitmap -small $f1.ps > $f1.png 2>/dev/null
    if [ -s $f1.png ]; then
	mv $f1.png $SPAMTARGET
    fi
done

# transfer to another server, if necessary
# spxfer

