XGBoost objective function


I have a following question: Let X_i and A_i (binary) be covariates and labels for i-th observation, then the current XGBoost R package can solve the following optimization problem:

min \frac{1}{n}\sum_{i=1}^{n}l(A_if(X_i))+J(f),

where l is a loss function and the minimization is over some functional space. Then we can estimate the classification boundary function. But if we observe data (X_i, A_i, Y_i) and we want to deal with the following problem

min \frac{1}{n}\sum_{i=1}^{n}w(Y_i)l(A_if(X_I))+J(f),

where $w$ is a function of variable Y and can be regarded as a weight. Then can we also use XGBoost R package directly?