diff --git a/documentation/extensions/caps.html b/documentation/extensions/caps.html new file mode 100644 index 000000000..eb94e4bc1 --- /dev/null +++ b/documentation/extensions/caps.html @@ -0,0 +1,63 @@ + +
++This section details the usage of Smacks implementation of Entity Capabilities. +
+XEP related: XEP-0115: Entity Capabilities + ++ +Entity Capabilities is an extension to the Service Discovery (XEP-0030), which, in order to minimize network impact, caches the capabilities information of XMPP entities. + +
+ +Usage
+
+Entity Capabilities work silenty in background when enabled. If the remote XMPP entity does not support XEP-0115 but XEP-0030 then XEP-0030 mechanisms are transparently used. You can enable or disable Entity Capabilities by using EntityCapsManager.
+
+The cache used by Smack for Entity Capabilities is non-persistent as default. That is, the cache only uses memory. But it is also possible to set a persistent Entity Capabilities cache, which is recommended.
+
+
+Enable Entity Capabilities
+
+
++ +Configure a persistent cache for Entity Capabilities ++ // Get an instance of entity caps manager for the specified connection + Entity CapabilitiesManager mgr = new EntityCapsManager.getInstanceFor(con); + + // Enable entity capabilities + mgr.enableEntityCaps(); ++
++ + ++ // Get an instance of entity caps manager for the specified connection + Entity CapabilitiesManager mgr = new EntityCapsManager.getInstanceFor(con); + + // Create an cache, see smackx.entitycaps.cache for pre-defined cache implementations + EntityCapsPersistentCache cache = new SimpleDirectoryPersistentCache(new File("/foo/cachedir")); + + // Set the cache + mgr.setPersistentCache(cache); ++