Giving a user the choice to appear offline in a view showing online users
Assuming Drupal 7, you can go to /admin/config/people/accounts/fields, attach a Boolean field to user accounts to allow the user to select their preference, then filter on that user field in your view to exclude those who opt out.