Class EntityCapsManager


  • public final class EntityCapsManager
    extends org.jivesoftware.smack.Manager
    Keeps track of entity capabilities.
    See Also:
    XEP-0115: Entity Capabilities
    • Method Detail

      • setDefaultEntityNode

        public static void setDefaultEntityNode​(java.lang.String entityNode)
        Set the default entity node that will be used for new EntityCapsManagers.
        Parameters:
        entityNode - TODO javadoc me please
      • getNodeVersionByJid

        public static java.lang.String getNodeVersionByJid​(org.jxmpp.jid.Jid jid)
        Get the Node version (node#ver) of a JID. Returns a String or null if EntiyCapsManager does not have any information.
        Parameters:
        jid - TODO javadoc me please the user (Full JID)
        Returns:
        the node version (node#ver) or null
      • getDiscoverInfoByUser

        public static DiscoverInfo getDiscoverInfoByUser​(org.jxmpp.jid.Jid user)
        Get the discover info given a user name. The discover info is returned if the user has a node#ver associated with it and the node#ver has a discover info associated with it.
        Parameters:
        user - TODO javadoc me please user name (Full JID)
        Returns:
        the discovered info
      • getDiscoveryInfoByNodeVer

        public static DiscoverInfo getDiscoveryInfoByNodeVer​(java.lang.String nodeVer)
        Retrieve DiscoverInfo for a specific node.
        Parameters:
        nodeVer - TODO javadoc me please The node name (e.g. "http://psi-im.org#q07IKJEyjvHSyhy//CH0CxmKi8w=").
        Returns:
        The corresponding DiscoverInfo or null if none is known.
      • setPersistentCache

        public static void setPersistentCache​(EntityCapsPersistentCache cache)
        Set the persistent cache implementation.
        Parameters:
        cache - TODO javadoc me please
      • setMaxsCacheSizes

        public static void setMaxsCacheSizes​(int maxJidToNodeVerSize,
                                             int maxCapsCacheSize)
        Sets the maximum cache sizes.
        Parameters:
        maxJidToNodeVerSize - TODO javadoc me please
        maxCapsCacheSize - TODO javadoc me please
      • clearMemoryCache

        public static void clearMemoryCache()
        Clears the memory cache.
      • getInstanceFor

        public static EntityCapsManager getInstanceFor​(org.jivesoftware.smack.XMPPConnection connection)
      • enableEntityCaps

        public void enableEntityCaps()
      • disableEntityCaps

        public void disableEntityCaps()
      • entityCapsEnabled

        public boolean entityCapsEnabled()
      • removeUserCapsNode

        public static void removeUserCapsNode​(org.jxmpp.jid.Jid user)
        Remove a record telling what entity caps node a user has.
        Parameters:
        user - TODO javadoc me please the user (Full JID)
      • getCapsVersionAndHash

        public CapsVersionAndHash getCapsVersionAndHash()
        Get our own caps version or null if none is yet set. The version depends on the enabled features. A caps version looks like '66/0NaeaBKkwk85efJTGmU47vXI='
        Returns:
        our own caps version or null.
      • getLocalNodeVer

        public java.lang.String getLocalNodeVer()
        Returns the local entity's NodeVer (e.g. "http://www.igniterealtime.org/projects/smack/#66/0NaeaBKkwk85efJTGmU47vXI= )
        Returns:
        the local NodeVer
      • areEntityCapsSupported

        public boolean areEntityCapsSupported​(org.jxmpp.jid.Jid jid)
                                       throws org.jivesoftware.smack.SmackException.NoResponseException,
                                              org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                              org.jivesoftware.smack.SmackException.NotConnectedException,
                                              java.lang.InterruptedException
        Returns true if Entity Caps are supported by a given JID.
        Parameters:
        jid - TODO javadoc me please
        Returns:
        true if the entity supports Entity Capabilities.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • areEntityCapsSupportedByServer

        public boolean areEntityCapsSupportedByServer()
                                               throws org.jivesoftware.smack.SmackException.NoResponseException,
                                                      org.jivesoftware.smack.XMPPException.XMPPErrorException,
                                                      org.jivesoftware.smack.SmackException.NotConnectedException,
                                                      java.lang.InterruptedException
        Returns true if Entity Caps are supported by the local service/server.
        Returns:
        true if the user's server supports Entity Capabilities.
        Throws:
        org.jivesoftware.smack.XMPPException.XMPPErrorException - if there was an XMPP error returned.
        org.jivesoftware.smack.SmackException.NoResponseException - if there was no response from the remote entity.
        org.jivesoftware.smack.SmackException.NotConnectedException - if the XMPP connection is not connected.
        java.lang.InterruptedException - if the calling thread was interrupted.
      • verifyDiscoverInfoVersion

        public static boolean verifyDiscoverInfoVersion​(java.lang.String ver,
                                                        java.lang.String hash,
                                                        DiscoverInfo info)
        Verify DiscoverInfo and Caps Node as defined in XEP-0115 5.4 Processing Method.
        Parameters:
        ver - TODO javadoc me please
        hash - TODO javadoc me please
        info - TODO javadoc me please
        Returns:
        true if it's valid and should be cache, false if not
        See Also:
        XEP-0115 5.4 Processing Method
      • generateVerificationString

        protected static CapsVersionAndHash generateVerificationString​(DiscoverInfoView discoverInfo,
                                                                       java.lang.String hash)
        Generates a XEP-115 Verification String
        Parameters:
        discoverInfo - TODO javadoc me please
        hash - TODO javadoc me please the used hash function, if null, default hash will be used
        Returns:
        The generated verification String or null if the hash is not supported
        See Also:
        XEP-115 Verification String