From c7d468697f158311eb583bc9925dc849da45dff8 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sat, 22 Jun 2013 17:00:40 +0000 Subject: [PATCH] SMACK-431 Entity Capabilities are now enabled as default for new connections. Added an extensions documentation html page. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13686 b35dd754-fafc-0310-a699-88a17e54d16e --- documentation/extensions/caps.html | 63 +++++++++++++++++++ documentation/extensions/toc.html | 3 +- .../smack/SmackConfiguration.java | 2 +- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 documentation/extensions/caps.html 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 @@ + + +Entity Capabilities + + + + + +
Entity Capabilities

+This section details the usage of Smacks implementation of Entity Capabilities. +

+XEP related: XEP-0115: Entity Capabilities + +
+ +Description

+ +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. +

+ +Examples

+ +Enable 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();
+
+
+ +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);
+
+      // 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);
+
+
+

+ +
+ + + + diff --git a/documentation/extensions/toc.html b/documentation/extensions/toc.html index f5d8ac778..98113ae58 100644 --- a/documentation/extensions/toc.html +++ b/documentation/extensions/toc.html @@ -22,7 +22,8 @@ Service Discovery
File Transfer
PubSub
+Entity Capabilities

- \ No newline at end of file + diff --git a/source/org/jivesoftware/smack/SmackConfiguration.java b/source/org/jivesoftware/smack/SmackConfiguration.java index cd50984b7..7bf3e0f31 100644 --- a/source/org/jivesoftware/smack/SmackConfiguration.java +++ b/source/org/jivesoftware/smack/SmackConfiguration.java @@ -74,7 +74,7 @@ public final class SmackConfiguration { /** * This automatically enables EntityCaps for new connections if it is set to true */ - private static boolean autoEnableEntityCaps = false; + private static boolean autoEnableEntityCaps = true; private SmackConfiguration() { }