public interface OperationSetPresence extends OperationSet
This operation set is meant to be implemented by all protocols that support
presence, regardless of whether or not they can store contacts somewhere
on the network. Operations that allow managing server stored contact lists
are part of OperationSetPersistentPresence
.
Modifier and Type | Method and Description |
---|---|
void |
addContactPresenceStatusListener(ContactPresenceStatusListener listener)
Registers a listener that would receive a presence status change event
every time a contact, whose status we're subscribed for, changes her
status.
|
void |
addProviderPresenceStatusListener(ProviderPresenceStatusListener listener)
Adds a listener that would receive events upon changes of the provider
presence status.
|
void |
addSubscriptionListener(SubscriptionListener listener)
Registers a listener that would get notifications any time a new
subscription was successfully added, has failed or was removed.
|
Contact |
createUnresolvedContact(java.lang.String address,
java.lang.String persistentData)
Creates and returns a unresolved contact from the specified
address and persistentData.
|
Contact |
findContactByID(java.lang.String contactID)
Returns a reference to the contact with the specified ID in case we have
a subscription for it and null otherwise/
|
java.lang.String |
getCurrentStatusMessage()
Returns the status message that was confirmed by the server
|
PresenceStatus |
getPresenceStatus()
Returns a PresenceStatus instance representing the state this provider is
currently in.
|
java.util.Iterator<PresenceStatus> |
getSupportedStatusSet()
Returns the set of PresenceStatus objects that a user of this service may
request the provider to enter.
|
void |
publishPresenceStatus(PresenceStatus status,
java.lang.String statusMessage)
Requests the provider to enter into a status corresponding to the
specified parameters.
|
PresenceStatus |
queryContactStatus(java.lang.String contactIdentifier)
Get the PresenceStatus for a particular contact.
|
void |
removeContactPresenceStatusListener(ContactPresenceStatusListener listener)
Removes the specified listener so that it won't receive any further
updates on contact presence status changes
|
void |
removeProviderPresenceStatusListener(ProviderPresenceStatusListener listener)
Unregisters the specified listener so that it does not receive further
events upon changes in local presence status.
|
void |
removeSubscriptionListener(SubscriptionListener listener)
Removes the specified subscription listener.
|
void |
setAuthorizationHandler(AuthorizationHandler handler)
Handler for incoming authorization requests.
|
void |
subscribe(java.lang.String contactIdentifier)
Adds a subscription for the presence status of the contact corresponding
to the specified contactIdentifier.
|
void |
unsubscribe(Contact contact)
Removes a subscription for the presence status of the specified contact.
|
PresenceStatus getPresenceStatus()
void publishPresenceStatus(PresenceStatus status, java.lang.String statusMessage) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
status
- the PresenceStatus as returned by getRequestableStatusSetstatusMessage
- the message that should be set as the reason to
enter that statusjava.lang.IllegalArgumentException
- if the status requested is not a valid
PresenceStatus supported by this provider.java.lang.IllegalStateException
- if the provider is not currently
registered.OperationFailedException
- with code NETWORK_FAILURE if publishing
the status fails due to a network error.java.util.Iterator<PresenceStatus> getSupportedStatusSet()
PresenceStatus queryContactStatus(java.lang.String contactIdentifier) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
contactIdentifier
- the identifier of the contact whose status we're
interested in.OperationFailedException
- with code NETWORK_FAILURE if retrieving
the status fails due to errors experienced during network communicationjava.lang.IllegalArgumentException
- if contact is not a contact
known to the underlying protocol providerjava.lang.IllegalStateException
- if the underlying protocol provider is not
registered/signed on a public service.void subscribe(java.lang.String contactIdentifier) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
This subscription is not going to be persistent (as opposed to subscriptions added from the OperationSetPersistentPresence.subscribe() method)
contactIdentifier
- the identifier of the contact whose status
updates we are subscribing for.
OperationFailedException
- with code NETWORK_FAILURE if subscribing
fails due to errors experienced during network communicationjava.lang.IllegalArgumentException
- if contact is not a contact
known to the underlying protocol providerjava.lang.IllegalStateException
- if the underlying protocol provider is not
registered/signed on a public service.void unsubscribe(Contact contact) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
contact
- the contact whose status updates we are unsubscribing
from.OperationFailedException
- with code NETWORK_FAILURE if
unsubscribing fails due to errors experienced during network
communicationjava.lang.IllegalArgumentException
- if contact is not a contact
known to the underlying protocol providerjava.lang.IllegalStateException
- if the underlying protocol provider is not
registered/signed on a public service.Contact findContactByID(java.lang.String contactID)
contactID
- a String identifier of the contact which we're seeking a
reference of.void setAuthorizationHandler(AuthorizationHandler handler)
handler
- an instance of an AuthorizationHandler for authorization
requests coming from other users requesting permission add us
to their contact list.void addProviderPresenceStatusListener(ProviderPresenceStatusListener listener)
listener
- the listener to register for changes in our
PresenceStatus.void removeProviderPresenceStatusListener(ProviderPresenceStatusListener listener)
listener
- ProviderPresenceStatusListenervoid addContactPresenceStatusListener(ContactPresenceStatusListener listener)
listener
- the listener that would received presence status updates
for contacts.void removeContactPresenceStatusListener(ContactPresenceStatusListener listener)
listener
- the listener to remove.void addSubscriptionListener(SubscriptionListener listener)
listener
- the SubscriptionListener to registervoid removeSubscriptionListener(SubscriptionListener listener)
listener
- the listener to remove.java.lang.String getCurrentStatusMessage()
Contact createUnresolvedContact(java.lang.String address, java.lang.String persistentData)
address
- an identifier of the contact that we'll be creating.persistentData
- a String returned Contact's getPersistentData()
method during a previous run and that has been persistently
stored locally.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.