/**
   * Called to accept an incoming invitation. Adds the invitation chat room to the list of chat
   * rooms and joins it.
   *
   * @param invitation the invitation to accept.
   */
  public void acceptInvitation(WhiteboardInvitation invitation) {
    WhiteboardSession whiteboard = invitation.getTargetWhiteboard();

    byte[] password = invitation.getWhiteboardPassword();

    try {
      if (password == null) whiteboard.join();
      else whiteboard.join(password);
    } catch (OperationFailedException e) {
      WhiteboardActivator.getUiService()
          .getPopupDialog()
          .showMessagePopupDialog(
              Resources.getString(
                  "failedToJoinWhiteboard", new String[] {whiteboard.getWhiteboardID()}),
              Resources.getString("error"),
              PopupDialog.ERROR_MESSAGE);

      logger.error("Failed to join whiteboard: " + whiteboard.getWhiteboardID(), e);
    }
  }