public boolean setForward(String username,
String forward)
throws RemoteException {
JamesUser user = (JamesUser)users.getUserByName(username);
if (user == null) {
getLogger().error("No such user " + username + " found!");
throw new RemoteException("No such user " + username + " found!");
}
MailAddress forwardAddress;
try {
forwardAddress = new MailAddress(forward);
} catch (ParseException pe) {
getLogger().error("Parse exception with that email address: " + pe.getMessage());
throw new RemoteException("Parse exception with that email address: " + pe.getMessage());
}
if (user.setForwardingDestination(forwardAddress)) {
user.setForwarding(true);
users.updateUser(user);
getLogger().info("Forwarding destination for " + username + " set to: " + forwardAddress.toString());
return true;
}
getLogger().error("Error setting forward for user " + username);