public class OperationSetPersistentPresenceJabberImpl extends AbstractOperationSetPersistentPresence<ProtocolProviderServiceJabberImpl>
Modifier and Type | Class and Description |
---|---|
(package private) class |
OperationSetPersistentPresenceJabberImpl.ContactChangesListener
Manage changes of statuses by resource.
|
parentProvider
Constructor and Description |
---|
OperationSetPersistentPresenceJabberImpl(ProtocolProviderServiceJabberImpl provider,
InfoRetreiver infoRetreiver)
Creates the OperationSet.
|
Modifier and Type | Method and Description |
---|---|
void |
addServerStoredGroupChangeListener(ServerStoredGroupListener listener)
Registers a listener that would receive events upon changes in server
stored groups.
|
(package private) void |
assertConnected()
Utility method throwing an exception if the stack is not properly
initialized.
|
void |
createAccountPhotoPresenceInterceptor()
Creates an interceptor which modifies presence packet in order to add the
the element name "x" and the namespace "vcard-temp:x:update" in order to
advertise the avatar SHA-1 hash.
|
void |
createContactPhotoPresenceListener()
Creates a listener to call a parser which manages presence packets with
the element name "x" and the namespace "vcard-temp:x:update".
|
void |
createServerStoredContactGroup(ContactGroup parent,
java.lang.String groupName)
Creates a group with the specified name and parent in the server
stored contact list.
|
Contact |
createUnresolvedContact(java.lang.String address,
java.lang.String persistentData)
Creates and returns a unresolved contact from the specified
address and persistentData.
|
Contact |
createUnresolvedContact(java.lang.String address,
java.lang.String persistentData,
ContactGroup parentGroup)
Creates and returns a unresolved contact from the specified
address and persistentData.
|
ContactGroup |
createUnresolvedContactGroup(java.lang.String groupUID,
java.lang.String persistentData,
ContactGroup parentGroup)
Creates and returns a unresolved contact group from the specified
address and persistentData.
|
ContactJabberImpl |
createVolatileContact(java.lang.String id)
Creates a non persistent contact for the specified address.
|
ContactJabberImpl |
createVolatileContact(java.lang.String id,
boolean isPrivateMessagingContact)
Creates a non persistent contact for the specified address.
|
ContactJabberImpl |
createVolatileContact(java.lang.String id,
boolean isPrivateMessagingContact,
java.lang.String displayName)
Creates a non persistent contact for the specified address.
|
ContactJabberImpl |
createVolatileContact(java.lang.String id,
java.lang.String displayName)
Creates a non persistent contact for the specified address.
|
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/
|
(package private) void |
firePresenceStatusChanged(org.jivesoftware.smack.packet.Presence presence)
Fires the status change, respecting resource priorities.
|
void |
fireProviderStatusChangeEvent(PresenceStatus oldStatus,
PresenceStatus newStatus)
Fires provider status change.
|
java.lang.String |
getCurrentStatusMessage()
Returns the status message that was confirmed by the serfver
|
Contact |
getLocalContact()
Returns the protocol specific contact instance representing the local
user.
|
PresenceStatus |
getPresenceStatus()
Returns a PresenceStatus instance representing the state this provider
is currently in.
|
ContactGroup |
getServerStoredContactListRoot()
Returns the root group of the server stored contact list.
|
ServerStoredContactListJabberImpl |
getSsContactList()
Returns the contactlist impl.
|
java.util.Iterator<PresenceStatus> |
getSupportedStatusSet()
Returns the set of PresenceStatus objects that a user of this service
may request the provider to enter.
|
boolean |
isPrivateMessagingContact(java.lang.String contactAddress)
Checks if the contact address is associated with private messaging
contact or not.
|
static PresenceStatus |
jabberStatusToPresenceStatus(org.jivesoftware.smack.packet.Presence presence,
ProtocolProviderServiceJabberImpl jabberProvider)
Converts the specified jabber status to one of the status fields of the
JabberStatusEnum class.
|
void |
moveContactToGroup(Contact contactToMove,
ContactGroup newParent)
Removes the specified contact from its current parent and places it
under newParent.
|
void |
parseContactPhotoPresence(org.jivesoftware.smack.packet.Packet packet)
Parses a contact presence packet with the element name "x" and the
namespace "vcard-temp:x:update", in order to decide if the SHA-1 avatar
contained in the photo tag represents a new avatar for this contact.
|
static org.jivesoftware.smack.packet.Presence.Mode |
presenceStatusToJabberMode(PresenceStatus status)
Converts the specified JabberStatusEnum member to the corresponding
Jabber Mode
|
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)
Gets the PresenceStatus of a contact with a specific
String identifier.
|
void |
removeServerStoredContactGroup(ContactGroup group)
Removes the specified group from the server stored contact list.
|
void |
removeServerStoredGroupChangeListener(ServerStoredGroupListener listener)
Removes the specified group change listener so that it won't receive
any further events.
|
void |
renameServerStoredContactGroup(ContactGroup group,
java.lang.String newName)
Renames the specified group from the server stored contact list.
|
void |
setAuthorizationHandler(AuthorizationHandler handler)
Handler for incoming authorization requests.
|
void |
setDisplayName(Contact contact,
java.lang.String newName)
Sets the display name for contact to be newName.
|
void |
subscribe(ContactGroup parent,
java.lang.String contactIdentifier)
Persistently adds a subscription for the presence status of the
contact corresponding to the specified contactIdentifier and indicates
that it should be added to the specified group of the server stored
contact list.
|
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.
|
void |
updateAccountPhotoPresenceExtension(byte[] imageBytes)
Updates the presence extension to advertise a new photo SHA-1 hash
corresponding to the new avatar given in parameter.
|
addContactPresenceStatusListener, addProviderPresenceStatusListener, addSubscriptionListener, fireContactPresenceStatusChangeEvent, fireContactPresenceStatusChangeEvent, fireContactPresenceStatusChangeEvent, fireContactPropertyChangeEvent, fireProviderStatusChangeEvent, fireProviderStatusMessageChangeEvent, fireServerStoredGroupEvent, fireSubscriptionEvent, fireSubscriptionEvent, fireSubscriptionMovedEvent, removeContactPresenceStatusListener, removeProviderPresenceStatusListener, removeSubscriptionListener
public OperationSetPersistentPresenceJabberImpl(ProtocolProviderServiceJabberImpl provider, InfoRetreiver infoRetreiver)
provider
- the parent provider.infoRetreiver
- retrieve contact information.public void addServerStoredGroupChangeListener(ServerStoredGroupListener listener)
addServerStoredGroupChangeListener
in interface OperationSetPersistentPresence
addServerStoredGroupChangeListener
in class AbstractOperationSetPersistentPresence<ProtocolProviderServiceJabberImpl>
listener
- a ServerStoredGroupChangeListener impl that would
receive events upon group changes.public void createServerStoredContactGroup(ContactGroup parent, java.lang.String groupName) throws OperationFailedException
parent
- the group where the new group should be createdgroupName
- the name of the new group to create.OperationFailedException
- if such group already existspublic ContactJabberImpl createVolatileContact(java.lang.String id)
id
- the address of the contact to create.public ContactJabberImpl createVolatileContact(java.lang.String id, java.lang.String displayName)
id
- the address of the contact to create.displayName
- the display name of the contact.public ContactJabberImpl createVolatileContact(java.lang.String id, boolean isPrivateMessagingContact)
id
- the address of the contact to create.isPrivateMessagingContact
- indicates whether the contact should be private
messaging contact or not.public ContactJabberImpl createVolatileContact(java.lang.String id, boolean isPrivateMessagingContact, java.lang.String displayName)
id
- the address of the contact to create.isPrivateMessagingContact
- indicates whether the contact should be private
messaging contact or not.displayName
- the display name of the contact.public Contact createUnresolvedContact(java.lang.String address, java.lang.String persistentData, ContactGroup parentGroup)
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.parentGroup
- the group where the unresolved contact is supposed
to belong to.public 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.public ContactGroup createUnresolvedContactGroup(java.lang.String groupUID, java.lang.String persistentData, ContactGroup parentGroup)
groupUID
- an identifier, returned by ContactGroup's
getGroupUID, that the protocol provider may use in order to create
the group.persistentData
- a String returned ContactGroups's
getPersistentData() method during a previous run and that has been
persistently stored locally.parentGroup
- the group under which the new group is to be
created or null if this is group directly underneath the root.public Contact findContactByID(java.lang.String contactID)
contactID
- a String identifier of the contact which we're
seeking a reference of.public java.lang.String getCurrentStatusMessage()
public Contact getLocalContact()
getLocalContact
in class AbstractOperationSetPersistentPresence<ProtocolProviderServiceJabberImpl>
public PresenceStatus getPresenceStatus()
public ContactGroup getServerStoredContactListRoot()
public java.util.Iterator<PresenceStatus> getSupportedStatusSet()
public boolean isPrivateMessagingContact(java.lang.String contactAddress)
contactAddress
- the address of the contact.public void moveContactToGroup(Contact contactToMove, ContactGroup newParent) throws OperationFailedException
contactToMove
- the Contact to movenewParent
- the ContactGroup where Contact
would be placed.OperationFailedException
- when the operation didn't finished
successfully.public 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.public 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.java.lang.IllegalArgumentException
- if the specified
contactIdentifier does not identify a contact known to the
underlying protocol providerjava.lang.IllegalStateException
- if the underlying protocol provider is not
registered/signed on a public serviceOperationFailedException
- with code NETWORK_FAILURE if retrieving
the status fails due to errors experienced during network communicationpublic void removeServerStoredContactGroup(ContactGroup group) throws OperationFailedException
group
- the group to remove.OperationFailedException
- with code NETWORK_FAILURE if deleting
the group fails because of a network error.public void removeServerStoredGroupChangeListener(ServerStoredGroupListener listener)
removeServerStoredGroupChangeListener
in interface OperationSetPersistentPresence
removeServerStoredGroupChangeListener
in class AbstractOperationSetPersistentPresence<ProtocolProviderServiceJabberImpl>
listener
- the ServerStoredGroupChangeListener to removepublic void renameServerStoredContactGroup(ContactGroup group, java.lang.String newName)
group
- the group to rename.newName
- the new name of the group.public 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.public void subscribe(ContactGroup parent, java.lang.String contactIdentifier) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
parent
- the parent group of the server stored contact list
where the contact should be added. contactIdentifier
- the contact whose status updates we are
subscribing for.java.lang.IllegalArgumentException
- if contact or
parent are not a contact known to the underlying protocol
provider.java.lang.IllegalStateException
- if the underlying protocol provider is
not registered/signed on a public service.OperationFailedException
- with code NETWORK_FAILURE if
subscribing fails due to errors experienced during network
communicationpublic void subscribe(java.lang.String contactIdentifier) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
contactIdentifier
- the identifier of the contact whose status
updates we are subscribing for. java.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.OperationFailedException
- with code NETWORK_FAILURE if
subscribing fails due to errors experienced during network
communicationpublic void unsubscribe(Contact contact) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, OperationFailedException
contact
- the contact whose status updates we are unsubscribing
from.java.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.OperationFailedException
- with code NETWORK_FAILURE if
unsubscribing fails due to errors experienced during network
communicationpublic static PresenceStatus jabberStatusToPresenceStatus(org.jivesoftware.smack.packet.Presence presence, ProtocolProviderServiceJabberImpl jabberProvider)
presence
- the Jabber StatusjabberProvider
- the parent provider.public static org.jivesoftware.smack.packet.Presence.Mode presenceStatusToJabberMode(PresenceStatus status)
status
- the jabberStatusvoid assertConnected() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the underlying stack is not registered
and initialized.public void fireProviderStatusChangeEvent(PresenceStatus oldStatus, PresenceStatus newStatus)
fireProviderStatusChangeEvent
in class AbstractOperationSetPersistentPresence<ProtocolProviderServiceJabberImpl>
oldStatus
- old statusnewStatus
- new statuspublic void setDisplayName(Contact contact, java.lang.String newName) throws java.lang.IllegalArgumentException
setDisplayName
in interface OperationSetPersistentPresence
setDisplayName
in class AbstractOperationSetPersistentPresence<ProtocolProviderServiceJabberImpl>
contact
- the Contact that we are renamingnewName
- a String containing the new display name for
metaContact.java.lang.IllegalArgumentException
- if contact is not an
instance that belongs to the underlying implementation.void firePresenceStatusChanged(org.jivesoftware.smack.packet.Presence presence)
presence
- the presence changed.public void createAccountPhotoPresenceInterceptor()
public void updateAccountPhotoPresenceExtension(byte[] imageBytes)
imageBytes
- The new avatar set for this account.public void createContactPhotoPresenceListener()
public void parseContactPhotoPresence(org.jivesoftware.smack.packet.Packet packet)
packet
- The packet received to parse.public ServerStoredContactListJabberImpl getSsContactList()
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.