public class EntityCapsManager extends Manager
Modifier and Type | Class and Description |
---|---|
static class |
EntityCapsManager.NodeVerHash |
Modifier and Type | Field and Description |
---|---|
protected static Map<String,DiscoverInfo> |
caps
Map of (node + '#" + hash algorithm) to DiscoverInfo data
|
static String |
ELEMENT |
protected static Map<String,EntityCapsManager.NodeVerHash> |
jidCaps
Map of Full JID -> DiscoverInfo/null.
|
static String |
NAMESPACE |
protected static EntityCapsPersistentCache |
persistentCache |
Modifier and Type | Method and Description |
---|---|
static void |
addDiscoverInfoByNode(String nodeVer,
DiscoverInfo info)
Add DiscoverInfo to the database.
|
boolean |
areEntityCapsSupported(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 String |
generateVerificationString(DiscoverInfo discoverInfo,
String hash)
Generates a XEP-115 Verification String
|
String |
getCapsVersion()
Get our own caps version.
|
static DiscoverInfo |
getDiscoverInfoByUser(String user)
Get the discover info given a user name.
|
static DiscoverInfo |
getDiscoveryInfoByNodeVer(String nodeVer)
Retrieve DiscoverInfo for a specific node.
|
static EntityCapsManager |
getInstanceFor(XMPPConnection connection) |
String |
getLocalNodeVer()
Returns the local entity's NodeVer (e.g.
|
static EntityCapsManager.NodeVerHash |
getNodeVerHashByJid(String jid) |
static String |
getNodeVersionByJid(String jid)
Get the Node version (node#ver) of a JID.
|
void |
removeUserCapsNode(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(String entityNode)
Set the default entity node that will be used for new EntityCapsManagers
|
void |
setEntityNode(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(String ver,
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 String NAMESPACE
public static final String ELEMENT
protected static EntityCapsPersistentCache persistentCache
protected static Map<String,DiscoverInfo> caps
protected static Map<String,EntityCapsManager.NodeVerHash> jidCaps
public static void setDefaultEntityNode(String entityNode)
entityNode
- public static void addDiscoverInfoByNode(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 String getNodeVersionByJid(String jid)
jid
- the user (Full JID)public static EntityCapsManager.NodeVerHash getNodeVerHashByJid(String jid)
public static DiscoverInfo getDiscoverInfoByUser(String user)
user
- user name (Full JID)public static DiscoverInfo getDiscoveryInfoByNodeVer(String nodeVer)
nodeVer
- The node name (e.g.
"http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w=").public static void setPersistentCache(EntityCapsPersistentCache cache) throws IOException
cache
- 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(String entityNode) throws SmackException.NotConnectedException
public void removeUserCapsNode(String user)
user
- the user (Full JID)public String getCapsVersion()
public String getLocalNodeVer()
public boolean areEntityCapsSupported(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(String ver, String hash, DiscoverInfo info)
ver
- hash
- info
- protected static boolean verifyPacketExtensions(DiscoverInfo info)
info
- protected static String generateVerificationString(DiscoverInfo discoverInfo, String hash)
discoverInfo
- hash
- the used hash function