Confidentiality is a method that allows users to block communication with other users. In XMPP, this is done by managing a single privacy list.
1 - To add a new list to the server, the client MAY implement something like:
// Create a privacy manager for the current connection._ PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(myConnection); // Retrieve server privacy lists_ PrivacyList[] lists = privacyManager.getPrivacyLists();
2 - To add a new list to the server, the client MAY implement something like:
// 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(PrivacyItem.Type.jid, user, true, 1); privacyItems.add(item); item = new PrivacyItem(PrivacyItem.Type.subscription, PrivacyItem.SUBSCRIPTION_BOTH, true, 2); privacyItems.add(item); item = new PrivacyItem(PrivacyItem.Type.group, groupName, false, 3); 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, privacyItems);
code>
Hsh
source share