Class IQBlockingHandler

    • Constructor Detail

      • IQBlockingHandler

        public IQBlockingHandler()
    • Method Detail

      • getInfo

        public IQHandlerInfo getInfo()
        Description copied from class: IQHandler
        Returns the handler information to help generically handle IQ packets. IQHandlers that aren't local server iq handlers (e.g. chatbots, transports, etc) return null.
        Specified by:
        getInfo in class IQHandler
        Returns:
        The IQHandlerInfo for this handler
      • getFeatures

        public Iterator<String> getFeatures()
        Description copied from interface: ServerFeaturesProvider
        Returns an Iterator (of String) with the supported features by the server. The features to include are the features offered and supported protocols by the SERVER. The idea is that different modules may provide their features that will ultimately be part of the features offered by the server.
        Specified by:
        getFeatures in interface ServerFeaturesProvider
        Returns:
        an Iterator (of String) with the supported features by the server.
      • handleIQ

        public org.xmpp.packet.IQ handleIQ​(org.xmpp.packet.IQ iq)
                                    throws UnauthorizedException
        Description copied from class: IQHandler
        Handles the received IQ packet.
        Specified by:
        handleIQ in class IQHandler
        Parameters:
        iq - the IQ packet to handle.
        Returns:
        the response to send back.
        Throws:
        UnauthorizedException - if the user that sent the packet is not authorized to request the given operation.
      • getBlocklist

        protected Set<org.xmpp.packet.JID> getBlocklist​(User user)
        Retrieves all of the JIDs that are on the blocklist of the provided user.
        Parameters:
        user - The use for which to retrieve the blocklist (cannot be null).
        Returns:
        The JIDs that are on the blocklist (possibly empty, but never null).
      • addToBlockList

        protected void addToBlockList​(User user,
                                      List<org.xmpp.packet.JID> toBlocks)
        Adds a collection of JIDs to the blocklist of the provided user. This method adds the JIDs to the default privacy list, creating a new privacy list (and setting it as default) if the user does not have a default privacy list. The newly added JIDs are push on the front end of the list. The order of pre-existing list items is modified.
        Parameters:
        user - The owner of the blocklist to which JIDs are to be added (cannot be null).
        toBlocks - The JIDs to be added (can be null, which results in a noop).
      • pushBlocklistUpdates

        protected void pushBlocklistUpdates​(User user,
                                            List<org.xmpp.packet.JID> newBlocks)
        Sends an IQ-set with the newly blocked JIDs to all resources of the user that have requested the blocklist.
        Parameters:
        user - The for which updates are to be broadcasted (cannot be null).
        newBlocks - The JIDs for which an update needs to be sent (cannot be null, can be empty).
      • removeFromBlockList

        protected Set<org.xmpp.packet.JID> removeFromBlockList​(User user,
                                                               Collection<org.xmpp.packet.JID> toUnblocks)
        Removes a collection of JIDs from the blocklist of the provided user. This method removes the JIDs to the default privacy list. When no default privacy list exists for this user, this method does nothing.
        Parameters:
        user - The owner of the blocklist to which JIDs are to be added (cannot be null).
        toUnblocks - The JIDs to be removed (can be null, which results in a noop).
        Returns:
        The JIDs that are removed (never null, possibly empty).
      • pushBlocklistUpdates

        protected void pushBlocklistUpdates​(User user,
                                            Collection<org.xmpp.packet.JID> newBlocks)
        Sends an IQ-set with the newly blocked JIDs to all resources of the user that have requested the blocklist.
        Parameters:
        user - The for which updates are to be broadcasted (cannot be null).
        newBlocks - The JIDs for which an update needs to be sent (cannot be null, can be empty).