#!/bin/bash
#help
#Syntax:   qistest load|save|cleanqueue
#Function: QIS test message handler:
#          load       - copy test messages into quarantined from qis_testdata
#          save       - copy test messages into qis_testdata from quarantined
#          cleanqueue - remove test messages from quarantined
#
#          Test messages are all those whose name doesn't start with '2'
#Options:  none
#end

if [ "$1" == '-?' ]
then
	script_help $0
	exit 1
fi

if [ "$1" == 'load' ]
then
	for f in qis_testdata/[a-zA-Z]*
	do
		bn=$(basename $f)
		echo "Loading $bn"
		cp $f quarantined/$bn
	done
elif [ "$1" == 'save' ]
then
	for f in quarantined/[a-zA-Z]*
	do
		bn=$(basename $f)
		echo "Saving $bn"
		cp $f qis_testdata/$bn
	done
elif [ "$1" == 'cleanqueue' ]
then
	for f in quarantined/[a-zA-Z]*
	do
		echo "Clearing $f from the queue"
		rm $f
	done
else
	echo "Error: I don't understand '$1'"
	exit 1
fi

