public final class PrivacyList extends java.lang.Object implements java.lang.Comparable<PrivacyList>
The implementation of a privacy list.
This class is immutable.Most instant messaging systems have found it necessary to implement some method for users to block communications from particular other users (this is also required by sections 5.1.5, 5.1.15, 5.3.2, and 5.4.10 of RFC 2779 [3]. In XMPP this is done by managing one’s privacy lists using the ‘jabber:iq:privacy’ namespace.
Constructor and Description |
---|
PrivacyList(java.lang.String name)
Creates a privacy list.
|
PrivacyList(java.lang.String name,
java.util.Collection<PrivacyRule> items)
Creates a privacy list with rules.
|
Modifier and Type | Method and Description |
---|---|
PrivacyList |
asActive()
Gets the privacy list marked as active list.
|
PrivacyList |
asDefault()
Gets the privacy list marked as default list.
|
int |
compareTo(PrivacyList o)
Compares this privacy list with another list.
|
static PrivacyList |
createInvisibilityList()
Creates a global invisibility list.
|
static PrivacyList |
createInvisibilityListExceptForGroups(java.lang.String listName,
java.lang.String... groups)
Creates a global invisibility list, where you are still visible to some contacts.
|
static PrivacyList |
createInvisibilityListExceptForUsers(java.lang.String listName,
Jid... jids)
Creates a global invisibility list, where you are still visible to some contacts.
|
static PrivacyList |
createInvisibilityListForGroups(java.lang.String listName,
java.lang.String... groups)
Creates a selective invisibility list.
|
static PrivacyList |
createInvisibilityListForUsers(java.lang.String listName,
Jid... jids)
Creates a selective invisibility list.
|
java.lang.String |
getName()
Gets the name of the privacy list.
|
java.util.List<PrivacyRule> |
getPrivacyRules()
Gets the privacy rules.
|
boolean |
isActive()
Indicates whether this is the active list.
|
boolean |
isDefault()
Indicates whether this is the default list.
|
java.lang.String |
toString() |
public PrivacyList(java.lang.String name, java.util.Collection<PrivacyRule> items)
Creates a privacy list with rules.
name
- The privacy list’s name.items
- The privacy rules.public PrivacyList(java.lang.String name)
Creates a privacy list.
name
- The privacy list’s name.public static PrivacyList createInvisibilityList()
Creates a global invisibility list.
public static PrivacyList createInvisibilityListExceptForUsers(java.lang.String listName, Jid... jids)
Creates a global invisibility list, where you are still visible to some contacts.
listName
- The list name. See 4. Implementation Notes for recommended list names.jids
- The JIDs to which you are still visible.public static PrivacyList createInvisibilityListExceptForGroups(java.lang.String listName, java.lang.String... groups)
Creates a global invisibility list, where you are still visible to some contacts.
listName
- The list name. See 4. Implementation Notes for recommended list names.groups
- The roster groups to which you are still visible.public static PrivacyList createInvisibilityListForUsers(java.lang.String listName, Jid... jids)
Creates a selective invisibility list. You are only invisible to the provided JIDs. You are visible to everyone else.
listName
- The list name. See 4. Implementation Notes for recommended list names.jids
- The JIDs to which you appear invisible.public static PrivacyList createInvisibilityListForGroups(java.lang.String listName, java.lang.String... groups)
Creates a selective invisibility list. You are only invisible to the provided JIDs. You are visible to everyone else.
listName
- The list name. See 4. Implementation Notes for recommended list names.groups
- The roster groups to which you appear invisible.public final java.util.List<PrivacyRule> getPrivacyRules()
Gets the privacy rules.
public final java.lang.String getName()
Gets the name of the privacy list.
public final boolean isDefault()
Indicates whether this is the default list.
public final boolean isActive()
Indicates whether this is the active list.
public final PrivacyList asActive()
Gets the privacy list marked as active list.
isActive()
public final PrivacyList asDefault()
Gets the privacy list marked as default list.
isDefault()
public final int compareTo(PrivacyList o)
Compares this privacy list with another list. When sorted, default lists are listed first, then active lists, then lists are sorted by their name.
compareTo
in interface java.lang.Comparable<PrivacyList>
o
- The other list.public final java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2014–2019 XMPP.rocks. All rights reserved.