public void handleIQ(@Nonnull final IQ packet, @Nullable final MUCOccupant actorOccupant) throws ForbiddenException, ConflictException,
            NotAllowedException, CannotBeInvitedException {

        final Affiliation senderAffiliation = actorOccupant != null ? actorOccupant.getAffiliation() : room.getAffiliation(packet.getFrom());
        final Role senderRole = actorOccupant != null ? actorOccupant.getRole() : null;

        IQ reply = IQ.createResultIQ(packet);
        Element element = packet.getChildElement();

        // Analyze the action to perform based on the included element
        List<Element> itemsList = element.elements("item");
        
        if (!itemsList.isEmpty()) {
            handleItemsElement(senderAffiliation, senderRole, itemsList, reply);
        }
        else {
            // An unknown and possibly incorrect element was included in the query
            // element so answer a BAD_REQUEST error
            reply.setChildElement(packet.getChildElement().createCopy());
            reply.setError(PacketError.Condition.bad_request);
        }
        if (reply.getTo() != null) {
            // Send a reply only if the sender of the original packet was from a real JID. (i.e. not
            // a packet generated locally)
            XMPPServer.getInstance().getPacketRouter().route(reply);
        }
    }
Handles the IQ packet sent by an owner or admin of the room. Possible actions are:
<ul>
<li>Return the list of participants</li>
<li>Return the list of moderators</li>
<li>Return the list of members</li>
<li>Return the list of outcasts</li>
<li>Change user's affiliation to member</li>
<li>Change user's affiliation to outcast</li>
<li>Change user's affiliation to none</li>
<li>Change occupant's affiliation to moderator</li>
<li>Change occupant's affiliation to participant</li>
<li>Change occupant's affiliation to visitor</li>
<li>Kick occupants from the room</li>
</ul>

@param packet the IQ packet sent by an owner or admin of the room.
@param actorOccupant the occupant data of the user that sent the request packet.
@throws ForbiddenException If the user is not allowed to perform his request.
@throws ConflictException If the desired room nickname is already reserved for the room or
                          if the room was going to lose all of its owners.
@throws NotAllowedException Thrown if trying to ban an owner or an administrator.
@throws CannotBeInvitedException If the user being invited as a result of being added to a members-only room still does not have permission
xmppserver/src/main/java/org/jivesoftware/openfire/muc/spi/IQAdminHandler.java