public class EntityCapabilitiesManager extends BasicModule implements org.xmpp.component.IQResultListener, UserEventListener
| Modifier and Type | Field and Description |
|---|---|
static String |
OPENFIRE_IDENTIFIER_NODE
A XEP-0115 described identifier for the Openfire server software,
intended to be used as a value of 'node' attributes.
|
| Constructor and Description |
|---|
EntityCapabilitiesManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(EntityCapabilitiesListener listener)
Registers an event listener that will be invoked when the detected entity capabilities for any entity
have changed.
|
void |
addListener(org.xmpp.packet.JID entity,
EntityCapabilitiesListener listener)
Registers an event listener that will be invoked when the detected entity capabilities for a particular entity
have changed.
|
void |
answerTimeout(String packetId) |
protected void |
checkObsolete(String verHash)
Verifies if the provided 'ver' hash is used for any user.
|
void |
destroy()
Destroys the module.
|
protected void |
dispatch(org.xmpp.packet.JID entity,
EntityCapabilities updatedEntityCapabilities,
EntityCapabilities previousEntityCapabilities)
Invokes the entityCapabilitiesChanged method of all currently registered event listeners.
|
static String |
generateVerHash(org.xmpp.packet.IQ packet,
String algorithm)
Generates a 'ver' hash attribute used in validation to help prevent
poisoning of entity capabilities information.
|
EntityCapabilities |
getEntityCapabilities(org.xmpp.packet.JID jid)
Returns the entity capabilities for a specific JID.
|
static EntityCapabilitiesManager |
getInstance()
Deprecated.
Replaced by
XMPPServer.getEntityCapabilitiesManager() |
static String |
getLocalDomainVerHash()
Returns the 'ver' hash for this server.
|
void |
initialize(XMPPServer server)
Initializes the basic module.
|
void |
process(org.xmpp.packet.Presence packet) |
void |
receivedAnswer(org.xmpp.packet.IQ packet) |
protected void |
registerCapabilities(org.xmpp.packet.JID entity,
EntityCapabilities newCapabilities)
Registers that a particular entity has a particular set of capabilities, invoking event listeners when
appropriate.
|
void |
removeListener(EntityCapabilitiesListener listener)
Removes a previously registered event listener, if such a listener is currently registered.
|
void |
removeListener(org.xmpp.packet.JID entity,
EntityCapabilitiesListener listener)
Removes a previously registered event listener for a particular entity, if such a combination is currently
registered.
|
void |
removeListeners(org.xmpp.packet.JID entity)
Removes all previously registered event listener for a particular entity, if any were registered.
|
void |
userCreated(User user,
Map<String,Object> params)
A user was created.
|
void |
userDeleting(User user,
Map<String,Object> params)
A user is being deleted.
|
void |
userModified(User user,
Map<String,Object> params)
A user's name, email, or an extended property was changed.
|
getName, start, stoppublic static final String OPENFIRE_IDENTIFIER_NODE
public void initialize(XMPPServer server)
BasicModuleInitializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
initialize in interface Moduleinitialize in class BasicModuleserver - the server hosting this module.public void destroy()
BasicModuleDestroys the module.
Does nothing in the basic module.
destroy in interface Moduledestroy in class BasicModule@Deprecated public static EntityCapabilitiesManager getInstance()
XMPPServer.getEntityCapabilitiesManager()public void process(org.xmpp.packet.Presence packet)
public static String generateVerHash(org.xmpp.packet.IQ packet, String algorithm)
packet - IQ reply to the entity cap request.algorithm - The hashing algorithm to use (e.g. SHA-1)The value of the 'ver' attribute is generated according to the method
outlined in XEP-0115.public void answerTimeout(String packetId)
answerTimeout in interface org.xmpp.component.IQResultListenerpublic void receivedAnswer(org.xmpp.packet.IQ packet)
receivedAnswer in interface org.xmpp.component.IQResultListenerpublic EntityCapabilities getEntityCapabilities(org.xmpp.packet.JID jid)
jid - the full JID of entityprotected void registerCapabilities(@Nonnull org.xmpp.packet.JID entity, @Nonnull EntityCapabilities newCapabilities)
entity - The entity for which a set of capabilities is detected.newCapabilities - The capabilities that are detected.public void addListener(@Nonnull org.xmpp.packet.JID entity, @Nonnull EntityCapabilitiesListener listener)
entity - The entity for which to listen for events.listener - The event listener to be invoked when entity capabilities have changed.public void removeListener(@Nonnull org.xmpp.packet.JID entity, @Nonnull EntityCapabilitiesListener listener)
entity - The entity for which the listener was registered.listener - The event listener to be removed.public void removeListeners(@Nonnull org.xmpp.packet.JID entity)
entity - The entity for which listeners are to removed.public void addListener(@Nonnull EntityCapabilitiesListener listener)
listener - The event listener to be invoked when entity capabilities have changed.public void removeListener(@Nonnull EntityCapabilitiesListener listener)
listener - The event listener to be removed.protected void dispatch(@Nonnull org.xmpp.packet.JID entity, @Nonnull EntityCapabilities updatedEntityCapabilities, @Nullable EntityCapabilities previousEntityCapabilities)
entity - The entity for which an event is to be dispatchedupdatedEntityCapabilities - The most up-to-date capabilities.previousEntityCapabilities - The capabilities, if any, prior to the update.public void userDeleting(User user, Map<String,Object> params)
UserEventListeneruserDeleting in interface UserEventListeneruser - the user.params - event parameters.protected void checkObsolete(String verHash)
verHash - an 'ver' hash (cannot be null).public void userCreated(User user, Map<String,Object> params)
UserEventListeneruserCreated in interface UserEventListeneruser - the user.params - event parameters.public void userModified(User user, Map<String,Object> params)
UserEventListeneruserModified in interface UserEventListeneruser - the user.params - event parameters.public static String getLocalDomainVerHash()
Copyright © 2003–2020 Ignite Realtime. All rights reserved.