Class IQOfflineMessagesHandler
- java.lang.Object
-
- org.jivesoftware.openfire.container.BasicModule
-
- org.jivesoftware.openfire.handler.IQHandler
-
- org.jivesoftware.openfire.handler.IQOfflineMessagesHandler
-
- All Implemented Interfaces:
ChannelHandler
,Module
,DiscoInfoProvider
,DiscoItemsProvider
,ServerFeaturesProvider
public class IQOfflineMessagesHandler extends IQHandler implements ServerFeaturesProvider, DiscoInfoProvider, DiscoItemsProvider
Implements JEP-0013: Flexible Offline Message Retrieval. Allows users to request number of messages, request message headers, retrieve specific messages, remove specific messages, retrieve all messages and remove all messages.- Author:
- Gaston Dombiak
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.openfire.handler.IQHandler
deliverer, sessionManager
-
-
Constructor Summary
Constructors Constructor Description IQOfflineMessagesHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.xmpp.forms.DataForm
getExtendedInfo(String name, String node, org.xmpp.packet.JID senderJID)
Returns an XDataForm with the extended information about the entity or null if none.Set<org.xmpp.forms.DataForm>
getExtendedInfos(String name, String node, org.xmpp.packet.JID senderJID)
Returns a collection of XDataForm with the extended information about the entity or an empty collection if none.Iterator<String>
getFeatures()
Returns an Iterator (of String) with the supported features by the server.Iterator<String>
getFeatures(String name, String node, org.xmpp.packet.JID senderJID)
Returns an Iterator (of String) with the supported features.Iterator<org.dom4j.Element>
getIdentities(String name, String node, org.xmpp.packet.JID senderJID)
Returns an Iterator (of Element) with the target entity's identities.IQHandlerInfo
getInfo()
Returns the handler information to help generically handle IQ packets.Iterator<DiscoItem>
getItems(String name, String node, org.xmpp.packet.JID senderJID)
Returns an Iterator (of DiscoItem) with the target entity's items or null if none.org.xmpp.packet.IQ
handleIQ(org.xmpp.packet.IQ packet)
Handles the received IQ packet.boolean
hasInfo(String name, String node, org.xmpp.packet.JID senderJID)
Returns true if we can provide information related to the requested name and node.void
initialize(XMPPServer server)
Initializes the basic module.void
start()
Starts the basic module.void
stop()
Stops the basic module.-
Methods inherited from class org.jivesoftware.openfire.container.BasicModule
destroy, getName
-
-
-
-
Method Detail
-
handleIQ
public org.xmpp.packet.IQ handleIQ(org.xmpp.packet.IQ packet) throws UnauthorizedException
Description copied from class:IQHandler
Handles the received IQ packet.- Specified by:
handleIQ
in classIQHandler
- Parameters:
packet
- 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.
-
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) returnnull
.
-
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 interfaceServerFeaturesProvider
- Returns:
- an Iterator (of String) with the supported features by the server.
-
getIdentities
public Iterator<org.dom4j.Element> getIdentities(String name, String node, org.xmpp.packet.JID senderJID)
Description copied from interface:DiscoInfoProvider
Returns an Iterator (of Element) with the target entity's identities. Each Element must include the categoty, type and name attributes of the entity.- Specified by:
getIdentities
in interfaceDiscoInfoProvider
- Parameters:
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.- Returns:
- an Iterator (of Element) with the target entity's identities.
-
getFeatures
public Iterator<String> getFeatures(String name, String node, org.xmpp.packet.JID senderJID)
Description copied from interface:DiscoInfoProvider
Returns an Iterator (of String) with the supported features. The features to include are the features offered and supported protocols by the target entity identified by the requested name and node.- Specified by:
getFeatures
in interfaceDiscoInfoProvider
- Parameters:
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.- Returns:
- an Iterator (of String) with the supported features.
-
getExtendedInfo
public org.xmpp.forms.DataForm getExtendedInfo(String name, String node, org.xmpp.packet.JID senderJID)
Description copied from interface:DiscoInfoProvider
Returns an XDataForm with the extended information about the entity or null if none. Each bit of information about the entity must be included as a value of a field of the form.- Specified by:
getExtendedInfo
in interfaceDiscoInfoProvider
- Parameters:
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.- Returns:
- an XDataForm with the extended information about the entity or null if none.
-
getExtendedInfos
public Set<org.xmpp.forms.DataForm> getExtendedInfos(String name, String node, org.xmpp.packet.JID senderJID)
Description copied from interface:DiscoInfoProvider
Returns a collection of XDataForm with the extended information about the entity or an empty collection if none. Each bit of information about the entity must be included as a value of a field of the form.- Specified by:
getExtendedInfos
in interfaceDiscoInfoProvider
- Parameters:
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.- Returns:
- A collection of XDataForms with the extended information about the entity or an empty collection if none.
-
hasInfo
public boolean hasInfo(String name, String node, org.xmpp.packet.JID senderJID)
Description copied from interface:DiscoInfoProvider
Returns true if we can provide information related to the requested name and node. For example, if the requested name refers to a non-existant MUC room then the answer will be false. In case that the sender of the disco request is not authorized to discover this information an UnauthorizedException will be thrown.- Specified by:
hasInfo
in interfaceDiscoInfoProvider
- Parameters:
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco info request.- Returns:
- true if we can provide information related to the requested name and node.
-
getItems
public Iterator<DiscoItem> getItems(String name, String node, org.xmpp.packet.JID senderJID)
Description copied from interface:DiscoItemsProvider
Returns an Iterator (of DiscoItem) with the target entity's items or null if none. Each DiscoItem must include a JID attribute and may include the name and node attributes of the entity. In case that the sender of the disco request is not authorized to discover items an UnauthorizedException will be thrown.- Specified by:
getItems
in interfaceDiscoItemsProvider
- Parameters:
name
- the recipient JID's name.node
- the requested disco node.senderJID
- the XMPPAddress of user that sent the disco items request.- Returns:
- an Iterator (of DiscoItem) with the target entity's items or null if none.
-
initialize
public void initialize(XMPPServer server)
Description copied from class:BasicModule
Initializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
- Specified by:
initialize
in interfaceModule
- Overrides:
initialize
in classIQHandler
- Parameters:
server
- the server hosting this module.
-
start
public void start() throws IllegalStateException
Description copied from class:BasicModule
Starts the basic module.
Inheriting classes that choose to override this method MUST call this start() method before accessing BasicModule resources.
- Specified by:
start
in interfaceModule
- Overrides:
start
in classBasicModule
- Throws:
IllegalStateException
- If start is called before initialize successfully returns
-
stop
public void stop()
Description copied from class:BasicModule
Stops the basic module.
Inheriting classes that choose to override this method MUST call this stop() method before accessing BasicModule resources.
- Specified by:
stop
in interfaceModule
- Overrides:
stop
in classBasicModule
-
-