#!/bin/sh
#
# usermenu.sh - menu for users who are not limited to SLIP/PPP
#
#

ISPUTIL="/var/lib/ISPutil"

HOSTNAME=`hostname`
DNSDOMAINNAME=`dnsdomainname`
TITLE="$HOSTNAME.$DNSDOMAINNAME User"
EDITOR="/usr/bin/pico -t"
VISUAL="$EDITOR"
SUPER="/usr/bin/super"
FEEDBACK=/usr/bin/feedback
CHAT="/usr/local/bin/vchat -s peak"
QUOTA="/usr/bin/quota"


DONE=
while [ -z $DONE ]; do
	reset
	dialog --title " $TITLE " \
	--menu   "MAIN MENU" 16 50 7 \
	"BACK"   "Back from menu" \
	"CHAT"   "Online Chat" \
	"DISK"   "Disk quotas" \
	"HELP"   "Write for help" \
	"MAIL"   "Mail read/write" \
	"LOGIN"  "Change login password" \
	"ONLINE" "See who is online" \
	"X=EXIT" "Exit this menu" 2> /tmp/umenu.tmp.$$
	if [ $? = 1 -o $? = 255 ]; then
		/bin/rm -f /tmp/tmpmsg.$$ /tmp/umenu.tmp.$$
		exit
	fi
	choice=`cat /tmp/umenu.tmp.$$`
	/bin/rm -f /tmp/umenu.tmp.$$

        if [ "$choice" = "BACK" ]; then
        DONE=DONE
        fi
        if [ "$choice" = "CHAT" ]; then
	$CHAT
        fi
        if [ "$choice" = "DISK" ]; then
	$QUOTA >/tmp/umenu.tmp.$$
        dialog --title "Disk Quotas" \
        --textbox /tmp/umenu.tmp.$$ 18 76
        /bin/rm -f /tmp/umenu.tmp.$$
        fi
        if [ "$choice" = "HELP" ]; then
	$FEEDBACK
        fi
        if [ "$choice" = "LOGIN" ]; then
        /usr/bin/passwd
        fi
        if [ "$choice" = "MAIL" ]; then
        /usr/bin/pine
        fi
	if [ "$choice" = "ONLINE" ]; then
	/usr/bin/finger @dialup1 > /tmp/umenu.tmp.$$
        dialog --title "Users Online" \
        --textbox /tmp/umenu.tmp.$$ 18 76
        /bin/rm -f /tmp/umenu.tmp.$$
        fi
#        if [ "$choice" = "TIME" ]; then
#        $SUPER buytime.sh
#        fi
        if [ "$choice" = "X=EXIT" ]; then
        DONE=DONE
        fi
done
