#!/bin/sh
# wrapper for irssi chat client
[ -f "$HOME/.chatrc" ] || echo "NICK=slacko_user$RANDOM" > $HOME/.chatrc
.  $HOME/.chatrc
echo -en "If you are an experienced user of irssi chat client
(or other CLI chat software) answer n/N to the next question
and start \"irssi\" in a virtual terminal (eg: urxvt).\n"
echo
echo -n "Would you like to join the freenode irc network? 
This is where you can join "
echo -en "\e[32m#puppylinux\e[0m"
echo " IRC channel (y/n)"
read pup

case $pup in
	y*|Y*)echo
	;;
	*)exit 0
	;;
esac

echo -n "The default nickname (nick) is "
echo -en "\e[33m${NICK}.\e[0m"
echo " Keep this nick? (y/n)"
read nick
case $nick in
	y*|Y*)echo "$NICK is kept"
	;;
	*)echo "Type in your preferred nick. (no spaces or special characters except '_')"
	read newnick
	echo "NICK=$newnick" > $HOME/.chatrc
	.  $HOME/.chatrc
	;;
esac
UNICK=$NICK
echo "Now starting irssi."
echo -n "Once connected to "
echo -en "\e[33mirc.freenode.net\e[0m"
echo -n " type "
echo -en "\e[33m/join #puppylinux\e[0m"
echo " in the Status area to access the puppylinux IRC channel."
echo -n "To quit type "
echo -e "\e[33m/quit\e[0m"
echo -e "\e[95mYou may want to write the above down\e[0m."
echo "Press Enter to begin"
read ex
run-as-spot irssi -c irc.freenode.net -n $UNICK
echo "Press Enter to exit"
read quit
