#!/bin/sh

############################################################
#
# Configuration:  You MUST change the username and password!
#
#
# enter your e-mail address for return messages
#
JIS_PATH="enrico_rastelli@juggling.org"
#
#
# enter your home service account name,
# which is usually the same as your e-mail address
#
JIS_USER="enrico_rastelli@juggling.org"
#
#
# enter your password in the line below
#
JIS_PSWD="ijuglots"
#
#
# you probably won't need to change this, but you might
#
MAIL_PROGRAM="mail"
#
#
# If you do not have a uuencode program, see comments below.
#
# Now comment out the next line and this is ready to use.
echo 2>&1 "$0:  Must be edited before first use"; exit 1
#
############################################################
#
# Usage:
#
#
# To add new files to your JIS home page account:
#
#	homepage file1 file2 file3 ...
#
#
# To remove files from your JIS home page account:
#
#	homepage -r file1 file2 file3 ...
#
#
# To check the contents of your account without changing it:
#
#	homepage
#
############################################################

SUBJECT="HOME-SERVICE request"
MAIL_SERVER="home-service@juggling.org"

if [ " $1 " = " -r " ]; then
	shift
	echo "# request via $0 command"
	echo "PATH $JIS_PATH"
	echo "USER $JIS_USER $JIS_PSWD"
	for file do
		echo "REMOVE $file"
	done
else
	echo "# request via $0 command"
	echo "PATH $JIS_PATH"
	echo "USER $JIS_USER $JIS_PSWD"
	for file do

		# If you do not have a uuencode program,
		# comment out the following 2 lines.
		echo "DECODE $file"
		uuencode "$file" "$file"

		# If you do not have a uuencode program,
		# you will only be able to add plain text files.
		# Uncomment the 3 lines below.
		# echo "ADD $file"
		# cat "$file"
		# echo "<EOF>"
	done
fi | $MAIL_PROGRAM -s "$SUBJECT" "$MAIL_SERVER"
