public class ScServiceDiscoveryManager
extends java.lang.Object
implements org.jivesoftware.smack.PacketInterceptor, org.jivesoftware.smackx.NodeInformationProvider
ServiceDiscoveryManager
that adds
support for XEP-0115 - Entity Capabilities.
This work is based on Jonas Adahl's smack fork.Constructor and Description |
---|
ScServiceDiscoveryManager(ProtocolProviderService parentProvider,
org.jivesoftware.smack.Connection connection,
java.lang.String[] featuresToRemove,
java.lang.String[] featuresToAdd,
boolean cacheNonCaps)
Creates a new ScServiceDiscoveryManager wrapping the default
discovery manager of the specified connection.
|
Modifier and Type | Method and Description |
---|---|
void |
addExtFeature(java.lang.String ext)
Add feature to put in "ext" attribute.
|
void |
addFeature(java.lang.String feature)
Registers that a new feature is supported by this XMPP entity.
|
org.jivesoftware.smackx.packet.DiscoverInfo |
discoverInfo(java.lang.String entityID)
Returns the discovered information of a given XMPP entity addressed by
its JID.
|
org.jivesoftware.smackx.packet.DiscoverInfo |
discoverInfo(java.lang.String entityID,
java.lang.String node)
Returns the discovered information of a given XMPP entity addressed by
its JID and note attribute.
|
org.jivesoftware.smackx.packet.DiscoverInfo |
discoverInfoNonBlocking(java.lang.String entityID)
Returns the discovered information of a given XMPP entity addressed by
its JID if locally cached, otherwise schedules for retrieval.
|
org.jivesoftware.smackx.packet.DiscoverItems |
discoverItems(java.lang.String entityID)
Returns the discovered items of a given XMPP entity addressed by its JID.
|
org.jivesoftware.smackx.packet.DiscoverItems |
discoverItems(java.lang.String entityID,
java.lang.String node)
Returns the discovered items of a given XMPP entity addressed by its JID
and note attribute.
|
EntityCapsManager |
getCapsManager()
Gets the EntityCapsManager which handles the entity capabilities
for this ScServiceDiscoveryManager.
|
java.lang.String |
getExtFeatures()
Get "ext" value.
|
java.util.List<java.lang.String> |
getFeatures()
Returns a reference to our local copy of the feature list supported by
this implementation.
|
java.util.List<java.lang.String> |
getNodeFeatures()
Returns a list of the features defined in the node.
|
java.util.List<org.jivesoftware.smackx.packet.DiscoverInfo.Identity> |
getNodeIdentities()
Returns a list of the identities defined in the node.
|
java.util.List<org.jivesoftware.smackx.packet.DiscoverItems.Item> |
getNodeItems()
Returns a list of the Items
DiscoverItems.Item defined in the
node or in other words null since we don't support any. |
org.jivesoftware.smackx.packet.DiscoverInfo |
getOwnDiscoverInfo()
Get a DiscoverInfo for the current entity caps node.
|
boolean |
includesFeature(java.lang.String feature)
Returns true if the specified feature is registered in our
ServiceDiscoveryManager and false otherwise. |
void |
interceptPacket(org.jivesoftware.smack.packet.Packet packet)
Intercepts outgoing presence packets and adds entity capabilities at
their ends.
|
void |
removeExtFeature(java.lang.String ext)
Remove "ext" feature.
|
void |
removeFeature(java.lang.String feature)
Removes the specified feature from the supported features by the
encapsulated ServiceDiscoveryManager.
|
void |
stop()
Clears/stops what's needed.
|
boolean |
supportsFeature(java.lang.String jid,
java.lang.String feature)
Returns true if jid supports the specified
feature and false otherwise.
|
public ScServiceDiscoveryManager(ProtocolProviderService parentProvider, org.jivesoftware.smack.Connection connection, java.lang.String[] featuresToRemove, java.lang.String[] featuresToAdd, boolean cacheNonCaps)
parentProvider
- the parent provider that creates discovery manager.connection
- Smack connection object that will be used by this
instance to handle XMPP connection.featuresToRemove
- an array of Strings representing the
features to be removed from the ServiceDiscoveryManager of the
specified connection which is to be wrapped by the new instancefeaturesToAdd
- an array of Strings representing the
features to be added to the new instance and to the
ServiceDiscoveryManager of the specified connection
which is to be wrapped by the new instancecacheNonCaps
- true if we want to cache entity features
even though it does not support XEP-0115public void addFeature(java.lang.String feature)
Since no packet is actually sent to the server it is safe to perform this operation before logging to the server. In fact, you may want to configure the supported features before logging to the server so that the information is already available if it is required upon login.
feature
- the feature to register as supported.public java.util.List<java.lang.String> getFeatures()
public org.jivesoftware.smackx.packet.DiscoverInfo getOwnDiscoverInfo()
public boolean includesFeature(java.lang.String feature)
ServiceDiscoveryManager
and false otherwise.feature
- the feature to look for.public void removeFeature(java.lang.String feature)
Since no packet is actually sent to the server it is safe to perform this operation before logging to the server.
feature
- the feature to remove from the supported features.public void addExtFeature(java.lang.String ext)
ext
- ext feature to addpublic void removeExtFeature(java.lang.String ext)
ext
- ext feature to removepublic java.lang.String getExtFeatures()
public void interceptPacket(org.jivesoftware.smack.packet.Packet packet)
interceptPacket
in interface org.jivesoftware.smack.PacketInterceptor
packet
- the (hopefully presence) packet we need to add a "c"
element to.public java.util.List<org.jivesoftware.smackx.packet.DiscoverItems.Item> getNodeItems()
DiscoverItems.Item
defined in the
node or in other words null since we don't support any.getNodeItems
in interface org.jivesoftware.smackx.NodeInformationProvider
public java.util.List<java.lang.String> getNodeFeatures()
getNodeFeatures
in interface org.jivesoftware.smackx.NodeInformationProvider
public java.util.List<org.jivesoftware.smackx.packet.DiscoverInfo.Identity> getNodeIdentities()
getNodeIdentities
in interface org.jivesoftware.smackx.NodeInformationProvider
public org.jivesoftware.smackx.packet.DiscoverInfo discoverInfo(java.lang.String entityID) throws org.jivesoftware.smack.XMPPException
entityID
- the address of the XMPP entity.org.jivesoftware.smack.XMPPException
- if the operation failed for some reason.public org.jivesoftware.smackx.packet.DiscoverInfo discoverInfoNonBlocking(java.lang.String entityID) throws org.jivesoftware.smack.XMPPException
entityID
- the address of the XMPP entity.org.jivesoftware.smack.XMPPException
- if the operation failed for some reason.public org.jivesoftware.smackx.packet.DiscoverInfo discoverInfo(java.lang.String entityID, java.lang.String node) throws org.jivesoftware.smack.XMPPException
entityID
- the address of the XMPP entity.node
- the attribute that supplements the 'jid' attribute.org.jivesoftware.smack.XMPPException
- if the operation failed for some reason.public org.jivesoftware.smackx.packet.DiscoverItems discoverItems(java.lang.String entityID) throws org.jivesoftware.smack.XMPPException
entityID
- the address of the XMPP entity.org.jivesoftware.smack.XMPPException
- if the operation failed for some reason.public org.jivesoftware.smackx.packet.DiscoverItems discoverItems(java.lang.String entityID, java.lang.String node) throws org.jivesoftware.smack.XMPPException
entityID
- the address of the XMPP entity.node
- the attribute that supplements the 'jid' attribute.org.jivesoftware.smack.XMPPException
- if the operation failed for some reason.public boolean supportsFeature(java.lang.String jid, java.lang.String feature)
jid
- the jabber ID we'd like to test for supportfeature
- the URN feature we are interested inpublic EntityCapsManager getCapsManager()
public void stop()
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.