public class Privacy extends IQ
PrivacyListManager
and PrivacyProvider
to allow and block
communications from other users. It contains the appropriate structure to suit
user-defined privacy lists. Different configured Privacy packages are used in the
server & manager communication in order to:
PrivacyItem
DEFAULT_LANGUAGE, ID_NOT_AVAILABLE
Constructor and Description |
---|
Privacy() |
Modifier and Type | Method and Description |
---|---|
boolean |
changeDefaultList(String newDefault)
Sets a given privacy list as the new user default list.
|
void |
deleteList(String listName)
Remove the list.
|
void |
deletePrivacyList(String listName)
Deletes an existing privacy list.
|
String |
getActiveName()
Returns the name associated with the active list set for the session.
|
List<PrivacyItem> |
getActivePrivacyList()
Returns the active privacy list or null if none was found.
|
String |
getChildElementXML()
Returns the sub-element XML section of the IQ packet, or null if there
isn't one.
|
String |
getDefaultName()
Returns the name of the default list that applies to the user as a whole.
|
List<PrivacyItem> |
getDefaultPrivacyList()
Returns the default privacy list or null if none was found.
|
PrivacyItem |
getItem(String listName,
int order)
Returns the privacy item in the specified order.
|
Map<String,List<PrivacyItem>> |
getItemLists()
Returns the collection of privacy list that the user holds.
|
List<PrivacyItem> |
getPrivacyList(String listName)
Returns a specific privacy list.
|
Set<String> |
getPrivacyListNames()
Returns all the list names the user has defined to group restrictions.
|
boolean |
isDeclineActiveList()
Returns whether the receiver allows or declines the use of an active list.
|
boolean |
isDeclineDefaultList()
Returns whether the receiver allows or declines the use of a default list.
|
void |
setActiveName(String activeName)
Sets the name associated with the active list set for the session.
|
List<PrivacyItem> |
setActivePrivacyList()
Set the active list based on the default list.
|
void |
setDeclineActiveList(boolean declineActiveList)
Sets whether the receiver allows or declines the use of an active list.
|
void |
setDeclineDefaultList(boolean declineDefaultList)
Sets whether the receiver allows or declines the use of a default list.
|
void |
setDefaultName(String defaultName)
Sets the name of the default list that applies to the user as a whole.
|
List<PrivacyItem> |
setPrivacyList(String listName,
List<PrivacyItem> listItem)
Set or update a privacy list with privacy items.
|
createErrorResponse, createResultIQ, getType, setType, toXML
addCommonAttributes, addExtension, addExtensions, equals, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensionsXML, getFrom, getPacketID, getTo, getXmlns, hashCode, nextID, removeExtension, setDefaultXmlns, setError, setFrom, setPacketID, setTo, toString
public Privacy()
public List<PrivacyItem> setPrivacyList(String listName, List<PrivacyItem> listItem)
listName
- the name of the new privacy list.listItem
- the PrivacyItem
that rules the list.public List<PrivacyItem> setActivePrivacyList()
public void deletePrivacyList(String listName)
listName
- the name of the list being deleted.public List<PrivacyItem> getActivePrivacyList()
PrivacyItem
or null if none was found.public List<PrivacyItem> getDefaultPrivacyList()
PrivacyItem
or null if none was found.public List<PrivacyItem> getPrivacyList(String listName)
listName
- the name of the list to get.PrivacyItem
public PrivacyItem getItem(String listName, int order)
listName
- the name of the privacy list.order
- the order of the element.PrivacyItem
public boolean changeDefaultList(String newDefault)
newDefault
- the new default privacy list.public void deleteList(String listName)
listName
- name of the list to remove.public String getActiveName()
public void setActiveName(String activeName)
activeName
- is the name of the active list.public String getDefaultName()
public void setDefaultName(String defaultName)
defaultName
- is the name of the default list.public Map<String,List<PrivacyItem>> getItemLists()
public boolean isDeclineActiveList()
public void setDeclineActiveList(boolean declineActiveList)
declineActiveList
- indicates if the receiver declines the use of an active list.public boolean isDeclineDefaultList()
public void setDeclineDefaultList(boolean declineDefaultList)
declineDefaultList
- indicates if the receiver declines the use of a default list.public Set<String> getPrivacyListNames()
public String getChildElementXML()
IQ
Extensions of this class must override this method.
getChildElementXML
in class IQ