To compile:

gcc -o spamtestbuddy -s -O2 -Wall -pedantic spamtestbuddy.c

Copy the binary to install it. Before SpamTestBuddy does anything, you 
have to create a .spamtestbuddy file in $HOME. This will define all 
aspects of the scoring. At the very least, define:

	SpamThreshold
	SkipReceived
	and at least one test such as TestDnsProblems

	It is recommended that you use the result from an existing filter
	(such as a SpamProbe score) and then supplement with new tests.
	See CONFIG-SPAMPROBE for an example of using with SpamProbe.

See the CONFIGURATION guide for a complete description of supported tests.
You can copy this file to .spamtestbuddy and then modify as needed.

Try it out by reading an email from the command line:
spamtestbuddy < message

You should see two new headers, such as

X-SpamTestBuddy: OVER score=1.6994 threshold=0.9000 ip=117.47.136.146
X-SpamTestBuddy-Tests: ver=0.95 +DNSPROBLEM +SPAMPROBE +ZEN


Finally, install in .procmailrc with this single recipe:

-------------------------------------------------

:0 wf
| /path/to/spamtestbuddy

-------------------------------------------------

This will add the new header. You should obviously run this after using
other software like SpamProbe whose headers are needed by SpamTestBuddy.

You can then add recipes to filter depending on the new SpamTestBuddy
header. For example, direct suspected spam into a separate mailbox:

-------------------------------------------------

:0 :
* ^X-SpamTestBuddy: OVER
spambox

-------------------------------------------------



If you want to parse the sender's IP address to a variable, this can 
easily be done after the SpamTestBuddy header is added. For example:

:0
* ^X-SpamTestBuddy: .*ip=\/[0-9.]*
{ SENDER_IP=$MATCH }

The IP address parsed from the correct Received header is now in $SENDER_IP

