public class EntityCapsManager extends Manager
Modifier and Type | Class and Description |
---|---|
static class |
EntityCapsManager.NodeVerHash |
Modifier and Type | Field and Description |
---|---|
protected static java.util.Map<java.lang.String,DiscoverInfo> |
caps
Map of (node + '#" + hash algorithm) to DiscoverInfo data
|
static java.lang.String |
ELEMENT |
protected static java.util.Map<java.lang.String,EntityCapsManager.NodeVerHash> |
jidCaps
Map of Full JID -> DiscoverInfo/null.
|
static java.lang.String |
NAMESPACE |
protected static EntityCapsPersistentCache |
persistentCache |
Modifier and Type | Method and Description |
---|---|
static void |
addDiscoverInfoByNode(java.lang.String nodeVer,
DiscoverInfo info)
Add DiscoverInfo to the database.
|
boolean |
areEntityCapsSupported(java.lang.String jid)
Returns true if Entity Caps are supported by a given JID
|
boolean |
areEntityCapsSupportedByServer()
Returns true if Entity Caps are supported by the local service/server
|
void |
disableEntityCaps() |
void |
enableEntityCaps() |
boolean |
entityCapsEnabled() |
protected static java.lang.String |
generateVerificationString(DiscoverInfo discoverInfo,
java.lang.String hash)
Generates a XEP-115 Verification String
|
java.lang.String |
getCapsVersion()
Get our own caps version.
|
static DiscoverInfo |
getDiscoverInfoByUser(java.lang.String user)
Get the discover info given a user name.
|
static DiscoverInfo |
getDiscoveryInfoByNodeVer(java.lang.String nodeVer)
Retrieve DiscoverInfo for a specific node.
|
static EntityCapsManager |
getInstanceFor(XMPPConnection connection) |
java.lang.String |
getLocalNodeVer()
Returns the local entity's NodeVer (e.g.
|
static EntityCapsManager.NodeVerHash |
getNodeVerHashByJid(java.lang.String jid) |
static java.lang.String |
getNodeVersionByJid(java.lang.String jid)
Get the Node version (node#ver) of a JID.
|
void |
removeUserCapsNode(java.lang.String user)
Remove a record telling what entity caps node a user has.
|
static void |
setCapsMaxCacheSize(int maxCacheSize)
Sets the maximum Cache size for the nodeVer to DiscoverInfo Cache
|
static void |
setDefaultEntityNode(java.lang.String entityNode)
Set the default entity node that will be used for new EntityCapsManagers
|
void |
setEntityNode(java.lang.String entityNode) |
static void |
setJidCapsMaxCacheSize(int maxCacheSize)
Sets the maximum Cache size for the JID to nodeVer Cache
|
static void |
setPersistentCache(EntityCapsPersistentCache cache)
Set the persistent cache implementation
|
void |
updateLocalEntityCaps()
Updates the local user Entity Caps information with the data provided
If we are connected and there was already a presence send, another
presence is send to inform others about your new Entity Caps node string.
|
static boolean |
verifyDiscoverInfoVersion(java.lang.String ver,
java.lang.String hash,
DiscoverInfo info)
Verify DisoverInfo and Caps Node as defined in XEP-0115 5.4 Processing
Method
|
protected static boolean |
verifyPacketExtensions(DiscoverInfo info) |
connection, schedule
public static final java.lang.String NAMESPACE
public static final java.lang.String ELEMENT
protected static EntityCapsPersistentCache persistentCache
protected static java.util.Map<java.lang.String,DiscoverInfo> caps
protected static java.util.Map<java.lang.String,EntityCapsManager.NodeVerHash> jidCaps
public static void setDefaultEntityNode(java.lang.String entityNode)
entityNode
- public static void addDiscoverInfoByNode(java.lang.String nodeVer, DiscoverInfo info)
nodeVer
- The node and verification String (e.g.
"http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w=").info
- DiscoverInfo for the specified node.public static java.lang.String getNodeVersionByJid(java.lang.String jid)
jid
- the user (Full JID)public static EntityCapsManager.NodeVerHash getNodeVerHashByJid(java.lang.String jid)
public static DiscoverInfo getDiscoverInfoByUser(java.lang.String user)
user
- user name (Full JID)public static DiscoverInfo getDiscoveryInfoByNodeVer(java.lang.String nodeVer)
nodeVer
- The node name (e.g.
"http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w=").public static void setPersistentCache(EntityCapsPersistentCache cache) throws java.io.IOException
cache
- java.io.IOException
public static void setJidCapsMaxCacheSize(int maxCacheSize)
maxCacheSize
- public static void setCapsMaxCacheSize(int maxCacheSize)
maxCacheSize
- public static EntityCapsManager getInstanceFor(XMPPConnection connection)
public void enableEntityCaps()
public void disableEntityCaps()
public boolean entityCapsEnabled()
public void setEntityNode(java.lang.String entityNode) throws SmackException.NotConnectedException
public void removeUserCapsNode(java.lang.String user)
user
- the user (Full JID)public java.lang.String getCapsVersion()
public java.lang.String getLocalNodeVer()
public boolean areEntityCapsSupported(java.lang.String jid) throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
jid
- XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public boolean areEntityCapsSupportedByServer() throws SmackException.NoResponseException, XMPPException.XMPPErrorException, SmackException.NotConnectedException
XMPPException.XMPPErrorException
SmackException.NoResponseException
SmackException.NotConnectedException
public void updateLocalEntityCaps()
public static boolean verifyDiscoverInfoVersion(java.lang.String ver, java.lang.String hash, DiscoverInfo info)
ver
- hash
- info
- protected static boolean verifyPacketExtensions(DiscoverInfo info)
info
- protected static java.lang.String generateVerificationString(DiscoverInfo discoverInfo, java.lang.String hash)
discoverInfo
- hash
- the used hash function