Class IQBlockingHandler
java.lang.Object
org.jivesoftware.openfire.container.BasicModule
org.jivesoftware.openfire.handler.IQHandler
org.jivesoftware.openfire.handler.IQBlockingHandler
- All Implemented Interfaces:
ChannelHandler,Module,ServerFeaturesProvider
Implementation of XEP-0191 "Blocking Command".
This implementation uses the default privacy list of a user to store its blocklist.
- Author:
- Guus der Kinderen, guus.der.kinderen@gmail.com
-
Field Summary
FieldsFields inherited from class org.jivesoftware.openfire.handler.IQHandler
deliverer, sessionManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddToBlockList(User user, List<org.xmpp.packet.JID> toBlocks) Adds a collection of JIDs to the blocklist of the provided user.protected Set<org.xmpp.packet.JID>getBlocklist(User user) Retrieves all of the JIDs that are on the blocklist of the provided user.Returns an Iterator (of String) with the supported features by the server.getInfo()Returns the handler information to help generically handle IQ packets.org.xmpp.packet.IQhandleIQ(org.xmpp.packet.IQ iq) Handles the received IQ packet.protected voidpushBlocklistUpdates(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.protected voidpushBlocklistUpdates(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.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.Methods inherited from class org.jivesoftware.openfire.handler.IQHandler
initialize, performNoSuchUserCheck, process, processNoSuchUserCheckMethods inherited from class org.jivesoftware.openfire.container.BasicModule
destroy, getName, start, stop
-
Field Details
-
NAMESPACE
- See Also:
-
-
Constructor Details
-
IQBlockingHandler
public IQBlockingHandler()
-
-
Method Details
-
getInfo
Description copied from class:IQHandlerReturns the handler information to help generically handle IQ packets. IQHandlers that aren't local server iq handlers (e.g. chatbots, transports, etc) returnnull. -
getFeatures
Description copied from interface:ServerFeaturesProviderReturns 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:
getFeaturesin interfaceServerFeaturesProvider- Returns:
- an Iterator (of String) with the supported features by the server.
-
handleIQ
Description copied from class:IQHandlerHandles the received IQ packet.- Specified by:
handleIQin classIQHandler- 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
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
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
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
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).
-