public class Privacy
extends org.jivesoftware.smack.packet.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
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ELEMENT |
static java.lang.String |
NAMESPACE |
Constructor and Description |
---|
Privacy() |
Modifier and Type | Method and Description |
---|---|
boolean |
changeDefaultList(java.lang.String newDefault)
Sets a given privacy list as the new user default list.
|
void |
deleteList(java.lang.String listName)
Remove the list.
|
void |
deletePrivacyList(java.lang.String listName)
Deletes an existing privacy list.
|
java.lang.String |
getActiveName()
Returns the name associated with the active list set for the session.
|
java.util.List<PrivacyItem> |
getActivePrivacyList()
Returns the active privacy list or null if none was found.
|
java.lang.String |
getDefaultName()
Returns the name of the default list that applies to the user as a whole.
|
java.util.List<PrivacyItem> |
getDefaultPrivacyList()
Returns the default privacy list or null if none was found.
|
protected org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder |
getIQChildElementBuilder(org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder buf) |
PrivacyItem |
getItem(java.lang.String listName,
int order)
Returns the privacy item in the specified order.
|
java.util.Map<java.lang.String,java.util.List<PrivacyItem>> |
getItemLists()
Returns the collection of privacy list that the user holds.
|
java.util.List<PrivacyItem> |
getPrivacyList(java.lang.String listName)
Returns a specific privacy list.
|
java.util.Set<java.lang.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(java.lang.String activeName)
Sets the name associated with the active list set for the session.
|
java.util.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(java.lang.String defaultName)
Sets the name of the default list that applies to the user as a whole.
|
java.util.List<PrivacyItem> |
setPrivacyList(java.lang.String listName,
java.util.List<PrivacyItem> listItem)
Set or update a privacy list with privacy items.
|
createErrorResponse, createResultIQ, getChildElementName, getChildElementNamespace, getChildElementXML, getType, isRequestIQ, setType, toXML
addCommonAttributes, addExtension, addExtensions, appendErrorIfExists, getDefaultLanguage, getError, getExtension, getExtension, getExtensions, getExtensions, getExtensionsXML, getFrom, getLanguage, getPacketID, getStanzaId, getTo, hasExtension, hasExtension, hasStanzaIdSet, overrideExtension, removeExtension, removeExtension, setError, setFrom, setLanguage, setPacketID, setStanzaId, setTo, toString
public static final java.lang.String ELEMENT
public static final java.lang.String NAMESPACE
public java.util.List<PrivacyItem> setPrivacyList(java.lang.String listName, java.util.List<PrivacyItem> listItem)
listName
- the name of the new privacy list.listItem
- the PrivacyItem
that rules the list.public java.util.List<PrivacyItem> setActivePrivacyList()
public void deletePrivacyList(java.lang.String listName)
listName
- the name of the list being deleted.public java.util.List<PrivacyItem> getActivePrivacyList()
PrivacyItem
or null if none was found.public java.util.List<PrivacyItem> getDefaultPrivacyList()
PrivacyItem
or null if none was found.public java.util.List<PrivacyItem> getPrivacyList(java.lang.String listName)
listName
- the name of the list to get.PrivacyItem
public PrivacyItem getItem(java.lang.String listName, int order)
listName
- the name of the privacy list.order
- the order of the element.PrivacyItem
public boolean changeDefaultList(java.lang.String newDefault)
newDefault
- the new default privacy list.public void deleteList(java.lang.String listName)
listName
- name of the list to remove.public java.lang.String getActiveName()
public void setActiveName(java.lang.String activeName)
activeName
- is the name of the active list.public java.lang.String getDefaultName()
public void setDefaultName(java.lang.String defaultName)
defaultName
- is the name of the default list.public java.util.Map<java.lang.String,java.util.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 java.util.Set<java.lang.String> getPrivacyListNames()
protected org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder buf)
getIQChildElementBuilder
in class org.jivesoftware.smack.packet.IQ