Smack

org.jivesoftware.smack
Class PrivacyListManager

java.lang.Object
  extended by org.jivesoftware.smack.PrivacyListManager

public class PrivacyListManager
extends Object

A PrivacyListManager is used by XMPP clients to block or allow communications from other users. Use the manager to:

Privacy Items can handle different kind of permission communications based on JID, group, subscription type or globally (@see PrivacyItem).

Author:
Francisco Vives

Method Summary
 void addListener(PrivacyListListener listener)
          Adds a packet listener that will be notified of any new update in the user privacy communication.
 void createPrivacyList(String listName, List<PrivacyItem> privacyItems)
          The client has created a new list.
 void declineActiveList()
          Client declines the use of active lists.
 void declineDefaultList()
          Client declines the use of default lists.
 void deletePrivacyList(String listName)
          Remove a privacy list.
 PrivacyList getActiveList()
          Answer the active privacy list.
 PrivacyList getDefaultList()
          Answer the default privacy list.
static PrivacyListManager getInstanceFor(XMPPConnection connection)
          Returns the PrivacyListManager instance associated with a given XMPPConnection.
 PrivacyList getPrivacyList(String listName)
          Answer the privacy list items under listName with the allowed and blocked permissions.
 PrivacyList[] getPrivacyLists()
          Answer every privacy list with the allowed and blocked permissions.
 void setActiveListName(String listName)
          Set or change the active list to listName.
 void setDefaultListName(String listName)
          Set or change the default list to listName.
 void updatePrivacyList(String listName, List<PrivacyItem> privacyItems)
          The client has edited an existing list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstanceFor

public static PrivacyListManager getInstanceFor(XMPPConnection connection)
Returns the PrivacyListManager instance associated with a given XMPPConnection.

Parameters:
connection - the connection used to look for the proper PrivacyListManager.
Returns:
the PrivacyListManager associated with a given XMPPConnection.

getActiveList

public PrivacyList getActiveList()
                          throws XMPPException
Answer the active privacy list.

Returns:
the privacy list of the active list.
Throws:
XMPPException - if an error occurs.

getDefaultList

public PrivacyList getDefaultList()
                           throws XMPPException
Answer the default privacy list.

Returns:
the privacy list of the default list.
Throws:
XMPPException - if an error occurs.

getPrivacyList

public PrivacyList getPrivacyList(String listName)
                           throws XMPPException
Answer the privacy list items under listName with the allowed and blocked permissions.

Parameters:
listName - the name of the list to get the allowed and blocked permissions.
Returns:
a privacy list under the list listName.
Throws:
XMPPException - if an error occurs.

getPrivacyLists

public PrivacyList[] getPrivacyLists()
                              throws XMPPException
Answer every privacy list with the allowed and blocked permissions.

Returns:
an array of privacy lists.
Throws:
XMPPException - if an error occurs.

setActiveListName

public void setActiveListName(String listName)
                       throws XMPPException
Set or change the active list to listName.

Parameters:
listName - the list name to set as the active one.
Throws:
XMPPException - if the request or the answer failed, it raises an exception.

declineActiveList

public void declineActiveList()
                       throws XMPPException
Client declines the use of active lists.

Throws:
XMPPException - if an error occurs.

setDefaultListName

public void setDefaultListName(String listName)
                        throws XMPPException
Set or change the default list to listName.

Parameters:
listName - the list name to set as the default one.
Throws:
XMPPException - if the request or the answer failed, it raises an exception.

declineDefaultList

public void declineDefaultList()
                        throws XMPPException
Client declines the use of default lists.

Throws:
XMPPException - if an error occurs.

createPrivacyList

public void createPrivacyList(String listName,
                              List<PrivacyItem> privacyItems)
                       throws XMPPException
The client has created a new list. It send the new one to the server.

Parameters:
listName - the list that has changed its content.
privacyItems - a List with every privacy item in the list.
Throws:
XMPPException - if an error occurs.

updatePrivacyList

public void updatePrivacyList(String listName,
                              List<PrivacyItem> privacyItems)
                       throws XMPPException
The client has edited an existing list. It updates the server content with the resulting list of privacy items. The PrivacyItem list MUST contain all elements in the list (not the "delta").

Parameters:
listName - the list that has changed its content.
privacyItems - a List with every privacy item in the list.
Throws:
XMPPException - if an error occurs.

deletePrivacyList

public void deletePrivacyList(String listName)
                       throws XMPPException
Remove a privacy list.

Parameters:
listName - the list that has changed its content.
Throws:
XMPPException - if an error occurs.

addListener

public void addListener(PrivacyListListener listener)
Adds a packet listener that will be notified of any new update in the user privacy communication.

Parameters:
listener - a packet listener.

Smack

Copyright © 2003-2007 Jive Software.