diff --git a/build/resources/META-INF/smack-config.xml b/build/resources/META-INF/smack-config.xml
index eb0ea25ce..09068ad76 100644
--- a/build/resources/META-INF/smack-config.xml
+++ b/build/resources/META-INF/smack-config.xml
@@ -5,6 +5,7 @@
What is?
+
+Privacy is a method for users to block communications from particular other users. In XMPP this is done by managing one's privacy lists.
+Server-side privacy lists enable successful completion of the following use cases:
+
+ +
How can I use it?
+ ++The API implementation releases three main public classes: +
+ // Create a privacy manager for the current connection. + PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(myConnection); + // Retrieve server privacy lists + PrivacyList[] lists = privacyManager.getPrivacyLists(); ++
+ // Set the name of the list + String listName = "newList"; + + // Create the list of PrivacyItem that will allow or deny some privacy aspect + String user = "tybalt@example.com"; + String groupName = "enemies"; + ArrayList privacyItems = new ArrayList(); + + PrivacyItem item = new PrivacyItem(PrivacyRule.JID, true, 1); + item.setValue(user); + privacyItems.add(item); + + item = new PrivacyItem(PrivacyRule.SUBSCRIPTION, true, 2); + item.setValue(PrivacyRule.SUBSCRIPTION_BOTH); + privacyItems.add(item); + + item = new PrivacyItem(PrivacyRule.GROUP, false, 3); + item.setValue(groupName); + item.setFilterMessage(true); + privacyItems.add(item); + + // Get the privacy manager for the current connection. + PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(myConnection); + // Create the new list. + privacyManager.createPrivacyList(listName, Arrays.asList(privacyItems)); ++
+ // Set the name of the list + String listName = "existingList"; + // Get the privacy manager for the current connection. + PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(myConnection); + // Sent the new list to the server. + privacyManager.updatePrivacyList(listName, items); ++
+ // Set the name of the list + String listName = "existingList"; + // Get the privacy manager for the current connection. + PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(myConnection); + // Remove the list. + privacyManager.deletePrivacyList(listName); ++
+ // Get the privacy manager for the current connection. + PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(myConnection); + // Decline the use of the active list. + privacyManager.declineActiveList(); ++
+ // Get the privacy manager for the current connection. + PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(myConnection); + // Decline the use of the default list. + privacyManager.declineDefaultList(); ++
Listening for Privacy Changes
+
+In order to handle privacy changes, clients SHOULD listen manager's updates.
+When a list is changed the manager notifies every added listener. Listeners MUST implement the PrivacyListListener interface.
+
+
+
+Clients may need to react when a privacy list is modified. The PrivacyListManager lets you add listerners that will be notified when a list has been changed. Listeners should implement the PrivacyListListener interface.
+The most important notification is updatedPrivacyList that is performed when a privacy list changes its privacy items.
+
+The listener becomes notified after performing:
+
+ // Get the privacy manager for the current connection. + PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(myConnection); + // Add the listener (this) to get notified + privacyManager.addListener(this); ++
References
+diff --git a/documentation/privacy.html b/documentation/privacy.html new file mode 100644 index 000000000..0d6d2335e --- /dev/null +++ b/documentation/privacy.html @@ -0,0 +1,167 @@ + +
+
+ + + +
+