/** * Handles packets that includes a data form. The data form was sent using an element with name * "x" and namespace "jabber:x:data". * * @param senderRole the role of the user that sent the data form. * @param formElement the element that contains the data form specification. * @throws ForbiddenException if the user does not have enough privileges. * @throws ConflictException If the room was going to lose all of its owners. */ private void handleDataFormElement(MUCRole senderRole, Element formElement) throws ForbiddenException, ConflictException { DataForm completedForm = new DataForm(formElement); switch (completedForm.getType()) { case cancel: // If the room was just created (i.e. is locked) and the owner cancels the configuration // form then destroy the room if (room.isLocked()) { room.destroyRoom(null, null); } break; case submit: // The owner is requesting an instant room if (completedForm.getFields().isEmpty()) { // Do nothing } // The owner is requesting a reserved room or is changing the current configuration else { processConfigurationForm(completedForm, senderRole); } // If the room was locked, unlock it and send to the owner the "room is now unlocked" // message if (room.isLocked() && !room.isManuallyLocked()) { room.unlock(senderRole); } if (!room.isDestroyed) { // Let other cluster nodes that the room has been updated CacheFactory.doClusterTask(new RoomUpdatedEvent(room)); } break; default: Log.warn("cannot handle data form element: " + formElement.asXML()); break; } }