Class PrivacyList
- java.lang.Object
-
- rocks.xmpp.extensions.privacy.model.PrivacyList
-
- All Implemented Interfaces:
Comparable<PrivacyList>
public final class PrivacyList extends Object implements Comparable<PrivacyList>
The implementation of a privacy list.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.
- See Also:
- XEP-0016: Privacy Lists
-
-
Constructor Summary
Constructors Constructor Description PrivacyList(String name)
Creates a privacy list.PrivacyList(String name, Collection<PrivacyRule> items)
Creates a privacy list with rules.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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(String listName, String... groups)
Creates a global invisibility list, where you are still visible to some contacts.static PrivacyList
createInvisibilityListExceptForUsers(String listName, Jid... jids)
Creates a global invisibility list, where you are still visible to some contacts.static PrivacyList
createInvisibilityListForGroups(String listName, String... groups)
Creates a selective invisibility list.static PrivacyList
createInvisibilityListForUsers(String listName, Jid... jids)
Creates a selective invisibility list.boolean
equals(Object o)
String
getName()
Gets the name of the privacy list.List<PrivacyRule>
getPrivacyRules()
Gets the privacy rules.int
hashCode()
boolean
isActive()
Indicates whether this is the active list.boolean
isDefault()
Indicates whether this is the default list.String
toString()
-
-
-
Constructor Detail
-
PrivacyList
public PrivacyList(String name, Collection<PrivacyRule> items)
Creates a privacy list with rules.- Parameters:
name
- The privacy list's name.items
- The privacy rules.
-
PrivacyList
public PrivacyList(String name)
Creates a privacy list.- Parameters:
name
- The privacy list's name.
-
-
Method Detail
-
createInvisibilityList
public static PrivacyList createInvisibilityList()
Creates a global invisibility list.- Returns:
- The invisibility list.
-
createInvisibilityListExceptForUsers
public static PrivacyList createInvisibilityListExceptForUsers(String listName, Jid... jids)
Creates a global invisibility list, where you are still visible to some contacts.- Parameters:
listName
- The list name. See 4. Implementation Notes for recommended list names.jids
- The JIDs to which you are still visible.- Returns:
- The invisibility list.
- See Also:
- XEP-0126: Invisibility, 3.2.1 Becoming Visible by JID
-
createInvisibilityListExceptForGroups
public static PrivacyList createInvisibilityListExceptForGroups(String listName, String... groups)
Creates a global invisibility list, where you are still visible to some contacts.- Parameters:
listName
- The list name. See 4. Implementation Notes for recommended list names.groups
- The roster groups to which you are still visible.- Returns:
- The invisibility list.
- See Also:
- XEP-0126: Invisibility, 3.2.2 Becoming Visible by Roster Group
-
createInvisibilityListForUsers
public static PrivacyList createInvisibilityListForUsers(String listName, Jid... jids)
Creates a selective invisibility list. You are only invisible to the provided JIDs. You are visible to everyone else.- Parameters:
listName
- The list name. See 4. Implementation Notes for recommended list names.jids
- The JIDs to which you appear invisible.- Returns:
- The invisibility list.
- See Also:
- XEP-0126: Invisibility, 3.4.1 Becoming Invisible by JID
-
createInvisibilityListForGroups
public static PrivacyList createInvisibilityListForGroups(String listName, String... groups)
Creates a selective invisibility list. You are only invisible to the provided JIDs. You are visible to everyone else.- Parameters:
listName
- The list name. See 4. Implementation Notes for recommended list names.groups
- The roster groups to which you appear invisible.- Returns:
- The invisibility list.
- See Also:
- XEP-0126: Invisibility, 3.4.2 Becoming Invisible by Roster Group
-
getPrivacyRules
public final List<PrivacyRule> getPrivacyRules()
Gets the privacy rules.- Returns:
- The privacy rules.
-
getName
public final String getName()
Gets the name of the privacy list.- Returns:
- The name.
-
isDefault
public final boolean isDefault()
Indicates whether this is the default list.- Returns:
- True, if this is the default list.
-
isActive
public final boolean isActive()
Indicates whether this is the active list.- Returns:
- True, if this is the active list.
-
asActive
public final PrivacyList asActive()
Gets the privacy list marked as active list.- Returns:
- The list as active list.
- See Also:
isActive()
-
asDefault
public final PrivacyList asDefault()
Gets the privacy list marked as default list.- Returns:
- The privacy list as default list.
- See Also:
isDefault()
-
compareTo
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.- Specified by:
compareTo
in interfaceComparable<PrivacyList>
- Parameters:
o
- The other list.- Returns:
- The comparison result.
-
-