#HELP# /invite <user> [<msg>] - invite someone logged in current channel
#
# This will use write(1) to invite a user 
#
CMD_invite()
{
	if [ -z "$JOINPID" ]; then
		echo "Join a channel first"
		return
	fi

	if [ -z "$1" ]; then
		echo "invite who ?"
		return
	fi
	who="$1"
	if [ -n "$2" ]; then
		msg=$@
	else
		msg="$LOGNAME invites you to join $JOINNAME"
	fi

	# this call does not redirect stderr to stdout
	# because /bin/sh togheter with splitvt on freeBSD
	# is not able to find a tty for write that way !
	if echo $msg | write $who; then
		echo "You invited $who to channel $JOINNAME"
	fi
}

