Class IQOwnerHandler


  • public class IQOwnerHandler
    extends Object
    A handler for the IQ packet with namespace http://jabber.org/protocol/muc#owner. This kind of packets are usually sent by room owners. So this handler provides the necessary functionality to support owner requirements such as: room configuration and room destruction.
    Author:
    Gaston Dombiak
    • Constructor Detail

      • IQOwnerHandler

        public IQOwnerHandler​(MUCRoom chatroom)
    • Method Detail

      • handleIQ

        public void handleIQ​(org.xmpp.packet.IQ packet,
                             MUCRole sender)
                      throws ForbiddenException,
                             ConflictException,
                             CannotBeInvitedException,
                             NotAcceptableException
        Handles the IQ packet sent by an owner of the room. Possible actions are:
        • Return the list of owners
        • Return the list of admins
        • Change user's affiliation to owner
        • Change user's affiliation to admin
        • Change user's affiliation to member
        • Change user's affiliation to none
        • Destroy the room
        • Return the room configuration within a dataform
        • Update the room configuration based on the sent dataform
        Parameters:
        packet - the IQ packet sent by an owner of the room.
        sender - the occupant data of the user that sent the packet.
        Throws:
        ForbiddenException - if the user does not have enough permissions (ie. is not an owner).
        ConflictException - If the room was going to lose all of its owners.
        CannotBeInvitedException - never
        NotAcceptableException - if the room requires a password that was not supplied
      • parseFirstValueAsBoolean

        @Deprecated
        public static boolean parseFirstValueAsBoolean​(org.xmpp.forms.FormField field,
                                                       boolean defaultValue)
        Deprecated.
        Use FormField#parseFirstValueAsBoolean(String) provided by Tinder version 1.3.1 or newer.
        Returns the first value of the formfield as a boolean.
        Parameters:
        field - A form field (cannot be null)
        defaultValue - Returned if first value is null or empty.
        Returns:
        true if the provided input equals '1' or 'true', false if the input equals '0' or 'false'.
        Throws:
        IllegalArgumentException - when the input cannot be parsed as a boolean.