public class EntityCapsManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
EntityCapsManager.Caps
Implements an immutable value which stands for a specific node, a
specific hash (algorithm) and a specific ver.
|
Constructor and Description |
---|
EntityCapsManager() |
Modifier and Type | Method and Description |
---|---|
void |
addCapsVerListener(CapsVerListener listener)
Adds listener to the list of
CapsVerListener s that we
notify when new features occur and the version hash needs to be
regenerated. |
static void |
addDiscoverInfoByCaps(EntityCapsManager.Caps caps,
org.jivesoftware.smackx.packet.DiscoverInfo info)
Add
DiscoverInfo to our caps database. |
void |
addPacketListener(org.jivesoftware.smack.Connection connection)
Registers this Manager's listener with connection.
|
void |
addUserCapsNodeListener(UserCapsNodeListener listener)
Adds a specific UserCapsNodeListener to the list of
UserCapsNodeListeners interested in events notifying about
changes in the list of user caps nodes of this
EntityCapsManager.
|
void |
calculateEntityCapsVersion(org.jivesoftware.smackx.packet.DiscoverInfo discoverInfo)
Calculates the ver string for the specified discoverInfo,
identity type, name features, and extendedInfo.
|
EntityCapsManager.Caps |
getCapsByUser(java.lang.String user)
Gets the Caps i.e.
|
java.lang.String |
getCapsVersion()
Get our own caps version.
|
static org.jivesoftware.smackx.packet.DiscoverInfo |
getDiscoverInfoByCaps(EntityCapsManager.Caps caps)
Retrieve DiscoverInfo for a specific node.
|
org.jivesoftware.smackx.packet.DiscoverInfo |
getDiscoverInfoByUser(java.lang.String user)
Get the discover info given a user name.
|
java.util.ArrayList<java.lang.String> |
getFullJidsByBareJid(java.lang.String bareJid)
Gets the full Jids (with resources) as Strings.
|
java.lang.String |
getNode()
Get our own entity node.
|
void |
removeCapsVerListener(CapsVerListener listener)
Removes listener from the list of currently registered
CapsVerListener s. |
void |
removeContactCapsNode(Contact contact)
Remove records telling what entity caps node a contact has.
|
void |
removeUserCapsNode(java.lang.String user)
Remove a record telling what entity caps node a user has.
|
void |
removeUserCapsNodeListener(UserCapsNodeListener listener)
Removes a specific UserCapsNodeListener from the list of
UserCapsNodeListeners interested in events notifying about
changes in the list of user caps nodes of this
EntityCapsManager.
|
static void |
setBundleContext(org.osgi.framework.BundleContext bundleContext)
Sets OSGi bundle context instance that will be used by this class.
|
void |
setCurrentCapsVersion(org.jivesoftware.smackx.packet.DiscoverInfo discoverInfo,
java.lang.String capsVersion)
Set our own caps version.
|
void |
setNode(java.lang.String node)
Set our own entity node.
|
public static void addDiscoverInfoByCaps(EntityCapsManager.Caps caps, org.jivesoftware.smackx.packet.DiscoverInfo info)
DiscoverInfo
to our caps database.
Warning: The specified DiscoverInfo is trusted to be valid with respect to the specified Caps for performance reasons because the DiscoverInfo should have already been validated in order to be used elsewhere anyway.
caps
- the Caps i.e. the node, the hash and the ver for
which a DiscoverInfo is to be added to our caps database.info
- DiscoverInfo
for the specified Caps.public static void setBundleContext(org.osgi.framework.BundleContext bundleContext)
bundleContext
- the BundleContext instance to be used by
this class or null to clear the reference.public void addUserCapsNodeListener(UserCapsNodeListener listener)
listener
- the UserCapsNodeListener which is interested in
events notifying about changes in the list of user caps nodes of this
EntityCapsManagerpublic void removeContactCapsNode(Contact contact)
contact
- the contactpublic void removeUserCapsNode(java.lang.String user)
user
- the user (Full JID)public void removeUserCapsNodeListener(UserCapsNodeListener listener)
listener
- the UserCapsNodeListener which is no longer
interested in events notifying about changes in the list of user caps
nodes of this EntityCapsManagerpublic EntityCapsManager.Caps getCapsByUser(java.lang.String user)
user
- the user (Full JID)public java.util.ArrayList<java.lang.String> getFullJidsByBareJid(java.lang.String bareJid)
the
- bare Jidpublic org.jivesoftware.smackx.packet.DiscoverInfo getDiscoverInfoByUser(java.lang.String user)
user
- user name (Full JID)public java.lang.String getCapsVersion()
public java.lang.String getNode()
public void setNode(java.lang.String node)
node
- the new nodepublic static org.jivesoftware.smackx.packet.DiscoverInfo getDiscoverInfoByCaps(EntityCapsManager.Caps caps)
caps
- the Caps i.e. the node, the hash and the verpublic void addPacketListener(org.jivesoftware.smack.Connection connection)
connection
- the connection that we'd like this manager to register
with.public void addCapsVerListener(CapsVerListener listener)
CapsVerListener
s that we
notify when new features occur and the version hash needs to be
regenerated. The method would also notify listener if our
current caps version has been generated and is different than
null.listener
- the CapsVerListener
we'd like to register.public void removeCapsVerListener(CapsVerListener listener)
CapsVerListener
s.listener
- the CapsVerListener
we'd like to unregister.public void calculateEntityCapsVersion(org.jivesoftware.smackx.packet.DiscoverInfo discoverInfo)
discoverInfo
- the DiscoverInfo
we'd be creating a ver
String forpublic void setCurrentCapsVersion(org.jivesoftware.smackx.packet.DiscoverInfo discoverInfo, java.lang.String capsVersion)
discoverInfo
- the DiscoverInfo
that we'd like to map to the
capsVersion.capsVersion
- the new caps version
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.