Package rocks.xmpp.extensions.privacy
Class PrivacyListManager
- java.lang.Object
-
- rocks.xmpp.core.stanza.AbstractIQHandler
-
- rocks.xmpp.extensions.privacy.PrivacyListManager
-
- All Implemented Interfaces:
ExtensionProtocol
,IQHandler
public final class PrivacyListManager extends AbstractIQHandler implements ExtensionProtocol
This class manages privacy lists, which allow users to block communications from other users as described in XEP-0016: Privacy Lists.Server-side privacy lists enable successful completion of the following use cases:
- Retrieving one's privacy lists.
- Adding, removing, and editing one's privacy lists.
- Setting, changing, or declining active lists.
- Setting, changing, or declining the default list (i.e., the list that is active by default).
- Allowing or blocking messages based on JID, group, or subscription type (or globally).
- Allowing or blocking inbound presence notifications based on JID, group or subscription type (or globally).
- Allowing or blocking outbound presence notifications based on JID, group or subscription type (or globally).
- Allowing or blocking IQ stanzas based on JID, group, or subscription type (or globally).
- Allowing or blocking all communications based on JID, group, or subscription type (or globally).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPrivacyListListener(Consumer<PrivacyListEvent> privacyListListener)
Adds a privacy list listener.AsyncResult<IQ>
createOrUpdateList(PrivacyList privacyList)
Creates or edits a privacy list.AsyncResult<IQ>
declineActiveList()
Declines the use of any active list.AsyncResult<IQ>
declineDefaultList()
Declines the use of any default list.String
getNamespace()
The protocol's main namespace.AsyncResult<PrivacyList>
getPrivacyList(String name)
Gets a privacy list.AsyncResult<Collection<PrivacyList>>
getPrivacyLists()
Gets the privacy lists.boolean
isEnabled()
Indicates whether this protocol is enabled.AsyncResult<IQ>
removeList(String name)
Removes a privacy list.void
removePrivacyListListener(Consumer<PrivacyListEvent> privacyListListener)
Removes a previously added privacy list listener.AsyncResult<IQ>
setActiveList(String name)
Changes the active list currently being applied.AsyncResult<IQ>
setDefaultList(String name)
Change the default list (which applies to the user as a whole, not only the sending resource).-
Methods inherited from class rocks.xmpp.core.stanza.AbstractIQHandler
getPayloadClass, handleRequest
-
-
-
-
Method Detail
-
addPrivacyListListener
public void addPrivacyListListener(Consumer<PrivacyListEvent> privacyListListener)
Adds a privacy list listener.- Parameters:
privacyListListener
- The listener.- See Also:
removePrivacyListListener(Consumer)
-
removePrivacyListListener
public void removePrivacyListListener(Consumer<PrivacyListEvent> privacyListListener)
Removes a previously added privacy list listener.- Parameters:
privacyListListener
- The listener.- See Also:
addPrivacyListListener(Consumer)
-
getPrivacyLists
public AsyncResult<Collection<PrivacyList>> getPrivacyLists()
Gets the privacy lists.- Returns:
- The async result with the privacy lists.
- See Also:
- 2.3 Retrieving One's Privacy Lists
-
getPrivacyList
public AsyncResult<PrivacyList> getPrivacyList(String name)
Gets a privacy list.- Parameters:
name
- The privacy list name.- Returns:
- The async result with the privacy list.
- See Also:
- 2.3 Retrieving One's Privacy Lists
-
setActiveList
public AsyncResult<IQ> setActiveList(String name)
Changes the active list currently being applied.- Parameters:
name
- The active list name.- Returns:
- The async result with the server's IQ reply.
- See Also:
- 2.4 Managing Active Lists
-
declineActiveList
public AsyncResult<IQ> declineActiveList()
Declines the use of any active list.- Returns:
- The async result with the server's IQ reply.
- See Also:
- 2.4 Managing Active Lists
-
setDefaultList
public AsyncResult<IQ> setDefaultList(String name)
Change the default list (which applies to the user as a whole, not only the sending resource).- Parameters:
name
- The list name.- Returns:
- The async result with the server's IQ reply.
- See Also:
- 2.5 Managing the Default List
-
declineDefaultList
public AsyncResult<IQ> declineDefaultList()
Declines the use of any default list.- Returns:
- The async result with the server's IQ reply.
- See Also:
- 2.5 Managing the Default List
-
createOrUpdateList
public AsyncResult<IQ> createOrUpdateList(PrivacyList privacyList)
Creates or edits a privacy list.- Parameters:
privacyList
- The privacy list.- Returns:
- The async result with the server's IQ reply.
- See Also:
- 2.6 Editing a Privacy List
-
removeList
public AsyncResult<IQ> removeList(String name)
Removes a privacy list.- Parameters:
name
- The privacy list.- Returns:
- The async result with the server's IQ reply.
- See Also:
- 2.8 Removing a Privacy List
-
getNamespace
public final String getNamespace()
Description copied from interface:ExtensionProtocol
The protocol's main namespace. This is used to uniquely identify the extension protocol.- Specified by:
getNamespace
in interfaceExtensionProtocol
- Returns:
- The main namespace.
-
isEnabled
public final boolean isEnabled()
Description copied from interface:ExtensionProtocol
Indicates whether this protocol is enabled.- Specified by:
isEnabled
in interfaceExtensionProtocol
- Returns:
- true, if enabled; false if disabled.
-
-